GNU bug report logs - #14434
24.3; lisp mode's comment start seems bad

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Wed, 22 May 2013 04:28:01 UTC

Severity: normal

Found in version 24.3

Done: Leo Liu <sdl.web <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14434 in the body.
You can then email your comments to 14434 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#14434; Package emacs. (Wed, 22 May 2013 04:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Wed, 22 May 2013 04:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; lisp mode's comment start seems bad
Date: Wed, 22 May 2013 12:26:24 +0800
After fixing bug#14303, we can observe the following bug:

1. Emacs -q
2. insert in a emacs lisp mode buffer:
   (
     ;;
   )
3. Move point to be end of ;;
4. M-j

You should see:

   (
     ;;
     ;
   )

This seems to be due to bad comment-start-skip. Is the following fix correct?

--- lisp/emacs-lisp/lisp-mode.el.gz
+++ #<buffer lisp-mode.el.gz>
@@ -219,7 +219,7 @@
   (make-local-variable 'comment-start-skip)
   ;; Look within the line for a ; following an even number of backslashes
   ;; after either a non-backslash or the line beginning.
-  (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
+  (setq comment-start-skip "\\(\\(^\\|[^\\\\\n;]\\)\\(\\\\\\\\\\)*\\);+ *")
   (make-local-variable 'font-lock-comment-start-skip)
   ;; Font lock mode uses this only when it KNOWS a comment is starting.
   (setq font-lock-comment-start-skip ";+ *")

Diff finished.  Wed May 22 12:24:18 2013




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14434; Package emacs. (Wed, 22 May 2013 06:15:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#14434: 24.3; lisp mode's comment start seems bad
Date: Wed, 22 May 2013 08:15:53 +0200
Am 22.05.2013 06:26, schrieb Leo Liu:
> After fixing bug#14303, we can observe the following bug:
>
> 1. Emacs -q
> 2. insert in a emacs lisp mode buffer:
>     (
>       ;;
>     )
> 3. Move point to be end of ;;
> 4. M-j
>
> You should see:
>
>     (
>       ;;
>       ;
>     )
>
> This seems to be due to bad comment-start-skip. Is the following fix correct?
>
> --- lisp/emacs-lisp/lisp-mode.el.gz
> +++ #<buffer lisp-mode.el.gz>
> @@ -219,7 +219,7 @@
>     (make-local-variable 'comment-start-skip)
>     ;; Look within the line for a ; following an even number of backslashes
>     ;; after either a non-backslash or the line beginning.
> -  (setq comment-start-skip "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+ *")
> +  (setq comment-start-skip "\\(\\(^\\|[^\\\\\n;]\\)\\(\\\\\\\\\\)*\\);+ *")
>     (make-local-variable 'font-lock-comment-start-skip)
>     ;; Font lock mode uses this only when it KNOWS a comment is starting.
>     (setq font-lock-comment-start-skip ";+ *")
>
> Diff finished.  Wed May 22 12:24:18 2013
>
>
>
>

Maybe it would be worth to re-consider that comment-start-skip.
What about to drop it?

All we need is the position of comment start and it's end. What to do with code before resp. after, let the modes decide.

AFAIU you can't check for an even number of backslashes with a regexp, never.
So that will remain buggy.

Cheers,

andreas





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14434; Package emacs. (Wed, 22 May 2013 21:34:01 GMT) Full text and rfc822 format available.

Message #11 received at 14434 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 14434 <at> debbugs.gnu.org
Subject: Re: bug#14434: 24.3; lisp mode's comment start seems bad
Date: Wed, 22 May 2013 17:32:14 -0400
> After fixing bug#14303, we can observe the following bug:
> 1. Emacs -q
> 2. insert in a emacs lisp mode buffer:
>    (
>      ;;
>    )
> 3. Move point to be end of ;;
> 4. M-j

> You should see:

>    (
>      ;;
>      ;
>    )

> This seems to be due to bad comment-start-skip.

That's one way to see it.  Another is that it's a regression introduced
by the fix to bug#14303.  It probably affects more than
emacs-lisp-mode.  So it'd be better to fix it by improving your fix to
bug#14303.  E.g. after the new while loop which finds the comment start, do
a looking-at to make sure the match-data extends as far as possible.

Tho maybe, we should take a new look at bug#14303 to see why it failed,
since after all the old comment-search-backward did already pay
attention to comment-use-global-state (via comment-search-forward), so
maybe bug#14303 was really due to a bug in comment-search-forward.


        Stefan




Reply sent to Leo Liu <sdl.web <at> gmail.com>:
You have taken responsibility. (Fri, 07 Jun 2013 12:05:02 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Fri, 07 Jun 2013 12:05:03 GMT) Full text and rfc822 format available.

Message #16 received at 14434-done <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 14434-done <at> debbugs.gnu.org
Subject: Re: bug#14434: 24.3; lisp mode's comment start seems bad
Date: Fri, 07 Jun 2013 20:04:28 +0800
On 2013-05-23 05:32 +0800, Stefan Monnier wrote:
> That's one way to see it.  Another is that it's a regression introduced
> by the fix to bug#14303.  It probably affects more than
> emacs-lisp-mode.  So it'd be better to fix it by improving your fix to
> bug#14303.  E.g. after the new while loop which finds the comment start, do
> a looking-at to make sure the match-data extends as far as possible.
>
> Tho maybe, we should take a new look at bug#14303 to see why it failed,
> since after all the old comment-search-backward did already pay
> attention to comment-use-global-state (via comment-search-forward), so
> maybe bug#14303 was really due to a bug in comment-search-forward.

Thanks, Stefan, for the hints.

The fix for bug#14303 seems bad so I have reverted it and instead set
comment-use-global-state to t in octave-mode.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14434; Package emacs. (Fri, 07 Jun 2013 16:07:02 GMT) Full text and rfc822 format available.

Message #19 received at 14434-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 14434-done <at> debbugs.gnu.org
Subject: Re: bug#14434: 24.3; lisp mode's comment start seems bad
Date: Fri, 07 Jun 2013 12:05:57 -0400
> The fix for bug#14303 seems bad so I have reverted it and instead set
> comment-use-global-state to t in octave-mode.

Great, thank you,


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 06 Jul 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 321 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.