Closed
Description
Migrated over from clojure-emacs/clj-refactor.el#334 originally created by @agzam
Agreement was that this should rather come here. see more discussion on the original issue.
the original description is as follows:
Clojure's #_
(Ignore next form reader macro) is very useful. Would be very cool to have a function and a dedicated key binding to toggle it.
My initial attempt looks like this:
(defun cljr-toggle-ignore-next-form ()
"Ignore next form (#_)"
(interactive)
(if (search-backward "#_" 2 t 1)
(delete-char 2)
(progn
(let ((fc (following-char)))
(cond ((-contains? '( ?\) ?\] ?\} ) fc) (paredit-backward-up))
((-contains? '( ?\( ?\[ ?\: ?\{ ) fc) nil)
(t (beginning-of-thing 'sexp)))
(insert "#_")))))