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

Bill Clementson billclem at gmail.com
Tue Jan 8 15:35:39 UTC 2008

Hi Tobias,

> 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?

I don't know whether it should be put into Slime; however, it's easy
enough to set this in emacs by doing the following:

(modify-syntax-entry ?- "w") ; now '-' is not considered a word-delimiter

Bill Clementson

More information about the slime-devel mailing list