Saturday, August 16, 2014

Clojure friendly word definitions in Emacs

Want Emacs to treat some-symbol as a single word for editing? I do! And here is how:
Add to your init.el

(dolist (c (string-to-list ":_-?!#*"))
  (modify-syntax-entry c "w" emacs-lisp-mode-syntax-table))

This works great with evil-mode (vim style) delete word (dw) and change word (cw) shortcuts.

2 comments:

Syed Khurram said...

Hi Timothy,

Nice hack. Thanks.

If you're editing .clj or .cljs using clojure-mode, you need to add this to clojure-mode-syntax-table instead of emacs-lisp-mode-syntax-table:

(dolist (c (string-to-list ":_-?!#*"))
(modify-syntax-entry c "w" clojure-mode-syntax-table ))

Thanks again.

Dmitry said...

What are you, a wizard? :)
I was just thinking about this an hour ago and now I have a solution! Thanks! :)