From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bruce Korb Newsgroups: gmane.emacs.bugs Subject: bug#20778: Flush left indentation in c-mode Date: Fri, 12 Jun 2015 07:55:37 -0700 Organization: FSF Message-ID: <557AF2E9.3@gnu.org> References: <20150610110034.44777.qmail@mail.muc.de> Reply-To: bkorb@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1434121439 10724 80.91.229.3 (12 Jun 2015 15:03:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Jun 2015 15:03:59 +0000 (UTC) To: Alan Mackenzie , 20778@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 12 17:03:49 2015 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 1Z3QUj-0007SC-QE for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jun 2015 17:03:46 +0200 Original-Received: from localhost ([::1]:52036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3QUj-0001m7-8d for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jun 2015 11:03:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3QNL-00045Q-Ly for bug-gnu-emacs@gnu.org; Fri, 12 Jun 2015 10:56:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3QNK-0004IS-Bp for bug-gnu-emacs@gnu.org; Fri, 12 Jun 2015 10:56:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3QNG-0004BH-Ke; Fri, 12 Jun 2015 10:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z3QNG-0003Ql-3L; Fri, 12 Jun 2015 10:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Bruce Korb Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Fri, 12 Jun 2015 14:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20778 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 20778-submit@debbugs.gnu.org id=B20778.143412094913169 (code B ref 20778); Fri, 12 Jun 2015 14:56:01 +0000 Original-Received: (at 20778) by debbugs.gnu.org; 12 Jun 2015 14:55:49 +0000 Original-Received: from localhost ([127.0.0.1]:51943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3QN2-0003QK-N6 for submit@debbugs.gnu.org; Fri, 12 Jun 2015 10:55:49 -0400 Original-Received: from mail-qk0-f172.google.com ([209.85.220.172]:35341) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3QN0-0003Q2-1A for 20778@debbugs.gnu.org; Fri, 12 Jun 2015 10:55:47 -0400 Original-Received: by qkhq76 with SMTP id q76so18371480qkh.2 for <20778@debbugs.gnu.org>; Fri, 12 Jun 2015 07:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:organization:user-agent :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=T1VyMlcGsxazcyKhnrcmT/rNwYaK2yW6EXgKfEKjIeA=; b=bsunqMbRnV9AuJ/5rwuIm643U801YhauxzvDKVN5eGhCXTHol+A+QN5kasxFUCK1k+ pn/18ENkRHxcAiMw15js3U24sPMek65phAkfavGBwrLk63domiBzQNVBE+IiZD/mWsxQ 8peQdfUTGhpS/wC97j6Is7w9ySoOMF7XSAgXV60spE6kaG9sheWZvFFrBR3bX6XRdOsV w1wZyBdaJDfTEFB+z1ld38Pvee5ABgxuFtlHxl+uouVsTU6h6iNR+tlOTdy+uJFqmGUK 3wQH7N99DmR86PrmkZLKcIo7FSN94XiI/EIIlR0WwMed16/9AtA99oEM+tPaC0iTglFy J7sw== X-Received: by 10.55.41.195 with SMTP id p64mr31485644qkp.40.1434120940365; Fri, 12 Jun 2015 07:55:40 -0700 (PDT) Original-Received: from [172.16.16.2] (adsl-75-18-229-172.dsl.pltn13.sbcglobal.net. [75.18.229.172]) by mx.google.com with ESMTPSA id 106sm1771279qge.22.2015.06.12.07.55.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2015 07:55:39 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <20150610110034.44777.qmail@mail.muc.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.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:103864 Archived-At: On 06/10/15 04:00, Alan Mackenzie wrote: >> With the patched cc-mode, I ran into this situation again. > > Er, any chance of a reference to "this situation"? "see below" :) >> I do not know what you can do about it without better information from me, >> but I don't know what to tell you either. :( Oh, the "c-file-style" is "linux". > > OK, standard information, please: > (i) The Emacs version number (M-x emacs-version). > $ emacs --version > GNU Emacs 24.3.1 > Copyright (C) 2013 Free Software Foundation, Inc. > (ii) The CC Mode version (M-x c-version). > $ ls -l ~/.emacs.d|fgrep cc-mode > drwxr-xr-x 2 bkorb dev 4096 May 11 13:31 cc-mode > -rw-r----- 1 bkorb dev 580925 May 7 17:19 cc-mode-5.32.5.tar.gz 5.32.5, but patched: > --- cc-cmds.el 2013-05-03 10:11:16.000000000 -0700 > +++ ../cc-mode/cc-cmds.el 2015-05-11 13:31:16.758777535 -0700 > @@ -937,15 +937,8 @@ > ;; do all cleanups and newline insertions if c-auto-newline is on. > (if (or (not c-auto-newline) > (not (looking-at "[ \t]*\\\\?$"))) > - (when c-syntactic-indentation > - (let ((syntax (c-guess-basic-syntax))) > - (c-indent-line syntax) > - ;; Guard against the C hacker inserting a statement before a > - ;; non-compound statement in an if/while/for. > - (if (eq (caar syntax) 'substatement) > - (save-excursion > - (if (eq 0 (forward-line)) > - (c-indent-line)))))) > + (if c-syntactic-indentation > + (c-indent-line)) > ;; clean ups: list-close-comma or defun-close-semi > (let ((pos (- (point-max) (point)))) > (if (c-save-buffer-state () > (iii) Have you got any CC Mode customisations in your .emacs? You've > already said you're in style "linux", but is there anything else? If > so, what? Not much: > $ cat .dir-locals.el > > ( > (nil . ((indent-tabs-mode . t) > (tab-width . 8) > (show-trailing-whitespace . t) > (fill-column . 132))) > > (c-mode . ((c-file-style . "linux"))) > ) > (iii) The EXACT steps you took between starting Emacs to seeing the error, > detailed enough that I can reproduce it. If I knew the answer to that, I would have included that. :( I work for hours and then suddenly this happens. The mechanism for clearing it requires closing and re-visiting the file in question. I do not have to restart emacs. Changing to another mode and changing back to C-mode is not effective (i.e. the problem persists). > (iv) What exactly do you mean "It seems to think that the flush-left > alignment ... is fine"? What command did you give that led you to this > conclusion, or what output from CC Mode was relevant? I put the cursor on the flush-left "if" line and press to no effect. I re-indent the region, to no effect. I switch to "text-mode" and back and re-indent the region, to no effect. I close and re-visit the file and indent-region now works correctly, as you see for yourself when you tried re-indenting the region. The only way I can think of to resolve this is if there is some information I can dump out about the buffer the next time it happens. Obviously, I have to close and re-visit the file fairly soon, as this is my day job.... > Just for info, when I loaded the following fragment into Emacs, stripped > of the leading "> " from each line, set the style "linux", then indented > it .... I can't > reproduce the problem at the moment. It is not the particular code fragment, but the editing history that seems to trigger the problem. I have trouble remembering all the 100's to 1000's of keystrokes I went through to cause it. ;)