Emacs Clojure mode : No syntax highlighting for #_

222 views
Skip to first unread message

JvJ

unread,
Aug 28, 2013, 10:09:11 PM8/28/13
to clo...@googlegroups.com
Although semicolons cause the text color to change in order to look "commented-out", the #_ reader macro doesn't cause any such change.  Is this intended, or is it a bug?

John Gabriele

unread,
Aug 29, 2013, 2:02:07 AM8/29/13
to clo...@googlegroups.com
On Wednesday, August 28, 2013 6:09:11 PM UTC-4, JvJ wrote:
Although semicolons cause the text color to change in order to look "commented-out", the #_ reader macro doesn't cause any such change.  Is this intended, or is it a bug?

I see this as well with the version of clojure-mode I've installed from marmalade via M-x package-install.

Joel Holdbrooks

unread,
Aug 29, 2013, 2:06:45 AM8/29/13
to clo...@googlegroups.com
I would imagine it is intended since #_ is a reader macro. #_ is not intended for commenting. Rather, it instructs the Clojure Reader to ignore entirely the subsequent form. This is much different from the comment macro (which simply takes any number of arguments and returns nil) or the ; comment syntax. 

It might be a bit involved to have #_ and the subsequent form appear commented through clojure-mode's syntax highlighting. However, it would also incorrectly express the semantics of #_ which, arguably, is counter to the goal of syntax highlighting.

Laurent PETIT

unread,
Aug 29, 2013, 8:58:43 AM8/29/13
to clo...@googlegroups.com
2013/8/29 Joel Holdbrooks <cjhold...@gmail.com>:
> I would imagine it is intended since #_ is a reader macro. #_ is not
> intended for commenting. Rather, it instructs the Clojure Reader to ignore
> entirely the subsequent form. This is much different from the comment macro
> (which simply takes any number of arguments and returns nil) or the ;
> comment syntax.
>
> It might be a bit involved to have #_ and the subsequent form appear
> commented through clojure-mode's syntax highlighting. However, it would also
> incorrectly express the semantics of #_ which, arguably, is counter to the
> goal of syntax highlighting.

Yet it is certainly better, given a dual choice, to present it as
commented code.
Counterclockwise does this since more than a year, and so far, nobody
has complained.

Cheers,

--
Laurent

>
>
> On Wednesday, August 28, 2013 3:09:11 PM UTC-7, JvJ wrote:
>>
>> Although semicolons cause the text color to change in order to look
>> "commented-out", the #_ reader macro doesn't cause any such change. Is this
>> intended, or is it a bug?
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Joel Holdbrooks

unread,
Aug 29, 2013, 4:59:01 PM8/29/13
to clo...@googlegroups.com
Definitely. I would agree a choice would be nice or even another font-lock group. There have been times where I forgot about a #_ somewhere in my code and spent a moment in confusion. Highlighting definitely would have been valuable. It would be cool if code following #_ were semi-transparent or something nifty like that. I think that's possible in the gui version of Emacs.


You received this message because you are subscribed to a topic in the Google Groups "Clojure" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojure/b5ETVbGG8G8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--

Joel

Phil Hagelberg

unread,
Sep 3, 2013, 7:03:07 PM9/3/13
to clo...@googlegroups.com
On Wednesday, August 28, 2013 7:06:45 PM UTC-7, Joel Holdbrooks wrote:
> It might be a bit involved to have #_ and the subsequent form appear commented
> through clojure-mode's syntax highlighting. However, it would also incorrectly express
> the semantics of #_ which, arguably, is counter to the goal of syntax highlighting.

 I don't think there's one right answer here. Using semicolons for comments is clearer since those are free-form comments which ignore structure, but both #_ and (comment ...) take structure into account, and thus need to be at least syntactically valid forms. For instance, (comment ...) is usually used for example code in which case you want it to be highlighted like normal code. If there were a way to indicate commentedness without sacrificing this it might make sense, but I'm not sure what that would look like.

-Phil

Jozef Wagner

unread,
Sep 3, 2013, 7:17:16 PM9/3/13
to clo...@googlegroups.com
This is the convention I would like to see in an ideal clojure highlighter theme: 

;; comments are highlighted so that they stand out. Comments are meant to be read, not forgotten.
(comment ) form is for example code, so it is highlighted as a normal clojure code
#_ is used for disabling parts of code, so the disabled form has grayed color and is strikedthrough-ed.

JW

Cedric Greevey

unread,
Sep 3, 2013, 9:40:55 PM9/3/13
to clo...@googlegroups.com
I vote for (comment ...) being highlighted like normal, except with some modification, such as italicized, smaller font, tinged towards gray or tinted some other way, or something, so you can immediately see that it's not the same as a nearby defn.



--
Reply all
Reply to author
Forward
0 new messages