[slime-devel] [RfC] Changing behaviour of `C-w' in Isearch

Tobias C. Rittweiler tcr at freebits.de
Tue Jan 8 11:51:16 UTC 2008


Hi,

I often find it quite annoying that `C-w' during Isearch just inserts
the word at point; the reason is that variable identifiers in Lisp
contain non-word constituents very often.

E.g. If point is at *special-variables*, you'd have to press `C-w' three
times to eventually get it inserted as the search string.

The following will make `C-w' respect symbol constituents as well as
word constituents when isearching in Lisp buffers, such that one `C-w'
will suffice for gripping special variables.

  (defun isearch-yank-symbolic-word-or-char ()
    (interactive)
    (isearch-yank-internal
     (lambda ()
       (let ((distance (skip-syntax-forward "w_")))
         (when (zerop distance) (forward-char 1))
         (point)))))

  (add-hook 'lisp-mode-hook
            (lambda ()
              (make-local-variable 'isearch-mode-map)
              (define-key isearch-mode-map
                "\C-w" 'isearch-yank-symbolic-word-or-char)))


I consider this generally useful, and wanted to ask if I should commit
something like that to Slime?

  -T.




More information about the slime-devel mailing list