[Top][All Lists]

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

Re: implementing a reader macro

From: Stefan Monnier
Subject: Re: implementing a reader macro
Date: Fri, 22 Jul 2022 19:07:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>> 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.
>> Does `clojure-mode` support that correctly?
> AFAIK it works very well in clojure-mode.

That's actually not quite an answer to my question.

AFAICT clojure-mode just "manually" highlights those comments with
`font-lock-comment-face`, so sexp navigation will not handle them
properly w.r.t `parse-sexp-ignore-comments`, and `forward-comment` won't
skip them either.

Also this relies on the `font-lock-multiline` variable, which is a kind
of "best effort", so if the beginning of the comment is never displayed
(because it's never between `window-start` and `window-end`) the rest of
the comment may end up displayed without the `font-lock-comment-face`.

> Can you show some examples? I think most of them still require you to
> change the structure - you either have to wrap the form or prepend
> every line, etc.

My go-to key sequence for that is:

    C-M-SPC M-;

but in most circumstances there are other approaches that depend on the
specific situation.  E.g. often just adding a ' does the trick (tho
I usually prefer `M-;`).


reply via email to

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