Hi,
When I insert multiple region comments using the #| |# reader syntax, some of the code between the comments becomes highlighted as if it were part of the comments.
For example, in the blurb below, the third "defun" form is displayed as a comment.
Is this normal behavior?
Thanks in advance,
Evan
---- (defun test () nil)
#|
comment
|#
(defun test () nil)
#|
comment
#|
(defun test () nil) ----
Evan Monroig wrote:
Hi,
When I insert multiple region comments using the #| |# reader syntax, some of the code between the comments becomes highlighted as if it were part of the comments.
For example, in the blurb below, the third "defun" form is displayed as a comment.
This is a longstanding bug (more like design flaw) in the way that Emacs does font lock. You can put a space before the defun form to avoid this issue.
On 6/14/07, Brian Mastenbrook brian@mastenbrook.net wrote:
Evan Monroig wrote:
When I insert multiple region comments using the #| |# reader syntax, some of the code between the comments becomes highlighted as if it were part of the comments.
For example, in the blurb below, the third "defun" form is displayed as a comment.
This is a longstanding bug (more like design flaw) in the way that Emacs does font lock. You can put a space before the defun form to avoid this issue.
Thanks a lot for your response. I understand that it is difficult to fix.
How exactly do you arrange the source code to avoid this issue? I tried putting a space before the defun form (on the same line), but the highlighting does not change.
Thanks,
Evan
"Evan Monroig" evan.monroig@gmail.com writes:
How exactly do you arrange the source code to avoid this issue?
I circumvent the issue entirely by using `C-SPC' and `comment-region' (or `uncomment-region' respectively.)
FWIW,
-T.
On Jun 14, 2007, at 4:06 AM, Brian Mastenbrook wrote:
Evan Monroig wrote:
Hi, When I insert multiple region comments using the #| |# reader syntax, some of the code between the comments becomes highlighted as if it were part of the comments. For example, in the blurb below, the third "defun" form is displayed as a comment.
This is a longstanding bug (more like design flaw) in the way that Emacs does font lock. You can put a space before the defun form to avoid this issue.
Yep. And a very annoying indeed. Sometimes I work around the bug by using #|| and ||# to delimit comments. However you loose the comment highlighting.
Cheers
Marco
Thanks everyone for responding,
Tobias C. Rittweiler wrote:
How exactly do you arrange the source code to avoid this issue?
I circumvent the issue entirely by using `C-SPC' and `comment-region' (or `uncomment-region' respectively.)
Actually this is what I had been doing, not using the #| |# comments because they don't work properly. But I also find them quite nice when I wish to put some code inside them (a toplevel form) that I want to execute some times but not to execute when compiling.
Marco Antoniotti wrote:
Yep. And a very annoying indeed. Sometimes I work around the bug by using #|| and ||# to delimit comments. However you loose the comment highlighting.
Oh, thanks for this tip ! It helped me circumvent the bug that when you have some forms as follows and you position point after "|#" and press enter or edit the form (test3) a little bit, it becomes highlighted as a string..
---- (test1)
#|
(test2)
|#
(test3) ----
Evan
Date: Fri, 15 Jun 2007 16:22:14 +0900 From: "Evan Monroig" evan.monroig@gmail.com
Actually this is what I had been doing, not using the #| |# comments because they don't work properly. But I also find them quite nice when I wish to put some code inside them (a toplevel form) that I want to execute some times but not to execute when compiling.
A simpler way around this is to write #+(OR) or #-(AND) before the form. Emacs can handle this, and it will even behave better if you're using something like Paredit Mode, because it still looks like code to Emacs.
* Evan Monroig [2007-06-14 03:56+0200] writes:
For example, in the blurb below, the third "defun" form is displayed as a comment.
Is this normal behavior?
Looks right to me. AFAICT, the third defun is actually in a comment. Emacs 22 also seems to understand nested comments like:
"a" #| "b" |# "c" #| "d" #| "e" |# "f" |# "g"
a, c, and g are correctly highlighted as strings and the others as comments.
The opening paren of the third defun is highlighted. As explained in the manual, that can be avoided by writing (. See:
http://www.gnu.org/software/emacs/manual/html_node/emacs/Left-Margin-Paren.h...
Helmut.
On 6/14/07, Helmut Eller heller@common-lisp.net wrote:
Looks right to me. AFAICT, the third defun is actually in a comment. Emacs 22 also seems to understand nested comments like:
"a" #| "b" |# "c" #| "d" #| "e" |# "f" |# "g"
a, c, and g are correctly highlighted as strings and the others as comments.
The opening paren of the third defun is highlighted. As explained in the manual, that can be avoided by writing (. See:
Oh sorry, I had been annoyed by this behavior for quite a while so I decided to make a simple example and sent it, but the example is wrong..
Sorry, I'll post a real example when it comes out.
Evan
Ooops. You guys are right.
I had not checked Emacs 22 (too little hacking these days and most of it in LW). It seems that the "bug" got fixed.
Cheers
Marco
On Jun 14, 2007, at 9:44 AM, Evan Monroig wrote:
On 6/14/07, Helmut Eller heller@common-lisp.net wrote:
Looks right to me. AFAICT, the third defun is actually in a comment. Emacs 22 also seems to understand nested comments like:
"a" #| "b" |# "c" #| "d" #| "e" |# "f" |# "g"
a, c, and g are correctly highlighted as strings and the others as comments.
The opening paren of the third defun is highlighted. As explained in the manual, that can be avoided by writing (. See:
Oh sorry, I had been annoyed by this behavior for quite a while so I decided to make a simple example and sent it, but the example is wrong..
Sorry, I'll post a real example when it comes out.
Evan _______________________________________________ slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel