From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#16695: 24.3; comment-dwim (args out of range) Date: Sat, 8 Feb 2014 22:51:07 +0000 Message-ID: <20140208225107.GB4063__36117.3526304357$1391900142$gmane$org@acm.acm> References: <84sirtd698.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1391900129 8151 80.91.229.3 (8 Feb 2014 22:55:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 8 Feb 2014 22:55:29 +0000 (UTC) Cc: 16695@debbugs.gnu.org, eg5cue@gmail.com To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 08 23:55:35 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 1WCGoA-0005Aa-CC for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Feb 2014 23:55:34 +0100 Original-Received: from localhost ([::1]:48279 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCGo9-0004Zv-RU for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Feb 2014 17:55:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCGnu-0004ZK-DI for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2014 17:55:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCGnn-0002MN-36 for bug-gnu-emacs@gnu.org; Sat, 08 Feb 2014 17:55:18 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCGnf-0002C0-0u; Sat, 08 Feb 2014 17:55:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WCGne-0008Mv-J2; Sat, 08 Feb 2014 17:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sat, 08 Feb 2014 22:55: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.139190007232125 (code B ref 16695); Sat, 08 Feb 2014 22:55:02 +0000 Original-Received: (at 16695) by debbugs.gnu.org; 8 Feb 2014 22:54:32 +0000 Original-Received: from localhost ([127.0.0.1]:58321 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCGnA-0008M5-4c for submit@debbugs.gnu.org; Sat, 08 Feb 2014 17:54:32 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:54476 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WCGn6-0008Lv-Vy for 16695@debbugs.gnu.org; Sat, 08 Feb 2014 17:54:30 -0500 Original-Received: (qmail 73274 invoked by uid 3782); 8 Feb 2014 22:54:27 -0000 Original-Received: from acm.muc.de (pD951823D.dip0.t-ipconnect.de [217.81.130.61]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 08 Feb 2014 23:54:26 +0100 Original-Received: (qmail 5152 invoked by uid 1000); 8 Feb 2014 22:51:07 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:84995 Archived-At: 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).