emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

implementing a reader macro


From: Ag Ibragimov
Subject: implementing a reader macro
Date: Fri, 22 Jul 2022 13:40:34 -0500

How difficult is it to implement a new reader macro for Elisp?
The one I particularly wish to be ported from Clojure is the "discard
macro" - `#_`. What it does is that it ignores the next form completely.

e.g., 
#+begin_src clojure
    #_(list 1 2 3)

    (list 1 #_2 3)
#+end_src

And it can be stacked to omit multiple forms:

#+begin_src clojure
  (foo 1
     #_#_(bar)       ; both, (bar) and 
     (zap "zop"))    ;       (zap "zop") will be ignored
#+end_src

It is a very nice way of (usually temporarily) commenting out sexps
without disrupting the structure too much. Of course, we can employ nice
tricks such as one described by Malabarba:
http://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html
But wouldn't it be nice to have something even better?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]