From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs Subject: bug#12527: 24.2; idented preprocessor directives confusing cc-mode indent Date: Sun, 14 Aug 2016 14:51:49 -0600 Message-ID: <87eg5rqdju.fsf@gmail.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1471207945 24870 195.159.176.226 (14 Aug 2016 20:52:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 14 Aug 2016 20:52:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 12527@debbugs.gnu.org To: Kevin Burge Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 14 22:52:21 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2OL-0006Ec-7O for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Aug 2016 22:52:21 +0200 Original-Received: from localhost ([::1]:33720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZ2OI-0003YS-Ae for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Aug 2016 16:52:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZ2OB-0003YL-OU for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 16:52:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZ2O9-0007DI-H3 for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2016 16:52:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59839) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZ2O2-0007Bx-N4; Sun, 14 Aug 2016 16:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bZ2O2-0005kt-EU; Sun, 14 Aug 2016 16:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 14 Aug 2016 20:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12527 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 12527-submit@debbugs.gnu.org id=B12527.147120791922115 (code B ref 12527); Sun, 14 Aug 2016 20:52:02 +0000 Original-Received: (at 12527) by debbugs.gnu.org; 14 Aug 2016 20:51:59 +0000 Original-Received: from localhost ([127.0.0.1]:57551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2Nz-0005kZ-EC for submit@debbugs.gnu.org; Sun, 14 Aug 2016 16:51:59 -0400 Original-Received: from mail-it0-f44.google.com ([209.85.214.44]:38716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2Nx-0005kF-BB; Sun, 14 Aug 2016 16:51:57 -0400 Original-Received: by mail-it0-f44.google.com with SMTP id i128so1155463itf.1; Sun, 14 Aug 2016 13:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=+Z9PFzVdEe2VIQvDHF+Ri4zAwF9s9g3wgtbb1BA8gtE=; b=tEOvm7w3eKkEIjG9iVU2UPwIER8e6M7OHvBKBp0QO1ZW3co7/DFlbaeqkr+B29ml9u g0mXsB/Hj9D8GIfFHnh2PvLhC5iFseddWRg35NnZYHmUWlt7w47ay5PmfhJenQmQCo71 oioCbmK7zyqR9kF1idrR7BBVu1alp/mzgLPDUi/u3Phiuw6Q8b/oPCWuvHWV7h7H5rfE Y5abaS4eoRPa3LBt2rll5Ne6hXYltXg/0zWBeZk96bcvSoLOAEdJDUNDzGY65NY5UvAg 5HbimOU8hVAMGVwSKmFy1oHpDg4eTlae7EEVQ2XiPbpEEw0S8BpfGq/k2iRoRRx8rmKF On+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=+Z9PFzVdEe2VIQvDHF+Ri4zAwF9s9g3wgtbb1BA8gtE=; b=jqYmFtRO13dRB5t/knbS5vnTlj8mcLGXxXiFNWTAePKeyL8oxLXdwgJ2JSMPzelr2Z ZTtNNG/85YBVKVjVpcits7JFFIxSR53Kynoy1xZud8s+94vE7NHKLNlGXvEtBKkbSRV8 GON7l39j7PyXuv6h2rB4NRzrhTwBOORU23nREF2uTM6RoK8Bjzg2/JqrRnfycr3HtUW/ 6MszYxcr3D8TlliYH1X9eYPWEm83AIDe2DmDkcPsw9jEMy3SePLABnG38yABFKKHJomW Tl0AUQPYWLM3QZUIvHOV6n+SHrXwXNlpLydRKwe000m3iQOo2m9MiKElvCvu18CpKN1/ kFUg== X-Gm-Message-State: AEkoouubY8T8SGbt2ZLTiFsS3XCFQX44+9a01yvdfRBA1cC8WUC43HDbq3NMQHMSy1f+pg== X-Received: by 10.36.76.16 with SMTP id a16mr10083947itb.86.1471207911656; Sun, 14 Aug 2016 13:51:51 -0700 (PDT) Original-Received: from lylat (S01061859339e9903.ss.shawcable.net. [174.2.107.88]) by smtp.gmail.com with ESMTPSA id e196sm8370719ioe.3.2016.08.14.13.51.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Aug 2016 13:51:51 -0700 (PDT) In-Reply-To: (Kevin Burge's message of "Thu, 27 Sep 2012 13:22:39 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:122214 Archived-At: close 12527 24.5 quit Kevin Burge writes: > 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. This appears to work fine in 24.5.