all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Glenn Morris <rgm@gnu.org>
Cc: 16695@debbugs.gnu.org, eg5cue@gmail.com
Subject: bug#16695: 24.3; comment-dwim (args out of range)
Date: Sat, 8 Feb 2014 22:51:07 +0000	[thread overview]
Message-ID: <20140208225107.GB4063__36117.3526304357$1391900142$gmane$org@acm.acm> (raw)
In-Reply-To: <e9ppmx1hzv.fsf@fencepost.gnu.org>

Hi, Glenn.

On Sat, Feb 08, 2014 at 03:12:20PM -0500, Glenn Morris wrote:
> eg5cue@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))))
  \f
  (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)))))
  \f
  (defsubst c-intersect-lists (list alist)
    ;; return the element of ALIST that matches the first element found


-- 
Alan Mackenzie (Nuremberg, Germany).





  reply	other threads:[~2014-02-08 22:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08 14:32 bug#16695: 24.3; comment-dwim (args out of range) eg5cue
2014-02-08 20:09 ` Eli Zaretskii
2014-02-08 20:12 ` Glenn Morris
2014-02-08 22:51   ` Alan Mackenzie [this message]
     [not found]   ` <20140208225107.GB4063@acm.acm>
2014-02-08 23:23     ` Glenn Morris
     [not found]     ` <CAAFMBVaGpoZrKgPm-tALx47+XNN8W8sezKyEz9EYwAOz-bG+GA@mail.gmail.com>
2014-02-09 10:33       ` Arash Cue
2014-02-09 12:41 ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20140208225107.GB4063__36117.3526304357$1391900142$gmane$org@acm.acm' \
    --to=acm@muc.de \
    --cc=16695@debbugs.gnu.org \
    --cc=eg5cue@gmail.com \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.