GNU bug report logs - #738
indenting in cc whitesmith mode broken in emacs 22.2, works in 21.3

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs,cc-mode; Reported by: "Jyrki Saarela" <jyrki.saarela <at> gmail.com>; dated Mon, 18 Aug 2008 10:30:03 UTC; Maintainer for emacs is bug-gnu-emacs <at> gnu.org.

Message received at 738 <at> debbugs.gnu.org:


Received: (at 738) by debbugs.gnu.org; 3 Oct 2011 20:10:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 03 16:10:07 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RAopy-0002Ce-KD
	for submit <at> debbugs.gnu.org; Mon, 03 Oct 2011 16:10:06 -0400
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <rgm <at> gnu.org>) id 1RAopw-0002CX-RX
	for 738 <at> debbugs.gnu.org; Mon, 03 Oct 2011 16:10:05 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <rgm <at> gnu.org>)
	id 1RAooZ-0004pa-9k; Mon, 03 Oct 2011 16:08:39 -0400
From: Glenn Morris <rgm <at> gnu.org>
To: 738 <at> debbugs.gnu.org
Subject: Re: bug#738: indenting in cc whitesmith mode broken in emacs 22.2,
	works in 21.3
References: <3995e65f0808180320s5e2f807dla3e2bcf7373f2df <at> mail.gmail.com>
X-Spook: Crowell NSA SSL INS NORAD nuclear kilderkin Ruby Ridge
X-Ran: :J{.C=%cR>u$GvDa3}4bf2zKOc~KV{5XiVcT96[aKQ-p?]Lyn5i}O7u6?kc/KU%/"F.mXf
X-Hue: white
X-Attribution: GM
Date: Mon, 03 Oct 2011 16:08:39 -0400
In-Reply-To: <3995e65f0808180320s5e2f807dla3e2bcf7373f2df <at> mail.gmail.com>
	(Jyrki Saarela's message of "Mon, 18 Aug 2008 13:20:40 +0300")
Message-ID: <ro1uutbzy0.fsf <at> fencepost.gnu.org>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.4 (------)
X-Debbugs-Envelope-To: 738
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.4 (------)


Still present in 24.0.90.
(Partial?) duplicate of http://debbugs.gnu.org/cgi/bugreport.cgi?bug=523 ?




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#738; Package emacs,cc-mode. Full text available.
Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, owner <at> emacsbugs.donarmstrong.com:
bug#738; Package emacs,cc-mode. Full text available.
bug reassigned from package `emacs' to `emacs,cc-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-4.9 required=4.0 tests=BAYES_00,FOURLA,
	RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at submit) by emacsbugs.donarmstrong.com; 18 Aug 2008 10:20:53 +0000
Received: from lists.gnu.org (lists.gnu.org [199.232.76.165])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7IAKnrf031890
	for <submit <at> emacsbugs.donarmstrong.com>; Mon, 18 Aug 2008 03:20:51 -0700
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1KV1qx-0002Fg-BE
	for bug-gnu-emacs <at> gnu.org; Mon, 18 Aug 2008 06:20:48 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KV1qu-0002Ee-MF
	for bug-gnu-emacs <at> gnu.org; Mon, 18 Aug 2008 06:20:44 -0400
Received: from [199.232.76.173] (port=50378 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1KV1qs-0002ER-FN
	for bug-gnu-emacs <at> gnu.org; Mon, 18 Aug 2008 06:20:42 -0400
Received: from fg-out-1718.google.com ([72.14.220.158]:9264)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <jyrki.saarela <at> gmail.com>)
	id 1KV1qs-0006hN-3C
	for bug-gnu-emacs <at> gnu.org; Mon, 18 Aug 2008 06:20:42 -0400
Received: by fg-out-1718.google.com with SMTP id l26so1455340fgb.30
        for <bug-gnu-emacs <at> gnu.org>; Mon, 18 Aug 2008 03:20:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=gamma;
        h=domainkey-signature:received:received:message-id:date:from:to
         :subject:mime-version:content-type:content-transfer-encoding
         :content-disposition;
        bh=P8tFxnKzyC6P7uun1jVAOYyOwi3mkKibsFNcYzrY6C8=;
        b=sP88qw3/A2SBWHaECeOFaRMv56qGiO/Zo7C8nu6H57rvGySfjcD2EmUJrGvVCjWmtR
         9x+l7tYDVpIulC2o7DK+azrMFQtzrAluAG6PG7PR5ZM+B9cz0zoLg0FYom/7u//4YMfS
         7fq5o6gqymIIgVFg7FP/6VvL0FbQn/U0FkzDE=
DomainKey-Signature: a=rsa-sha1; c=nofws;
        d=gmail.com; s=gamma;
        h=message-id:date:from:to:subject:mime-version:content-type
         :content-transfer-encoding:content-disposition;
        b=wiCb41kw2hC6JPNgOdG9E99NvOwCzL3/syq0moMai0arlBbow7SXAZcCkW/JecYbzt
         yo2bx/snJdgssmkb4r1dftFo1HJahPpUzOaJfeRETzSiQ2fJmosy9fuxo9kFMf3pOIHL
         vCpqj07+wWNDo/+gfUisZBRbp7ezAK3k18Wng=
Received: by 10.86.92.7 with SMTP id p7mr4474603fgb.8.1219054840076;
        Mon, 18 Aug 2008 03:20:40 -0700 (PDT)
Received: by 10.86.53.4 with HTTP; Mon, 18 Aug 2008 03:20:40 -0700 (PDT)
Message-ID: <3995e65f0808180320s5e2f807dla3e2bcf7373f2df <at> mail.gmail.com>
Date: Mon, 18 Aug 2008 13:20:40 +0300
From: "Jyrki Saarela" <jyrki.saarela <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: indenting in cc whitesmith mode broken in emacs 22.2, works in 21.3
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2)

Automating indenting of c++ code is broken

In GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600)
 of 2008-03-26 on RELEASE
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'

likely in all versions. I tried to check from gnu.emacs.bug, but could
not find anything related. Feel free to blame google groups if this is
not a new bug.

There are 2 possibly separated things.

a) minor - if c-electric-flag is t then current line is re-indented
badly every time '(' is pressed within function body. This might be
even a feature - but very annoying one. It does work differently ( and
better ) in emacs 21.3. At least the indentation is corrected when ')'
is pressed.

b) major - at least last line of function where '}' is placed in
whitesmith style is indented incorrectly ( possibly other places too),
and indentation also depends on where you press <tab> key. If pressed
at left side of the '}' or on the '}' then indentation works
correctly. If c-electric-flag is t then the automatic indentation is
also incorrect. And yes, it does work in emacs 21.3.

To repro:

common:
1) see .emacs at bottom of this file
2) start up emacs. Visit a c++ file, eg ^X ^F foo.cpp<ret>

3a) to repro a), type "int main()<ret>{<ret>if("
result a:
int main()
    {
        if(

expected a:
int main()
    {
    if (


3b) to repro b) type "int main()<ret>{<ret>}"

result b:
int main()
    {
        }

expected b:
int main()
    {
    }

You can also start with

int main()
    {
    }<PRESS TAB HERE>

and press tab where indicated and end up with result b. But if you
start with result b

int main()
    {
        <PRESS TAB HERE>}

and press tab where indicated the indentation will be corrected.



-----------------------------------------------------------------------

(almost) Minimal .emacs required to reproduce:

;; ==========================
;; C/C++ indentation
;; ==========================
(defun my-c-mode-common-hook ()
  (c-set-style "whitesmith") )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

; if c-electric-flag is set, works even worse
;( setq-default c-electric-flag nil )
(setq-default indent-tabs-mode nil)

-- 
Jyrki





Acknowledgement sent to "Jyrki Saarela" <jyrki.saarela <at> gmail.com>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text available.
Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#738; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 3 Oct 2011 20:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.