Skip to content

Add #_ reader form #411

Closed
Closed
@benedekfazekas

Description

@benedekfazekas

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 "#_")))))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions