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#11749: Acknowledgement (24.1; C-mode indentation gives wrong-type-argument error.) Date: Mon, 7 Jan 2013 12:09:52 +0000 Message-ID: <20130107120951.GB3384@acm.acm> References: <20121010200025.GA3449@acm.acm> <20121014170650.GA3766@acm.acm> <20121028113610.GA3339@acm.acm> <20121104203912.GA3274@acm.acm> <20121121213340.GB4025@acm.acm> <87sj7elgtt.fsf@maru.md5i.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1357561792 18458 80.91.229.3 (7 Jan 2013 12:29:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Jan 2013 12:29:52 +0000 (UTC) Cc: "11749@debbugs.gnu.org" <11749@debbugs.gnu.org>, Michael Welsh Duggan , Kim Storm To: Michael Welsh Duggan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 07 13:30:07 2013 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 1TsBq5-0008Aw-Sg for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Jan 2013 13:30:02 +0100 Original-Received: from localhost ([::1]:36677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsBpq-0005A0-D3 for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Jan 2013 07:29:46 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsBph-00059j-Ty for bug-gnu-emacs@gnu.org; Mon, 07 Jan 2013 07:29:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsBpg-0006t4-87 for bug-gnu-emacs@gnu.org; Mon, 07 Jan 2013 07:29:37 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsBeR-0004P1-Cm; Mon, 07 Jan 2013 07:17:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TsBeU-0007Bw-Lz; Mon, 07 Jan 2013 07:18:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 07 Jan 2013 12:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11749 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 11749-submit@debbugs.gnu.org id=B11749.135756102327569 (code B ref 11749); Mon, 07 Jan 2013 12:18:02 +0000 Original-Received: (at 11749) by debbugs.gnu.org; 7 Jan 2013 12:17:03 +0000 Original-Received: from localhost ([127.0.0.1]:33794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TsBdW-0007Ab-Pu for submit@debbugs.gnu.org; Mon, 07 Jan 2013 07:17:03 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:25056 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TsBdH-00079u-4Y for 11749@debbugs.gnu.org; Mon, 07 Jan 2013 07:16:50 -0500 Original-Received: (qmail 20432 invoked by uid 3782); 7 Jan 2013 12:16:41 -0000 Original-Received: from acm.muc.de (pD955647F.dip.t-dialin.net [217.85.100.127]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 07 Jan 2013 13:16:40 +0100 Original-Received: (qmail 3547 invoked by uid 1000); 7 Jan 2013 12:09:52 -0000 Content-Disposition: inline In-Reply-To: <87sj7elgtt.fsf@maru.md5i.com> 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.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.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:69455 Archived-At: Happy New Year, Michael! On Sun, Dec 09, 2012 at 10:35:42PM -0500, Michael Welsh Duggan wrote: > Here's another case. > emacs -Q rwrec.h > M-x c-toggle-parse-state-debug > C-v {about 24-27 times} > This is with current bzr. > 111170 rgm@gnu.org-20121210020042-arkhaf5eej6ujgtn > rwrec.h is attached. Thanks. I think the following patch should have sorted out this one. It is based on the cc-engine.el in the emacs-24 branch in savannah. Could you try it out as usual, please. === modified file 'lisp/progmodes/cc-engine.el' *** lisp/progmodes/cc-engine.el 2012-12-11 19:06:57 +0000 --- lisp/progmodes/cc-engine.el 2013-01-06 21:52:00 +0000 *************** *** 2464,2471 **** --- 2464,2475 ---- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variables which keep track of preprocessor constructs. + (defvar c-state-old-cpp-beg-marker) + (make-variable-buffer-local 'c-state-old-cpp-beg-marker) (defvar c-state-old-cpp-beg nil) (make-variable-buffer-local 'c-state-old-cpp-beg) + (defvar c-state-old-cpp-end-marker) + (make-variable-buffer-local 'c-state-old-cpp-end-marker) (defvar c-state-old-cpp-end nil) (make-variable-buffer-local 'c-state-old-cpp-end) ;; These are the limits of the macro containing point at the previous call of *************** *** 2653,2665 **** ;; reduce the time wasted in repeated fruitless searches in brace deserts. (save-excursion (save-restriction ! (let ((bra from) ce ; Positions of "{" and "}". ! new-cons ! (cache-pos (c-state-cache-top-lparen)) ; might be nil. ! (macro-start-or-from ! (progn (goto-char from) ! (c-beginning-of-macro) ! (point)))) (or upper-lim (setq upper-lim from)) ;; If we're essentially repeating a fruitless search, just give up. --- 2657,2678 ---- ;; reduce the time wasted in repeated fruitless searches in brace deserts. (save-excursion (save-restriction ! ! (let* (new-cons ! (cache-pos (c-state-cache-top-lparen)) ; might be nil. ! (macro-start-or-from ! (progn (goto-char from) ! (c-beginning-of-macro) ! (point))) ! (bra ; Position of "{". ! ;; Don't start scanning in the middle of a CPP construct unless ! ;; it contains HERE - these constructs, in Emacs, are "commented ! ;; out" with category properties. ! (if (eq (c-get-char-property macro-start-or-from 'category) ! 'c-cpp-delimiter) ! macro-start-or-from ! from)) ! ce) ; Position of "}" (or upper-lim (setq upper-lim from)) ;; If we're essentially repeating a fruitless search, just give up. *************** *** 2899,2905 **** --- 2912,2920 ---- (point-max) (min (point-max) c-state-old-cpp-beg))) (while (and c-state-cache (>= (c-state-cache-top-lparen) upper-lim)) + (setq scan-back-pos (car-safe (car c-state-cache))) (setq c-state-cache (cdr c-state-cache))) + ;; If `upper-lim' is inside the last recorded brace pair, remove its ;; RBrace and indicate we'll need to search backwards for a previous ;; brace pair. *************** *** 3324,3329 **** --- 3339,3351 ---- (c-with-cpps-commented-out (c-invalidate-state-cache-1 here))))) + (defmacro c-state-maybe-marker (place marker) + ;; If PLACE is non-nil, return a marker marking it, otherwise nil. + ;; We (re)use MARKER. + `(and ,place + (or ,marker (setq ,marker (make-marker))) + (set-marker ,marker ,place))) + (defun c-parse-state () ;; This is a wrapper over `c-parse-state-1'. See that function for a ;; description of the functionality and return value. *************** *** 3350,3358 **** (c-parse-state-1)) (c-with-cpps-commented-out (c-parse-state-1)))) ! (setq c-state-old-cpp-beg (and here-cpp-beg (copy-marker here-cpp-beg t)) ! c-state-old-cpp-end (and here-cpp-end (copy-marker here-cpp-end t))) ! ))) ;; Debug tool to catch cache inconsistencies. This is called from ;; 000tests.el. --- 3372,3381 ---- (c-parse-state-1)) (c-with-cpps-commented-out (c-parse-state-1)))) ! (setq c-state-old-cpp-beg ! (c-state-maybe-marker here-cpp-beg c-state-old-cpp-beg-marker) ! c-state-old-cpp-end ! (c-state-maybe-marker here-cpp-end c-state-old-cpp-end-marker))))) ;; Debug tool to catch cache inconsistencies. This is called from ;; 000tests.el. > -- > Michael Welsh Duggan > (md5i@md5i.com) -- Alan Mackenzie (Nuremberg, Germany).