bloggo ergo sum
msgbartop
msgbarbottom

15 Sep 08 Dedicated window-buffer mapping with Emacs

I use CScope to navigate source code from within Emacs. It’s very, very useful and integrates will into Emacs. However, I’ve been wanting a way to control how cscope updates the buffer/window mappings as it locates search results for you. Sometimes, I like that CScope updates the buffer where I initiated the search to reflect the results, and it’s easy to get back to the point of origin using the C-c s u command.

However, sometimes I want CScope to leave my origin buffer alone and show the result location in another window so I can see both at the same time. It’s bothersome to have to arrange the buffers manually after performing a search, so I asked on stackoverflow.com, and voila! I got a good answer – create a simple keybinding to a function for dedicating a window/buffer mapping:

;; keybindings
(global-set-key [pause] 'toggle-window-dedicated)
 
;; buffer dedication (mostly for cscope
(defun toggle-window-dedicated ()
  "Toggle whether the current active window is dedicated"
  (interactive)
  (message
   (if (let (window (get-buffer-window (current-buffer)))
	 (set-window-dedicated-p window
				 (not (window-dedicated-p window))))
     "Window '%s' is dedicated"
     "Window '%s' is normal")
   (current-buffer)))

Now, using this, I can just hit the pause button on my keyboard when I want to pin down my main source buffer.

Tags: , ,

02 Jul 06 First Things in my .emacs

Pardon the extra linebreaks. I don’t normally format my lisp code this way, but the layout of my blog makes this snippet linewrap and hard to read.

(global-font-lock-mode t)
 
(defvar autosave-dir "~/.emacs.d/autosave")
(make-directory autosave-dir t)
 
(defun auto-save-file-name-p (filename)
  (string-match "^#.*#$" 
                     (file-name-nondirectory filename)))
 
(defun make-auto-save-file-name ()
  (concat autosave-dir
          (if buffer-file-name
              (concat "#" 
                         (file-name-nondirectory buffer-file-name) 
                         "#")
            (expand-file-name (concat "#%" 
                                                 (buffer-name) 
                                                 "#")))))
 
(defvar backup-dir "~/.emacs.d/backup")
(make-directory backup-dir t)
(setq backup-directory-alist (list (cons "." backup-dir)))

Tags: , ,

26 May 06 Shell Buffers in Emacs

snarfed.org writes about running shells inside of Emacs.

Tags:

26 May 06 Multi-TTy Emacs

This guy explains how to use Emacs over multiple TTys.

Tags: