[slime-devel] Proper way to bind keys in *slime-description* buffers only

Sebastian Tennant sebyte at smolny.plus.com
Sat Mar 12 10:39:18 UTC 2011


Quoth MON KEY <monkey at sandpframing.com>:
> Here is one possibility for achieving the functionality OP requested:

Your solution does considerbaly more than I need (including adding a
buffer-local hook variable facility) so I've taken the bare essentials from
your slime-description-view-source-file function and used it to craft a piece
of advice which works perfectly well for my purposes (and doesn't affect other
SLIME buffers):

 (defadvice slime-show-description (after local-key-bindings activate)
   "Key bindings active in *slime-descriprion* buffers only."
   (with-current-buffer (get-buffer (slime-buffer-name :description))
      (lambda ()
        (let (matched)
            (goto-char (point-min))
            (and (search-forward-regexp "^[[:blank:]]*?Source file: \\(/.*\\)$" nil t)
                 (setq matched (match-string 1))))
          (and matched (file-exists-p matched) (view-file-other-window matched)))))))

Many thanks for your time.

Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.

More information about the slime-devel mailing list