unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Multi-line comment font-lock problem for lisp-mode
       [not found]     ` <87y94lqyyd.fsf@lynx.ionific.com>
@ 2003-02-12 16:51       ` Torsten Anders
  0 siblings, 0 replies; only message in thread
From: Torsten Anders @ 2003-02-12 16:51 UTC (permalink / raw)


Hi,

I came across some strange of the fontification of multi-line 
comments in lisp mode.

I am used to put some tests calls in my code (commented out). So I
surround them by #| and |#. Emacs colours multi-line comments properly
as long as they only contain text. But as soon as I put code in the
comment (i.e. a line starting with an open parenthesis), the colouring
becomes, well, strange (i.e. rather complicated behaviour). E.g., all
code after the multi-line comment (i.e. starting with the the | in |#)
is coloured in string face (up the the next |).

To give an example, the following behaves as expected.


(defun foo ()
  t)

#|
(defun foo ()
  t)
(defparameter *hop* 1)
|#

(defun foo ()
  t)

But just add a newline between the two expressions
commented out, and you probably see what I am speaking about.

(defun foo ()
  t)

#|
(defun foo ()
  t)

(defparameter *hop* 1)
|#

(defun foo ()
  t)

Remove this newline again: colouring does not change back. 

You might argue: OK, just use only a single expression per comment.
But change anything in the comment (e.g. add a space) and wait a few
seconds... 

(defun foo ()
  t)

#|
(defun foo (x)  
  (+ x 
     x)
|#

(defun foo ()
  t)

Or try a more complex comment (just some arbitrary code...):

(defun foo ()
  t)

#|
(defun convert-to-package (form from-package to-package)
  (if (eq (find-package from-package) (find-package to-package))
    form
    (cond ((null form) nil)
          ((listp form)
           (loop for item in form 
                 collect  (convert-to-package item from-package
to-package)))
          ((constantp form) form)
          ((symbolp form)
           (if (eq (symbol-package form) 
                   (find-package from-package))
             (intern (symbol-name form) to-package)    ; converts it to
to-package
             form))                       ; pass it unchanged otherwise
          (T (error "Do not know how to handle ~A" form)))))
|#

(defun foo ()
  t)


I read in the Emacs doc that an open parenthesis always starts a new
code block (e.g. a defun). But this behaviour looks somewhat more
complex ;-) Anyway, is this a bug? Or is there some way to switch of
this behaviour?

Thanks!


Kind regards,
Torsten Anders

PS: I am running GNU-Emacs 21.2 on a RH 8.0 Linux box
(I believe I also saw this problem on Emacs running on Win).

PPS: I am not subscribed to bug-gnu-emacs@gnu.org

-- 
Torsten Anders
Sonic Arts Research Centre
Queens University Belfast
Tel: +44 28 9027 4831 (office)
     +44 28 9066 7439 (private)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-12 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1045050067.1269.225.camel@chewa>
     [not found] ` <871y2dsmm6.fsf@lynx.ionific.com>
     [not found]   ` <1045061050.29866.273.camel@chewa>
     [not found]     ` <87y94lqyyd.fsf@lynx.ionific.com>
2003-02-12 16:51       ` Multi-line comment font-lock problem for lisp-mode Torsten Anders

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).