From: Alan Mackenzie <acm@muc.de>
To: Michael Welsh Duggan <mwd@md5i.com>
Cc: "11749@debbugs.gnu.org" <11749@debbugs.gnu.org>,
Michael Welsh Duggan <mwd@cert.org>, Kim Storm <storm@cua.dk>
Subject: bug#11749: Acknowledgement (24.1; C-mode indentation gives wrong-type-argument error.)
Date: Mon, 7 Jan 2013 12:09:52 +0000 [thread overview]
Message-ID: <20130107120951.GB3384@acm.acm> (raw)
In-Reply-To: <87sj7elgtt.fsf@maru.md5i.com>
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).
next prev parent reply other threads:[~2013-01-07 12:09 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 20:45 bug#11749: 24.1; C-mode indentation gives wrong-type-argument error Kim F. Storm
2012-06-21 7:17 ` Glenn Morris
2012-06-21 9:34 ` Kim Storm
2012-08-28 16:17 ` bug#11749: 24.2; wrong-type-argument Kim F. Storm
[not found] ` <handler.11749.B.13401389485673.ack@debbugs.gnu.org>
2012-08-28 22:49 ` bug#11749: Acknowledgement (24.1; C-mode indentation gives wrong-type-argument error.) Kim Storm
2012-08-31 11:01 ` Eli Zaretskii
2012-08-31 12:37 ` Kim Storm
2012-09-02 21:16 ` Alan Mackenzie
2012-09-03 9:47 ` Kim Storm
2012-09-03 13:56 ` Stefan Monnier
2012-09-03 14:20 ` Kim Storm
2012-09-03 18:52 ` Stefan Monnier
2012-09-05 20:48 ` Alan Mackenzie
2012-09-07 3:45 ` Michael Welsh Duggan
2012-09-07 14:53 ` Stefan Monnier
2012-09-07 16:16 ` Kim Storm
2012-09-08 21:14 ` Alan Mackenzie
2012-09-10 12:18 ` Michael Welsh Duggan
2012-09-10 12:48 ` Michael Welsh Duggan
2012-09-21 17:47 ` Michael Welsh Duggan
2012-10-07 10:59 ` Alan Mackenzie
2012-10-09 14:05 ` Michael Welsh Duggan
2012-10-10 20:00 ` Alan Mackenzie
2012-10-14 17:06 ` Alan Mackenzie
2012-10-23 16:13 ` Michael Welsh Duggan
2012-10-25 13:41 ` Michael Welsh Duggan
2012-10-28 11:36 ` Alan Mackenzie
2012-11-04 3:43 ` Chong Yidong
2012-11-04 20:42 ` Alan Mackenzie
2012-11-21 20:58 ` Alan Mackenzie
2012-11-22 14:52 ` Stefan Monnier
2012-11-04 20:39 ` Alan Mackenzie
2012-11-04 21:04 ` Kim Storm
2012-11-14 16:52 ` Michael Welsh Duggan
2012-11-21 21:33 ` Alan Mackenzie
2012-11-26 13:25 ` Michael Welsh Duggan
2012-12-10 3:35 ` Michael Welsh Duggan
2013-01-07 12:09 ` Alan Mackenzie [this message]
2013-01-17 16:27 ` Michael Welsh Duggan
2013-01-17 16:28 ` Michael Welsh Duggan
2013-01-23 14:16 ` Alan Mackenzie
2013-01-23 15:39 ` Michael Welsh Duggan
2013-01-29 11:37 ` Alan Mackenzie
[not found] ` <20130129113737.GA4544@acm.acm>
2013-02-01 22:18 ` Michael Welsh Duggan
2013-02-01 23:50 ` Kim Storm
2013-02-02 19:35 ` Alan Mackenzie
2012-09-10 13:10 ` Michael Welsh Duggan
2012-09-10 13:22 ` Michael Welsh Duggan
2012-09-10 18:25 ` Michael Welsh Duggan
2012-09-05 13:11 ` bug#11749: I also have this issue Denis Zalevskiy
2013-01-08 19:10 ` bug#11749: Acknowledgement (24.1; C-mode indentation gives wrong-type-argument error.) Glenn Morris
2013-01-09 22:13 ` Alan Mackenzie
2013-02-02 18:37 ` bug#11749: 24.1; C-mode indentation gives wrong-type-argument error Alan Mackenzie
2013-01-08 13:49 ` bug#13385: 24.1; TAB in C file causes type error Julian Stecklina
[not found] ` <handler.13385.D11749.1359830688892.notifdone@debbugs.gnu.org>
2013-02-03 13:00 ` bug#13385: closed (Re: 24.1; C-mode indentation gives wrong-type-argument error.) Julian Stecklina
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130107120951.GB3384@acm.acm \
--to=acm@muc.de \
--cc=11749@debbugs.gnu.org \
--cc=mwd@cert.org \
--cc=mwd@md5i.com \
--cc=storm@cua.dk \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).