GNU bug report logs - #16695
24.3; comment-dwim (args out of range)

Previous Next

Packages: cc-mode, emacs;

Reported by: eg5cue <at> gmail.com

Date: Sat, 8 Feb 2014 19:57:04 UTC

Severity: normal

Merged with 15881

Found in version 24.3

Fixed in version 24.4

Done: Alan Mackenzie <acm <at> muc.de>

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 16695 in the body.
You can then email your comments to 16695 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 bug-gnu-emacs <at> gnu.org:
bug#16695; Package emacs. (Sat, 08 Feb 2014 19:57:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to eg5cue <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 08 Feb 2014 19:57:04 GMT) Full text and rfc822 format available.

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

From: eg5cue <at> gmail.com
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; comment-dwim (args out of range)
Date: Sat, 08 Feb 2014 14:32:51 +0000
this is a longstanding bug since 24.3(i don't tried older versions) till now (the latest git version - github mirror), and is very annoying.
it happens when trying to comment out (a line/multiple lines) except the first line from a C family file that:

it's first line isn't empty or a comment.
isn't modified after it's opened.

comment function: comment-dwim (M-;)
emacs args: emacs -Q




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16695; Package emacs. (Sat, 08 Feb 2014 20:10:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: eg5cue <at> gmail.com
Cc: 16695 <at> debbugs.gnu.org
Subject: Re: bug#16695: 24.3; comment-dwim (args out of range)
Date: Sat, 08 Feb 2014 22:09:38 +0200
> From: eg5cue <at> gmail.com
> Date: Sat, 08 Feb 2014 14:32:51 +0000
> 
> this is a longstanding bug since 24.3(i don't tried older versions) till now (the latest git version - github mirror), and is very annoying.
> it happens when trying to comment out (a line/multiple lines) except the first line from a C family file that:
> 
> it's first line isn't empty or a comment.
> isn't modified after it's opened.
> 
> comment function: comment-dwim (M-;)
> emacs args: emacs -Q

I cannot reproduce this.  Could you please provide a detailed, key by
key recipe, starting with "emacs -Q", and a sample C file to go with
it?

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#16695; Package emacs,cc-mode. (Sat, 08 Feb 2014 20:13:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: eg5cue <at> gmail.com
Cc: 16695 <at> debbugs.gnu.org
Subject: Re: bug#16695: 24.3; comment-dwim (args out of range)
Date: Sat, 08 Feb 2014 15:12:20 -0500
eg5cue <at> gmail.com wrote:

> this is a longstanding bug since 24.3(i don't tried older versions)
> till now (the latest git version - github mirror), and is very
> annoying. it happens when trying to comment out (a line/multiple
> lines) except the first line from a C family file that:
>
> it's first line isn't empty or a comment.
> isn't modified after it's opened.
>
> comment function: comment-dwim (M-;)
> emacs args: emacs -Q

Thanks. For future reference, please do

 M-x toggle-debug-on-error

and include the basktrace in the report:

Debugger entered--Lisp error: (args-out-of-range 1 2)
  remove-text-properties(#<marker at 1 in foo.c> 2 (category nil))
  c-invalidate-state-cache(17)
  c-before-change(17 17)
  comment-region-internal(17 45 "/* " " */" nil nil nil nil t)
  comment-region-default(16 46 nil)
  comment-region(16 46 nil)
  comment-or-uncomment-region(16 46 nil)
  comment-dwim(nil)
  call-interactively(comment-dwim nil nil)
  command-execute(comment-dwim)




Merged 15611 16695. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 08 Feb 2014 20:15:02 GMT) Full text and rfc822 format available.

Disconnected #15611 from all other report(s). Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 08 Feb 2014 20:16:02 GMT) Full text and rfc822 format available.

Merged 15881 16695. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 08 Feb 2014 20:16:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#16695; Package emacs,cc-mode. (Sat, 08 Feb 2014 22:55:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 16695 <at> debbugs.gnu.org, eg5cue <at> gmail.com
Subject: Re: bug#16695: 24.3; comment-dwim (args out of range)
Date: Sat, 8 Feb 2014 22:51:07 +0000
Hi, Glenn.

On Sat, Feb 08, 2014 at 03:12:20PM -0500, Glenn Morris wrote:
> eg5cue <at> gmail.com wrote:

> > this is a longstanding bug since 24.3(i don't tried older versions)
> > till now (the latest git version - github mirror), and is very
> > annoying. it happens when trying to comment out (a line/multiple
> > lines) except the first line from a C family file that:

> > it's first line isn't empty or a comment.
> > isn't modified after it's opened.

> > comment function: comment-dwim (M-;)
> > emacs args: emacs -Q

> Thanks. For future reference, please do

>  M-x toggle-debug-on-error

> and include the basktrace in the report:

> Debugger entered--Lisp error: (args-out-of-range 1 2)
>   remove-text-properties(#<marker at 1 in foo.c> 2 (category nil))
>   c-invalidate-state-cache(17)
>   c-before-change(17 17)
>   comment-region-internal(17 45 "/* " " */" nil nil nil nil t)
>   comment-region-default(16 46 nil)
>   comment-region(16 46 nil)
>   comment-or-uncomment-region(16 46 nil)
>   comment-dwim(nil)
>   call-interactively(comment-dwim nil nil)
>   command-execute(comment-dwim)

I think this is the same bug as #16585, which I've just posted a patch
for.  Here is the patch again.  After applying this patch, recompile
progmodes/cc-defs.el, then recompile progmodes/cc-engine.el.

To the Original Poster: please try this out, and confirm it fixes the
bug.  Thanks!


=== modified file 'lisp/progmodes/cc-defs.el'
*** lisp/progmodes/cc-defs.el	2014-02-02 10:25:29 +0000
--- lisp/progmodes/cc-defs.el	2014-02-08 22:21:01 +0000
***************
*** 1293,1302 ****
    ;; suppressed.
    `(unwind-protect
         (c-save-buffer-state ()
! 	 (c-clear-cpp-delimiters ,beg ,end)
  	 ,`(c-with-cpps-commented-out ,@forms))
       (c-save-buffer-state ()
!        (c-set-cpp-delimiters ,beg ,end))))
  
  (defsubst c-intersect-lists (list alist)
    ;; return the element of ALIST that matches the first element found
--- 1293,1306 ----
    ;; suppressed.
    `(unwind-protect
         (c-save-buffer-state ()
! 	 (save-restriction
! 	   (widen)
! 	   (c-clear-cpp-delimiters ,beg ,end))
  	 ,`(c-with-cpps-commented-out ,@forms))
       (c-save-buffer-state ()
!        (save-restriction
! 	 (widen)
! 	 (c-set-cpp-delimiters ,beg ,end)))))
  
  (defsubst c-intersect-lists (list alist)
    ;; return the element of ALIST that matches the first element found


-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#16695; Package emacs,cc-mode. (Sat, 08 Feb 2014 23:24:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 16695 <at> debbugs.gnu.org, eg5cue <at> gmail.com
Subject: Re: bug#16695: 24.3; comment-dwim (args out of range)
Date: Sat, 08 Feb 2014 18:23:05 -0500
Alan Mackenzie wrote:

> I think this is the same bug as #16585

I don't about that, but it is certainly the same as #15881.




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#16695; Package emacs,cc-mode. (Sun, 09 Feb 2014 10:34:02 GMT) Full text and rfc822 format available.

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

From: Arash Cue <eg5cue <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 16695 <at> debbugs.gnu.org
Subject: Re: bug#16695: 24.3; comment-dwim (args out of range)
Date: Sun, 9 Feb 2014 10:33:23 +0000
[Message part 1 (text/plain, inline)]
this patch fixed the problem for me. thanks


On Sat, Feb 8, 2014 at 10:51 PM, Alan Mackenzie <acm <at> muc.de> wrote:

> Hi, Glenn.
>
> On Sat, Feb 08, 2014 at 03:12:20PM -0500, Glenn Morris wrote:
> > eg5cue <at> gmail.com wrote:
>
> > > this is a longstanding bug since 24.3(i don't tried older versions)
> > > till now (the latest git version - github mirror), and is very
> > > annoying. it happens when trying to comment out (a line/multiple
> > > lines) except the first line from a C family file that:
>
> > > it's first line isn't empty or a comment.
> > > isn't modified after it's opened.
>
> > > comment function: comment-dwim (M-;)
> > > emacs args: emacs -Q
>
> > Thanks. For future reference, please do
>
> >  M-x toggle-debug-on-error
>
> > and include the basktrace in the report:
>
> > Debugger entered--Lisp error: (args-out-of-range 1 2)
> >   remove-text-properties(#<marker at 1 in foo.c> 2 (category nil))
> >   c-invalidate-state-cache(17)
> >   c-before-change(17 17)
> >   comment-region-internal(17 45 "/* " " */" nil nil nil nil t)
> >   comment-region-default(16 46 nil)
> >   comment-region(16 46 nil)
> >   comment-or-uncomment-region(16 46 nil)
> >   comment-dwim(nil)
> >   call-interactively(comment-dwim nil nil)
> >   command-execute(comment-dwim)
>
> I think this is the same bug as #16585, which I've just posted a patch
> for.  Here is the patch again.  After applying this patch, recompile
> progmodes/cc-defs.el, then recompile progmodes/cc-engine.el.
>
> To the Original Poster: please try this out, and confirm it fixes the
> bug.  Thanks!
>
>
> === modified file 'lisp/progmodes/cc-defs.el'
> *** lisp/progmodes/cc-defs.el   2014-02-02 10:25:29 +0000
> --- lisp/progmodes/cc-defs.el   2014-02-08 22:21:01 +0000
> ***************
> *** 1293,1302 ****
>     ;; suppressed.
>     `(unwind-protect
>          (c-save-buffer-state ()
> !        (c-clear-cpp-delimiters ,beg ,end)
>          ,`(c-with-cpps-commented-out ,@forms))
>        (c-save-buffer-state ()
> !        (c-set-cpp-delimiters ,beg ,end))))
>
>   (defsubst c-intersect-lists (list alist)
>     ;; return the element of ALIST that matches the first element found
> --- 1293,1306 ----
>     ;; suppressed.
>     `(unwind-protect
>          (c-save-buffer-state ()
> !        (save-restriction
> !          (widen)
> !          (c-clear-cpp-delimiters ,beg ,end))
>          ,`(c-with-cpps-commented-out ,@forms))
>        (c-save-buffer-state ()
> !        (save-restriction
> !        (widen)
> !        (c-set-cpp-delimiters ,beg ,end)))))
>
>   (defsubst c-intersect-lists (list alist)
>     ;; return the element of ALIST that matches the first element found
>
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
[Message part 2 (text/html, inline)]

Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Sun, 09 Feb 2014 12:45:02 GMT) Full text and rfc822 format available.

Notification sent to eg5cue <at> gmail.com:
bug acknowledged by developer. (Sun, 09 Feb 2014 12:45:03 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: 16695-done <at> debbugs.gnu.org
Subject: Re: bug#16695: 24.3; comment-dwim (args out of range)
Date: Sun, 9 Feb 2014 12:41:17 +0000
Bug fixed.

-- 
Alan Mackenzie (Nuremberg, Germany).




Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Sun, 09 Feb 2014 12:45:03 GMT) Full text and rfc822 format available.

Notification sent to n5k2la421i2u0eml <at> gmail.com:
bug acknowledged by developer. (Sun, 09 Feb 2014 12:45:04 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 24.4. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 10 Feb 2014 18:27:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 11 Mar 2014 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 99 days ago.

Previous Next


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