From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Arash Cue Newsgroups: gmane.emacs.bugs Subject: bug#16695: 24.3; comment-dwim (args out of range) Date: Sun, 9 Feb 2014 10:33:23 +0000 Message-ID: References: <84sirtd698.fsf@gmail.com> <20140208225107.GB4063@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c11d12aaa04504f1f6c0c3 X-Trace: ger.gmane.org 1391942055 25790 80.91.229.3 (9 Feb 2014 10:34:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Feb 2014 10:34:15 +0000 (UTC) Cc: 16695@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 09 11:34:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WCRiO-00056x-SH for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Feb 2014 11:34:21 +0100 Original-Received: from localhost ([::1]:50197 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCRiO-0002v2-EF for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Feb 2014 05:34:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCRiH-0002ut-JO for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 05:34:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCRiC-0001jO-Rz for bug-gnu-emacs@gnu.org; Sun, 09 Feb 2014 05:34:13 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCRi7-0001ir-LI; Sun, 09 Feb 2014 05:34:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WCRi6-0007HO-MM; Sun, 09 Feb 2014 05:34:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Arash Cue Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 09 Feb 2014 10:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16695 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 16695-submit@debbugs.gnu.org id=B16695.139194200927932 (code B ref 16695); Sun, 09 Feb 2014 10:34:02 +0000 Original-Received: (at 16695) by debbugs.gnu.org; 9 Feb 2014 10:33:29 +0000 Original-Received: from localhost ([127.0.0.1]:59304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCRhY-0007GQ-Cm for submit@debbugs.gnu.org; Sun, 09 Feb 2014 05:33:29 -0500 Original-Received: from mail-qa0-f53.google.com ([209.85.216.53]:63329) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCRhU-0007GC-24 for 16695@debbugs.gnu.org; Sun, 09 Feb 2014 05:33:25 -0500 Original-Received: by mail-qa0-f53.google.com with SMTP id cm18so7886754qab.40 for <16695@debbugs.gnu.org>; Sun, 09 Feb 2014 02:33:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ST6Y8utqyjQ0IZ8dqv2DmUpzBm7ecg6S0xwXJio5U2I=; b=TbmCLvwRJk3paTPJMUqq+SjIHNhozOGdSp1I/81ziIx+f161re/WquVoZl9qZMlGAK f0b0plFWIE9ObjnIxrp705iq/B51Ua8b9XCbcAopd69SsD9QJQyLQLVCJq7Kz7nxmt8S mr+hAkTFNGtybto0v3uebzIZWgx+7ftKO814KaReRI4nLlrXSCH2OUoSaaC/yoKHc8mh Jrgm2TDFUyFmwc6Ego2Y6BVpRu8ejp0gKhqIbPEd9y1N6mIZ1w6UrYQAErfguFgH0iFy l03DagEVNBFEltGYWW2GgJER75tx8Xtnp8j3KGVIA7uRQfs+nzbZc4QlN9iDp17VGBbT RSSQ== X-Received: by 10.140.81.74 with SMTP id e68mr35463920qgd.99.1391942003490; Sun, 09 Feb 2014 02:33:23 -0800 (PST) Original-Received: by 10.96.69.136 with HTTP; Sun, 9 Feb 2014 02:33:23 -0800 (PST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:85081 Archived-At: --001a11c11d12aaa04504f1f6c0c3 Content-Type: text/plain; charset=ISO-8859-1 this patch fixed the problem for me. thanks On Sat, Feb 8, 2014 at 10:51 PM, Alan Mackenzie wrote: > 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(# 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). > --001a11c11d12aaa04504f1f6c0c3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
this patch fixed the problem for me. thanks


On Sat, Feb 8, 2014 at 10:51 PM,= Alan Mackenzie <acm@muc.de> wrote:
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 ver= sions)
> > till now (the latest git version - github mirror), and is very > > annoying. it happens when trying to comment out (a line/multiple<= br> > > 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

> =A0M-x toggle-debug-on-error

> and include the basktrace in the report:

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

I think this is the same bug as #16585, which I've just pos= ted a patch
for. =A0Here is the patch again. =A0After 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. =A0Thanks!


=3D=3D=3D modified file 'lisp/progmodes/cc-defs.el'
*** lisp/progmodes/cc-defs.el =A0 2014-02-02 10:25:29 +0000
--- lisp/progmodes/cc-defs.el =A0 2014-02-08 22:21:01 +0000
***************
*** 1293,1302 ****
=A0 =A0 ;; suppressed.
=A0 =A0 `(unwind-protect
=A0 =A0 =A0 =A0 =A0(c-save-buffer-state ()
! =A0 =A0 =A0 =A0(c-clear-cpp-delimiters ,beg ,end)
=A0 =A0 =A0 =A0 =A0,`(c-with-cpps-commented-out ,@forms))
=A0 =A0 =A0 =A0(c-save-buffer-state ()
! =A0 =A0 =A0 =A0(c-set-cpp-delimiters ,beg ,end))))

=A0 (defsubst c-intersect-lists (list alist)
=A0 =A0 ;; return the element of ALIST that matches the first element found=
--- 1293,1306 ----
=A0 =A0 ;; suppressed.
=A0 =A0 `(unwind-protect
=A0 =A0 =A0 =A0 =A0(c-save-buffer-state ()
! =A0 =A0 =A0 =A0(save-restriction
! =A0 =A0 =A0 =A0 =A0(widen)
! =A0 =A0 =A0 =A0 =A0(c-clear-cpp-delimiters ,beg ,end))
=A0 =A0 =A0 =A0 =A0,`(c-with-cpps-commented-out ,@forms))
=A0 =A0 =A0 =A0(c-save-buffer-state ()
! =A0 =A0 =A0 =A0(save-restriction
! =A0 =A0 =A0 =A0(widen)
! =A0 =A0 =A0 =A0(c-set-cpp-delimiters ,beg ,end)))))

=A0 (defsubst c-intersect-lists (list alist)
=A0 =A0 ;; return the element of ALIST that matches the first element found=


--
Alan Mackenzie (Nuremberg, Germany).

--001a11c11d12aaa04504f1f6c0c3--