From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Burge Newsgroups: gmane.emacs.bugs Subject: bug#12527: 24.2; idented preprocessor directives confusing cc-mode indent Date: Thu, 27 Sep 2012 13:22:39 -0500 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1348774863 11358 80.91.229.3 (27 Sep 2012 19:41:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 27 Sep 2012 19:41:03 +0000 (UTC) To: 12527@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 27 21:41:08 2012 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 1THJxL-0003uD-Rj for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Sep 2012 21:41:08 +0200 Original-Received: from localhost ([::1]:49063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THJxG-0008NT-LM for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Sep 2012 15:41:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THJxC-0008N6-4e for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 15:41:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THJxA-0001RY-RX for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 15:40:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THJxA-0001RT-Nt for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 15:40:56 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1THJxF-0004Sr-Sh for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 15:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kevin Burge Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Sep 2012 19:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12527 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.134877483917127 (code B ref -1); Thu, 27 Sep 2012 19:41:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Sep 2012 19:40:39 +0000 Original-Received: from localhost ([127.0.0.1]:59273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THJwr-0004SB-WB for submit@debbugs.gnu.org; Thu, 27 Sep 2012 15:40:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49915) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1THIje-0002dm-S1 for submit@debbugs.gnu.org; Thu, 27 Sep 2012 14:22:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THIjY-0000AA-Kz for submit@debbugs.gnu.org; Thu, 27 Sep 2012 14:22:49 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:46952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THIjY-0000A6-GO for submit@debbugs.gnu.org; Thu, 27 Sep 2012 14:22:48 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THIjX-0002Rx-7P for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 14:22:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THIjS-00009q-2M for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 14:22:47 -0400 Original-Received: from mail-la0-f41.google.com ([209.85.215.41]:62699) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THIjR-00009j-Qp for bug-gnu-emacs@gnu.org; Thu, 27 Sep 2012 14:22:41 -0400 Original-Received: by lagp5 with SMTP id p5so486173lag.0 for ; Thu, 27 Sep 2012 11:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9se6dVB1XHG3Bz36xR5xD5iOZ2WZdfwfRvUMdEifJFU=; b=gsElfbWysKmJsCJKejLhbMbOdR0hJTiI+WeXB519eSisPDlMkjTGJrx4K3Tk1CvgkU /4jmq8d2hNKRupO72N+gHka0D9p90b02msayRnjhG9ogH0IECLZgdnYMjnXw9D/9PpAa 4vUTQIWzx4wxDVKsmmkPOOCcMOOjTdXPpKgJdVX4tJileLMNx8usf/i94NZSeVzegWji FYfnj3tUkO2ENkxfmLirv8+udWLYxh69WhkNiFENE58KBKYthRsMqSMLznmvEfkDh8QO Wp3HOWIaHeGDPGMHoEsAEhQhf8kOTGQZ+6ngunULwo9Bp+2r0r9M+obja9Ci7GAEf2v+ 8xrg== Original-Received: by 10.152.148.34 with SMTP id tp2mr3982147lab.15.1348770160161; Thu, 27 Sep 2012 11:22:40 -0700 (PDT) Original-Received: by 10.112.108.71 with HTTP; Thu, 27 Sep 2012 11:22:39 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Thu, 27 Sep 2012 15:40:36 -0400 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 (newer, 2) 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:64962 Archived-At: Summary: Indenting the preprocessor blocks at least 1 space completely throws off the cc-mode indentation for anything after the preprocessor block. To reproduce: Create the simple file "test.cpp": === int f(void) { #if defined(A) printf("test\n"); #endif if (test) { int i = 0; } } === IMPORTANT: "#if.....#endif" block MUST be indented at least 1 space. If you navigate inside the "if (test)" block and hit tab, it un-indents the line, and any lines after it, to the end of the file. If you reindent the entire file, it works just fine, because the indented preprocessor directives, which works around the problem. You have to play around with this, too. There are certain variations of the #if line that affect the behavior. And, each time you test, you MUST re-open the file, because the caching seems to completely throw it off. I.e. if you change the #if block to === #if 0 printf("test\n"); #endif === And re-load the file, then try to indent the "if (test)" block, it does what it should. Also, changing it to (and reloading): === #if A printf("test\n"); #endif === Is sufficient to break it again. So, it seems like whatever follows the #if affects the behavior. Note: I ran with emacs -q, so, it's not processing any of my configuration. I have hundreds of thousands of lines of codes that use indented preprocessor directives, so making all those changes is not really an option for us. =========================== In GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars) of 2012-09-27 on kevin Windowing system distributor `CentOS', version 11.0.11006000 Configured using: `configure '--prefix=/usr/local/emacs24' '--with-x-toolkit=lucid'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil 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: @im=none locale-coding-system: nil default enable-multibyte-characters: t Major mode: C++/l 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 blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t abbrev-mode: t Recent input: C-x C-f t e s t . c p C-n C-n C-/ C-n C-n C-/ C-x C-s C-n C-n C-a C-n C-a C-n C-a C-p C-p C-p C-p C-p C-p C-p C-p C-p C-SPC C-n C-n C-n C-n C-n C-n C-n C-n C-n M-w M-x b u r e p o r t - b u g Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Undo! [2 times] (No changes need to be saved) byte-code: Beginning of buffer [2 times] Mark set Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar 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 minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting x-toolkit x multi-tty emacs)