unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Font locking #|...|# block in lisp mode?
@ 2010-10-25 15:13 Leo
  2010-10-25 19:38 ` Stefan Monnier
  2010-10-25 19:42 ` Sam Steingold
  0 siblings, 2 replies; 8+ messages in thread
From: Leo @ 2010-10-25 15:13 UTC (permalink / raw)
  To: emacs-devel

Hello all,

Common Lisp can use #| and |# to comment a block however its font
locking is usually wrong in Emacs. I wonder if this can be improved?
Thanks.

Leo




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Font locking #|...|# block in lisp mode?
  2010-10-25 15:13 Font locking #|...|# block in lisp mode? Leo
@ 2010-10-25 19:38 ` Stefan Monnier
  2010-10-25 19:42 ` Sam Steingold
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2010-10-25 19:38 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

> Common Lisp can use #| and |# to comment a block however its font
> locking is usually wrong in Emacs. I wonder if this can be improved?

Don't know: works for me, so I'm not sure what case needs to
be improved.


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Font locking #|...|# block in lisp mode?
  2010-10-25 15:13 Font locking #|...|# block in lisp mode? Leo
  2010-10-25 19:38 ` Stefan Monnier
@ 2010-10-25 19:42 ` Sam Steingold
  2010-10-26  3:24   ` Leo
  1 sibling, 1 reply; 8+ messages in thread
From: Sam Steingold @ 2010-10-25 19:42 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo wrote:
> Common Lisp can use #| and |# to comment a block however its font
> locking is usually wrong in Emacs. I wonder if this can be improved?

emacs uses the heuristic that "^(" starts a function.
this mean that a paren in column one which does not start a function will mess 
emacs us.
you can add a space before it in comment or backslash in doc string:

(defun f ()
   "Doc which contains parens.
\(backslash disappears in the reader but saves emacs)"
   code...)

#| add a space before "(defun" to help emacs
  (defun f ())
#|



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Font locking #|...|# block in lisp mode?
  2010-10-25 19:42 ` Sam Steingold
@ 2010-10-26  3:24   ` Leo
  2010-10-26  4:06     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Leo @ 2010-10-26  3:24 UTC (permalink / raw)
  To: Emacs Devel

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

On 2010-10-26 03:42 +0800, Sam Steingold wrote:
> emacs uses the heuristic that "^(" starts a function.
> this mean that a paren in column one which does not start a function
> will mess emacs us.
> you can add a space before it in comment or backslash in doc string:
>
> (defun f ()
>   "Doc which contains parens.
> \(backslash disappears in the reader but saves emacs)"
>   code...)
>
> #| add a space before "(defun" to help emacs
>  (defun f ())
> #|

On 2010-10-26 03:38 +0800, Stefan Monnier wrote:
> Don't know: works for me, so I'm not sure what case needs to
> be improved.
>
>
>         Stefan

From time to time I have seen code inside #| |# not shown in a comment
face, unfortunately the font locking seems random to me i.e. sometimes
the block is properly font locked after deleting or re-opening the file.

For example:


[-- Attachment #2: emacs-comment.png --]
[-- Type: image/png, Size: 27368 bytes --]

[-- Attachment #3: Type: text/plain, Size: 108 bytes --]


I can get |# to be highlighted in a normal face by deleting or inserting
a blank line in front of it.

Leo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Font locking #|...|# block in lisp mode?
  2010-10-26  3:24   ` Leo
@ 2010-10-26  4:06     ` Stefan Monnier
  2010-10-27  1:29       ` Leo
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2010-10-26  4:06 UTC (permalink / raw)
  To: Leo; +Cc: Emacs Devel

> From time to time I have seen code inside #| |# not shown in a comment
> face, unfortunately the font locking seems random to me i.e. sometimes
> the block is properly font locked after deleting or re-opening the file.
> For example:
[... Example with open parens highlighted in font-lock-warning face ...]
> I can get |# to be highlighted in a normal face by deleting or inserting
> a blank line in front of it.

Every wondered why those open parens are highlighted in
font-lock-warning face?


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Font locking #|...|# block in lisp mode?
  2010-10-26  4:06     ` Stefan Monnier
@ 2010-10-27  1:29       ` Leo
  2010-11-08 19:23         ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Leo @ 2010-10-27  1:29 UTC (permalink / raw)
  To: emacs-devel

On 2010-10-26 12:06 +0800, Stefan Monnier wrote:
> Every wondered why those open parens are highlighted in
> font-lock-warning face?

I tend to ignore them but it'd be great to get rid of them.

Leo




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Font locking #|...|# block in lisp mode?
  2010-10-27  1:29       ` Leo
@ 2010-11-08 19:23         ` Stefan Monnier
  2010-11-09 11:48           ` Leo
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2010-11-08 19:23 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

>> Every wondered why those open parens are highlighted in
>> font-lock-warning face?
> I tend to ignore them but it'd be great to get rid of them.

Easy: put a backslash in front the of open paren.  Or did you mean
something else?


        Stefan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Font locking #|...|# block in lisp mode?
  2010-11-08 19:23         ` Stefan Monnier
@ 2010-11-09 11:48           ` Leo
  0 siblings, 0 replies; 8+ messages in thread
From: Leo @ 2010-11-09 11:48 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 2010-11-09 03:23 +0800, Stefan Monnier wrote:
>>> Every wondered why those open parens are highlighted in
>>> font-lock-warning face?
>> I tend to ignore them but it'd be great to get rid of them.
>
> Easy: put a backslash in front the of open paren.  Or did you mean
> something else?
>
>
>         Stefan

I meant without having to insert \.

Leo



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-11-09 11:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25 15:13 Font locking #|...|# block in lisp mode? Leo
2010-10-25 19:38 ` Stefan Monnier
2010-10-25 19:42 ` Sam Steingold
2010-10-26  3:24   ` Leo
2010-10-26  4:06     ` Stefan Monnier
2010-10-27  1:29       ` Leo
2010-11-08 19:23         ` Stefan Monnier
2010-11-09 11:48           ` Leo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).