From unknown Fri Jun 20 07:22:22 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#5209: 23.1.90; CC Mode version 5.31.8 does not indent properly when writing new C files Reply-To: Steve Revilak , 5209@debbugs.gnu.org Resent-From: Steve Revilak Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Sun, 13 Dec 2009 16:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: report 5209 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.126072134011976 (code B ref -1); Sun, 13 Dec 2009 16:30:03 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 13 Dec 2009 16:22:20 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.1 required=4.0 tests=AWL,FOURLA,PGPSIGNATURE autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nBDGMJ3p011973 for ; Sun, 13 Dec 2009 08:22:20 -0800 Received: from mx10.gnu.org ([199.232.76.166]:55529) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NJrD8-00065t-IJ for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 11:22:18 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NJrD5-0001kH-CE for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 11:22:18 -0500 Received: from mail6.sea5.speakeasy.net ([69.17.117.8]:47000) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NJrD4-0001jl-KP for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 11:22:15 -0500 Received: (qmail 6822 invoked from network); 13 Dec 2009 16:22:12 -0000 Received: from pool-96-233-67-219.bstnma.fios.verizon.net (HELO srevilak.net) (srevilak@[96.233.67.219]) (envelope-sender ) by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 13 Dec 2009 16:22:12 -0000 Date: Sun, 13 Dec 2009 11:22:10 -0500 From: Steve Revilak To: emacs-pretest-bug@gnu.org Message-ID: <20091213162210.GC376@srevilak.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QRj9sO5tAVLaXnSD" Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) --QRj9sO5tAVLaXnSD Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing lis= t. Please describe exactly what actions triggered the bug and the precise symptoms of the bug. If you can, give a recipe starting from `emacs -Q': * * * STEPS TO REPRODUCE ------------------ (1) Start emacs with the command line "emacs -nw -Q foo.c". foo.c should be a new file, which does not exist prior to starting emacs. (2) Type "#include " and RETURN (3) Type RETURN to leave a blank line (4) type "static void add_one(int * x) {" and RETURN (5) type "*x +=3D 1;" and RETURN (6) type "}" and RETURN (to close the function definition) NOTE: the statement written in step (5) is left-aligned to column zero. The statement should be indented. (7) Place point in column zero of the line "*x +=3D 1;". Press TAB. Before pressing TAB, "*x +=3D 1;" is aligned to column zero. After pressing TAB, "*x +=3D 1;" is still aligned to column zero. TAB did not indent the statement. (8) Type "C-x h TAB" (i.e., to select and re-indent the entire buffer). The minibuffer displays "Indenting region... done". However, the statement "*x +=3D 1;" is still aligned to column zero. After step 8, buffer "foo.c" looks like this: --------------------------------- #include static void add_one(int * x) { *x +=3D 1; } --------------------------------- NOTE: the fourth line is not indented (but it should be). NOTES: ----- In buffer "foo.c", "M-x describe-key RET TAB" produces: --------------------------------- TAB runs the command c-indent-line-or-region, which is an interactive compiled Lisp function in `cc-cmds.el'. It is bound to TAB, . (c-indent-line-or-region &optional ARG REGION) Indent active region, current line, or block starting on this line. In Transient Mark mode, when the region is active, reindent the region. Otherwise, with a prefix argument, rigidly reindent the expression starting on the current line. Otherwise reindent just the current line. --------------------------------- NOTE: In step (8), when the entire buffer was selected, with transient mark mode enabled, TAB did not re-indent the region correctly. Likewise, in step (7) TAB did not re-indent the current line ("Otherwise reindent just the current line").=20 In buffer "foo.c", "M-x desribe-mode" produces: --------------------------------- Enabled minor modes: Abbrev Auto-Composition Auto-Compression Auto-Encryption File-Name-Shadow Font-Lock Global-Auto-Composition Global-Font-Lock Line-Number Menu-Bar Mouse-Wheel Tool-Bar Tooltip Transient-Mark (Information about these minor modes follows the major mode info.) C/l mode: Major mode for editing K&R and ANSI C code. To submit a problem report, enter `C-c C-b' from a c-mode buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. To see what version of CC Mode you are running, enter `M-x c-version'. The hook `c-mode-common-hook' is run with no args at mode initialization, then `c-mode-hook'. [rest of describe-mode output omitted] --------------------------------- M-x c-version produces the following: --------------------------------- Using CC Mode version 5.31.8 --------------------------------- Finally, the same behavior occurs when emacs is started as "emacs -Q" (i.e., if the -nw option is ommitted from the command line). * * * If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. For information about debugging Emacs, please read the file /Applications/Emacs.app/Contents/Resources/etc/DEBUG. In GNU Emacs 23.1.90.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54) of 2009-12-09 on oatmeal.ma.runwaynine.com Windowing system distributor `Apple', version 10.3.949 configured using `configure '--with-ns'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: C value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil value of $XMODIFIERS: nil locale-coding-system: nil default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: ESC x r e p o r t - e m a c s - b u TAB RET Recent messages: ("/Applications/Emacs.app/Contents/MacOS/Emacs") For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash mail-utils warnings emacsbug sendmail regexp-opt tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process ns multi-tty emacs) --QRj9sO5tAVLaXnSD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (Darwin) iEYEARECAAYFAkslFLIACgkQX7YJI4BuyDRYuwCdFWwPqTQnO7mxiHmZ+WhJ2DnR oQUAoIOYoYnbQJISh+eDcefSXiNucEBw =q6xz -----END PGP SIGNATURE----- --QRj9sO5tAVLaXnSD-- From unknown Fri Jun 20 07:22:22 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#5209: 23.1.90; CC Mode version 5.31.8 does not indent properly when writing new C files Reply-To: Alan Mackenzie , 5209@debbugs.gnu.org Resent-From: Alan Mackenzie Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Sun, 13 Dec 2009 20:35:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: followup 5209 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12607360625820 (code B ref -1); Sun, 13 Dec 2009 20:35:04 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 13 Dec 2009 20:27:42 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.9 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nBDKRe8A005813 for ; Sun, 13 Dec 2009 12:27:41 -0800 Received: from mail.gnu.org ([199.232.76.166]:35716 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NJv2Y-0001Cw-Ue for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 15:27:39 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NJv2V-0005e9-Vd for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 15:27:38 -0500 Received: from colin.muc.de ([193.149.48.1]:4019 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NJv2V-0005dv-CY for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 15:27:35 -0500 Received: (qmail 46322 invoked by uid 3782); 13 Dec 2009 20:27:31 -0000 Received: from acm.muc.de (pD9E53AA3.dip.t-dialin.net [217.229.58.163]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 13 Dec 2009 21:27:29 +0100 Received: (qmail 7900 invoked by uid 1000); 13 Dec 2009 20:33:11 -0000 Date: Sun, 13 Dec 2009 20:33:11 +0000 To: Steve Revilak , 5209@debbugs.gnu.org Cc: emacs-pretest-bug@gnu.org Message-ID: <20091213203311.GB3389@muc.de> References: <20091213162210.GC376@srevilak.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091213162210.GC376@srevilak.net> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 Hi, Steve, On Sun, Dec 13, 2009 at 11:22:10AM -0500, Steve Revilak wrote: > STEPS TO REPRODUCE > ------------------ > (1) Start emacs with the command line "emacs -nw -Q foo.c". > foo.c should be a new file, which does not exist prior to starting > emacs. > (2) Type "#include " and RETURN > (3) Type RETURN to leave a blank line > (4) type "static void add_one(int * x) {" and RETURN > (5) type "*x += 1;" and RETURN > (6) type "}" and RETURN (to close the function definition) > NOTE: the statement written in step (5) is left-aligned to column > zero. The statement should be indented. > (7) Place point in column zero of the line "*x += 1;". Press TAB. > Before pressing TAB, "*x += 1;" is aligned to column zero. After > pressing TAB, "*x += 1;" is still aligned to column zero. TAB did > not indent the statement. > (8) Type "C-x h TAB" (i.e., to select and re-indent the entire > buffer). > The minibuffer displays "Indenting region... done". However, the > statement "*x += 1;" is still aligned to column zero. > After step 8, buffer "foo.c" looks like this: > --------------------------------- > #include > static void add_one(int * x) { > *x += 1; > } > --------------------------------- > NOTE: the fourth line is not indented (but it should be). First thing, thanks for such a simple and clear bug report. There is a bug in `c-parse-state', one of the low-level functions in CC mode, which generates and changes a cache of brace and paren positions. Would you apply the following patch, and test it, please. If anything is still wrong, please let me know again. *** cc-engine.orig.el 2009-12-13 19:43:27.268817800 +0000 --- cc-engine.el 2009-12-13 20:06:47.819901672 +0000 *************** *** 2231,2236 **** --- 2231,2249 ---- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Defuns which analyse the buffer, yet don't change `c-state-cache'. + (defun c-p1-not-in-p0-macro (p0 p1) + ;; Is P0 in a CPP construct and p1 not in it? + (save-restriction + (widen) + (save-excursion + (let ((p0-macro-begin + (progn (goto-char p0) (and (c-beginning-of-macro) (point))))) + (and p0-macro-begin + (not + (eq p0-macro-begin + (progn (goto-char p1) (and (c-beginning-of-macro) (point))))) + ))))) + (defun c-get-fallback-scan-pos (here) ;; Return a start position for building `c-state-cache' from ;; scratch. This will be at the top level, 2 defuns back. *************** *** 2587,2593 **** ;; o - SCAN-BACK-POS, if not nil, indicates there may be a brace pair ;; preceding POS which needs to be recorded in `c-state-cache'. It is a ;; position to scan backwards from. ! ;; o - PPS-STATE is the parse-partial-sexp state at PPS-POINT. (save-restriction (narrow-to-region 1 (point-max)) (save-excursion --- 2600,2607 ---- ;; o - SCAN-BACK-POS, if not nil, indicates there may be a brace pair ;; preceding POS which needs to be recorded in `c-state-cache'. It is a ;; position to scan backwards from. ! ;; o - PPS-STATE is the parse-partial-sexp state at PPS-POINT or nil if we ! ;; don't scan past PPS-POINT. (save-restriction (narrow-to-region 1 (point-max)) (save-excursion *************** *** 2624,2630 **** (< (point-max) c-state-old-cpp-end))) (point-max) (min (point-max) c-state-old-cpp-beg))) ! (while (and c-state-cache (> (c-state-cache-top-lparen) upper-lim)) (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 --- 2638,2645 ---- (< (point-max) c-state-old-cpp-end))) (point-max) (min (point-max) c-state-old-cpp-beg))) ! (while (and c-state-cache ! (>= (c-state-cache-top-lparen) upper-lim)) (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 *************** *** 2641,2647 **** ;; (car c-state-cache). There can be no open parens/braces/brackets ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max), ;; due to the interface spec to this function. ! (setq pos (if good-pos-actual-macro-end (1+ good-pos-actual-macro-end) ; get outside the macro as ; marked by a `category' text property. good-pos)) --- 2656,2663 ---- ;; (car c-state-cache). There can be no open parens/braces/brackets ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max), ;; due to the interface spec to this function. ! (setq pos (if (and good-pos-actual-macro-start ! (not (eq good-pos-actual-macro-start in-macro-start))) (1+ good-pos-actual-macro-end) ; get outside the macro as ; marked by a `category' text property. good-pos)) *************** *** 2701,2707 **** (setq c-state-cache (cons (cons pair-beg pos) c-state-cache))) ! (list pos scan-back-pos pps-state))))) (defun c-remove-stale-state-cache-backwards (here cache-pos) ;; Strip stale elements of `c-state-cache' by moving backwards through the --- 2717,2723 ---- (setq c-state-cache (cons (cons pair-beg pos) c-state-cache))) ! (list pos scan-back-pos pps-point-state))))) (defun c-remove-stale-state-cache-backwards (here cache-pos) ;; Strip stale elements of `c-state-cache' by moving backwards through the *************** *** 2769,2777 **** (list (1+ pos) pos t)) ; return value. We've just converted a brace ; pair entry into a { entry, so the caller ; needs to search for a brace pair before the ! ; {. ! ;; ;; `here' might be inside a literal. Check for this. (setq lit (c-state-literal-at here) here-lit-start (or (car lit) here) here-lit-end (or (cdr lit) here)) --- 2785,2793 ---- (list (1+ pos) pos t)) ; return value. We've just converted a brace ; pair entry into a { entry, so the caller ; needs to search for a brace pair before the ! ; {, hence the `pos' in second last place. ! ;; `here' might be inside a literal. Check for this. (setq lit (c-state-literal-at here) here-lit-start (or (car lit) here) here-lit-end (or (cdr lit) here)) *************** *** 2801,2812 **** (setq pos pa)))) ; might signal (if (setq ren (c-safe-scan-lists pos -1 -1 too-far-back)) ;; CASE 3: After a }/)/] before `here''s BOL. ! (list (1+ ren) (and dropped-cons pos) nil) ; Return value ;; CASE 4; Best of a bad job: BOL before `here-bol', or beginning of ;; literal containing it. (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol))) ! (list good-pos (and dropped-cons good-pos) nil)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; --- 2817,2836 ---- (setq pos pa)))) ; might signal (if (setq ren (c-safe-scan-lists pos -1 -1 too-far-back)) ;; CASE 3: After a }/)/] before `here''s BOL. ! (list (1+ ren) ! (or (and (c-p1-not-in-p0-macro here c-state-cache-good-pos) ! here) ! (and dropped-cons pos)) ! nil) ; Return value ;; CASE 4; Best of a bad job: BOL before `here-bol', or beginning of ;; literal containing it. (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol))) ! (list good-pos ! (or (and (c-p1-not-in-p0-macro here c-state-cache-good-pos) ! here) ! (and dropped-cons good-pos)) ! nil)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -- Alan Mackenzie (Nuremberg, Germany). From unknown Fri Jun 20 07:22:22 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#5209: 23.1.90; CC Mode version 5.31.8 does not indent properly when writing new C files Reply-To: Steve Revilak , 5209@debbugs.gnu.org Resent-From: Steve Revilak Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Mon, 14 Dec 2009 01:25:29 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: followup 5209 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12607535472772 (code B ref -1); Mon, 14 Dec 2009 01:25:29 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 14 Dec 2009 01:19:07 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-5.9 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,PGPSIGNATURE autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nBE1J3Nm002768 for ; Sun, 13 Dec 2009 17:19:04 -0800 Received: from mx10.gnu.org ([199.232.76.166]:42815) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NJzaW-0000FG-N9 for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 20:19:00 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NJzaV-0004TT-7y for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 20:19:00 -0500 Received: from mail1.sea5.speakeasy.net ([69.17.117.3]:50653) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NJzaU-0004TL-QB for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 20:18:59 -0500 Received: (qmail 13364 invoked from network); 14 Dec 2009 01:18:56 -0000 Received: from pool-96-233-67-219.bstnma.fios.verizon.net (HELO srevilak.net) (srevilak@[96.233.67.219]) (envelope-sender ) by mail1.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 14 Dec 2009 01:18:56 -0000 Date: Sun, 13 Dec 2009 20:17:58 -0500 From: Steve Revilak To: Alan Mackenzie Cc: 5209@debbugs.gnu.org, emacs-pretest-bug@gnu.org Message-ID: <20091214011758.GB1046@srevilak.net> References: <20091213162210.GC376@srevilak.net> <20091213203311.GB3389@muc.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4bRzO86E/ozDv8r1" Content-Disposition: inline In-Reply-To: <20091213203311.GB3389@muc.de> User-Agent: Mutt/1.5.19 (2009-01-05) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) --4bRzO86E/ozDv8r1 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable >First thing, thanks for such a simple and clear bug report. > >There is a bug in `c-parse-state', one of the low-level functions in CC >mode, which generates and changes a cache of brace and paren positions. > >Would you apply the following patch, and test it, please. If anything is >still wrong, please let me know again. Alan, Glad to help, and thank you for the patch. I applied the patch to lisp/progmodes/cc-engine.el. Afterwards, I rebuilt emacs with=20 make clean make bootstrap make install (perhaps more rebuilding than necessary, but I wanted to make sure that I was getting a consistent build to test with) After rebuilding, I repeated my earlier "Steps to Reproduce", and saw exactly the same behavior that I reported in bug 5209 -- the patch did not correct the indentation issue. Sorry for the bad news :( Steve --4bRzO86E/ozDv8r1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (Darwin) iEYEARECAAYFAkslkkUACgkQX7YJI4BuyDTP2QCeJ0ZTZOAH/Id+mhG54EOf65DW iJIAnjit3rLlhFAU09FO3kRrhKXAQZzN =M8ol -----END PGP SIGNATURE----- --4bRzO86E/ozDv8r1-- From rgm@gnu.org Mon Dec 14 09:17:34 2009 Received: (at control) by emacsbugs.donarmstrong.com; 14 Dec 2009 17:17:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-5.1 required=4.0 tests=AWL,ONEWORD,VALID_BTS_CONTROL, X_DEBBUGS_NO_ACK autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nBEHHXId010621 for ; Mon, 14 Dec 2009 09:17:34 -0800 Received: from rgm by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1NKEY7-00009e-Fs; Mon, 14 Dec 2009 12:17:31 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19238.29483.461258.852673@fencepost.gnu.org> Date: Mon, 14 Dec 2009 12:17:31 -0500 From: Glenn Morris To: control Subject: control X-Attribution: GM X-Mailer: VM (www.wonderworks.com/vm), GNU Emacs (www.gnu.org/software/emacs) X-Hue: magenta X-Ran: I2fFS!SyB2u;cv-Rg)rxb"GY98Ip/4@pJWIdJBb[f,H=dr8.^!63KQP*#G2$7{[2mAvc*P X-Debbugs-No-Ack: yes tags 5190 moreinfo unreproducible tags 5189 moreinfo unreproducible reassign 5199 spam reassign 5200 spam reassign 5201 spam reassign 5203 spam reassign 5205 spam reassign 5206 emacs,ns reassign 5207 spam reassign 5209 emacs,cc-mode reassign 5210 spam reassign 5212 spam From unknown Fri Jun 20 07:22:22 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: bug-gnu-emacs@gnu.org From: bug-gnu-emacs@gnu.org (Emacs bug Tracking System) To: Steve Revilak Subject: bug#5209 closed by Steve Revilak (Re: CC Mode version 5.31.8 does not indent properly when writing new C files) Message-ID: References: <20091231193902.GB24581@srevilak.net> <20091213162210.GC376@srevilak.net> X-Emacs-PR-Message: they-closed 5209 X-Emacs-PR-Package: emacs,cc-mode Reply-To: 5209@debbugs.gnu.org Date: Fri, 01 Jan 2010 00:50:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1262307003-17489-1" This is a multi-part message in MIME format... ------------=_1262307003-17489-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is an automatic notification regarding your bug report which was filed against the emacs,cc-mode package: #5209: 23.1.90; CC Mode version 5.31.8 does not indent properly when writin= g new C files It has been closed by Steve Revilak . Their explanation is attached below along with your original report. If this explanation is unsatisfactory and you have not received a better one in a separate message then please contact Steve Revilak by replying to this email. --=20 5209: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D5209 Emacs Bug Tracking System Contact bug-gnu-emacs@gnu.org with problems ------------=_1262307003-17489-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 5209-done) by debbugs.gnu.org; 1 Jan 2010 00:49:10 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NQVhG-0004Wy-O9 for submit@debbugs.gnu.org; Thu, 31 Dec 2009 19:49:10 -0500 Received: from mail6.sea5.speakeasy.net ([69.17.117.8]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NQQrX-0001Jf-Oq for 5209-done@debbugs.gnu.org; Thu, 31 Dec 2009 14:39:12 -0500 Received: (qmail 9594 invoked from network); 31 Dec 2009 19:39:05 -0000 Received: from pool-96-233-67-125.bstnma.fios.verizon.net (HELO srevilak.net) (srevilak@[96.233.67.125]) (envelope-sender ) by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for <5209-done@debbugs.gnu.org>; 31 Dec 2009 19:39:05 -0000 Date: Thu, 31 Dec 2009 14:39:02 -0500 From: Steve Revilak To: 5209-done@debbugs.gnu.org Subject: Re: CC Mode version 5.31.8 does not indent properly when writing new C files Message-ID: <20091231193902.GB24581@srevilak.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bn2rw/3z4jIqBvZU" Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Spam-Score: 2.0 (++) X-Debbugs-Envelope-To: 5209-done X-Mailman-Approved-At: Thu, 31 Dec 2009 19:48:31 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.7 (/) --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I've tried this test case with=20 GNU Emacs 23.1.91.1 (powerpc-apple-darwin8.11.0, NS apple-appkit-824.48)= of 2009-12-31 on spud GNU Emacs 23.1.91.1 (x86_64-apple-darwin10.2.0, NS apple-appkit-1038.25)= of 2009-12-31 on oatmeal GNU Emacs 23.1.91.1 (i686-pc-linux-gnu, GTK+ Version 2.18.1) of 2009-12-= 31 on srevilak The indentation problem no longer occurs with Emacs 23.1.91.1. Relative to the original "Steps to Reproduce",=20 * In step (5), typing the final semicolon causes the line "*x +=3D 1;" to be indented properly * If I delete leading whitespace from "*x +=3D 1;" and perform step (7), then pressing TAB correctly indents the line. * If I delete leading whitespace from "*x +=3D 1;" and perform step (8), then I find C-x h ESC C-\ correctly re-indents the entire buffer. Nice work! Steve --Bn2rw/3z4jIqBvZU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (Darwin) iEYEARECAAYFAks8/dYACgkQX7YJI4BuyDSnTACgsA+ZxaAzoaSp0xWcVV2P7/hn d2MAnisomr11sBZGxuzB4WRDbNHha9t7 =ATra -----END PGP SIGNATURE----- --Bn2rw/3z4jIqBvZU-- ------------=_1262307003-17489-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 13 Dec 2009 16:22:20 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.1 required=4.0 tests=AWL,FOURLA,PGPSIGNATURE autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nBDGMJ3p011973 for ; Sun, 13 Dec 2009 08:22:20 -0800 Received: from mx10.gnu.org ([199.232.76.166]:55529) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NJrD8-00065t-IJ for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 11:22:18 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NJrD5-0001kH-CE for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 11:22:18 -0500 Received: from mail6.sea5.speakeasy.net ([69.17.117.8]:47000) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NJrD4-0001jl-KP for emacs-pretest-bug@gnu.org; Sun, 13 Dec 2009 11:22:15 -0500 Received: (qmail 6822 invoked from network); 13 Dec 2009 16:22:12 -0000 Received: from pool-96-233-67-219.bstnma.fios.verizon.net (HELO srevilak.net) (srevilak@[96.233.67.219]) (envelope-sender ) by mail6.sea5.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 13 Dec 2009 16:22:12 -0000 Date: Sun, 13 Dec 2009 11:22:10 -0500 From: Steve Revilak To: emacs-pretest-bug@gnu.org Subject: 23.1.90; CC Mode version 5.31.8 does not indent properly when writing new C files Message-ID: <20091213162210.GC376@srevilak.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QRj9sO5tAVLaXnSD" Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) --QRj9sO5tAVLaXnSD Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing lis= t. Please describe exactly what actions triggered the bug and the precise symptoms of the bug. If you can, give a recipe starting from `emacs -Q': * * * STEPS TO REPRODUCE ------------------ (1) Start emacs with the command line "emacs -nw -Q foo.c". foo.c should be a new file, which does not exist prior to starting emacs. (2) Type "#include " and RETURN (3) Type RETURN to leave a blank line (4) type "static void add_one(int * x) {" and RETURN (5) type "*x +=3D 1;" and RETURN (6) type "}" and RETURN (to close the function definition) NOTE: the statement written in step (5) is left-aligned to column zero. The statement should be indented. (7) Place point in column zero of the line "*x +=3D 1;". Press TAB. Before pressing TAB, "*x +=3D 1;" is aligned to column zero. After pressing TAB, "*x +=3D 1;" is still aligned to column zero. TAB did not indent the statement. (8) Type "C-x h TAB" (i.e., to select and re-indent the entire buffer). The minibuffer displays "Indenting region... done". However, the statement "*x +=3D 1;" is still aligned to column zero. After step 8, buffer "foo.c" looks like this: --------------------------------- #include static void add_one(int * x) { *x +=3D 1; } --------------------------------- NOTE: the fourth line is not indented (but it should be). NOTES: ----- In buffer "foo.c", "M-x describe-key RET TAB" produces: --------------------------------- TAB runs the command c-indent-line-or-region, which is an interactive compiled Lisp function in `cc-cmds.el'. It is bound to TAB, . (c-indent-line-or-region &optional ARG REGION) Indent active region, current line, or block starting on this line. In Transient Mark mode, when the region is active, reindent the region. Otherwise, with a prefix argument, rigidly reindent the expression starting on the current line. Otherwise reindent just the current line. --------------------------------- NOTE: In step (8), when the entire buffer was selected, with transient mark mode enabled, TAB did not re-indent the region correctly. Likewise, in step (7) TAB did not re-indent the current line ("Otherwise reindent just the current line").=20 In buffer "foo.c", "M-x desribe-mode" produces: --------------------------------- Enabled minor modes: Abbrev Auto-Composition Auto-Compression Auto-Encryption File-Name-Shadow Font-Lock Global-Auto-Composition Global-Font-Lock Line-Number Menu-Bar Mouse-Wheel Tool-Bar Tooltip Transient-Mark (Information about these minor modes follows the major mode info.) C/l mode: Major mode for editing K&R and ANSI C code. To submit a problem report, enter `C-c C-b' from a c-mode buffer. This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case, and send the message. To see what version of CC Mode you are running, enter `M-x c-version'. The hook `c-mode-common-hook' is run with no args at mode initialization, then `c-mode-hook'. [rest of describe-mode output omitted] --------------------------------- M-x c-version produces the following: --------------------------------- Using CC Mode version 5.31.8 --------------------------------- Finally, the same behavior occurs when emacs is started as "emacs -Q" (i.e., if the -nw option is ommitted from the command line). * * * If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. For information about debugging Emacs, please read the file /Applications/Emacs.app/Contents/Resources/etc/DEBUG. In GNU Emacs 23.1.90.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54) of 2009-12-09 on oatmeal.ma.runwaynine.com Windowing system distributor `Apple', version 10.3.949 configured using `configure '--with-ns'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: C value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil value of $XMODIFIERS: nil locale-coding-system: nil default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: ESC x r e p o r t - e m a c s - b u TAB RET Recent messages: ("/Applications/Emacs.app/Contents/MacOS/Emacs") For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow mail-extr message ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1 hex-util hashcash mail-utils warnings emacsbug sendmail regexp-opt tooltip ediff-hook vc-hooks lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces cus-face text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process ns multi-tty emacs) --QRj9sO5tAVLaXnSD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (Darwin) iEYEARECAAYFAkslFLIACgkQX7YJI4BuyDRYuwCdFWwPqTQnO7mxiHmZ+WhJ2DnR oQUAoIOYoYnbQJISh+eDcefSXiNucEBw =q6xz -----END PGP SIGNATURE----- --QRj9sO5tAVLaXnSD-- ------------=_1262307003-17489-1--