From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vivien Mallet Newsgroups: gmane.emacs.bugs Subject: bug#681: Wrong C++ indentation in batch mode Date: Sat, 9 Aug 2008 17:26:22 +0200 Organization: INRIA Paris-Rocquencourt Message-ID: <200808091726.22907.Vivien.Mallet@inria.fr> Reply-To: Vivien Mallet , 681@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_ecbnIzzH7LbWYfi" X-Trace: ger.gmane.org 1218385210 14167 80.91.229.12 (10 Aug 2008 16:20:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Aug 2008 16:20:10 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 10 18:21:01 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KSDf8-0006rp-Ob for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Aug 2008 18:20:59 +0200 Original-Received: from localhost ([127.0.0.1]:45032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSDeC-0000wV-OH for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Aug 2008 12:20:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KRqfA-0000Sa-1A for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:47:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KRqf8-0000QU-Dg for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:47:27 -0400 Original-Received: from [199.232.76.173] (port=57509 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRqf8-0000QN-7W for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:47:26 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:57715) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KRqf7-0003p9-IL for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:47:25 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m79FlNqm029363; Sat, 9 Aug 2008 08:47:23 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m79FZ4vH025229; Sat, 9 Aug 2008 08:35:04 -0700 X-Loop: don@donarmstrong.com Resent-From: Vivien Mallet Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sat, 09 Aug 2008 15:35:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 681 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.121829559223372 (code B ref -1); Sat, 09 Aug 2008 15:35:04 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 9 Aug 2008 15:26:32 +0000 Original-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 m79FQSje023366 for ; Sat, 9 Aug 2008 08:26:30 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KRqKq-0004Fb-2n for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:26:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KRqKo-0004Bv-Hx for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:26:27 -0400 Original-Received: from [199.232.76.173] (port=58824 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KRqKo-0004Bg-E2 for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:26:26 -0400 Original-Received: from smtp8-g19.free.fr ([212.27.42.65]:33222) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KRqKo-0007KB-0T for bug-gnu-emacs@gnu.org; Sat, 09 Aug 2008 11:26:26 -0400 Original-Received: from smtp8-g19.free.fr (localhost [127.0.0.1]) by smtp8-g19.free.fr (Postfix) with ESMTP id 69ABC32A8A9; Sat, 9 Aug 2008 17:26:23 +0200 (CEST) Original-Received: from data.localnet (ver78-6-88-166-87-133.fbx.proxad.net [88.166.87.133]) by smtp8-g19.free.fr (Postfix) with ESMTP id 40DCF32A886; Sat, 9 Aug 2008 17:26:23 +0200 (CEST) User-Agent: KMail/1.10.0 (Linux/2.6.24-19-generic; KDE/4.1.0; i686; ; ) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Sat, 09 Aug 2008 11:47:27 -0400 X-Mailman-Approved-At: Sun, 10 Aug 2008 12:19:54 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:19238 Archived-At: --Boundary-00=_ecbnIzzH7LbWYfi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, The indentation in C++ mode does not seem to work properly in batch mode with the following code (indented in interactive mode): """ template Derived::Derived(): Base() // Problem: wrong indentation in batch mode. { } """ Now, define the Lisp function: (defun cpp_indent () (c-set-style "gnu") (c++-mode) (indent-region (point-min) (point-max) ()) (save-buffer) ) And apply it the previous function. It will result in: """ template Derived::Derived(): Base() // Problem: wrong indentation in batch mode. { } """ which is inconsistent with the interactive and is not, I presume, the targeted result. I found the problem in Emacs 23.0.60.1 (emacs snapshot in Kubuntu 8.04) and in Emacs 22.1.3. It does not appear in Emacs 21.4.1 (Debian Etch). Just an unrelated note about the indentation. I found a difference between the two latest versions I mentioned and the version 21.4.1. This code (indented with Emacs 22+): """ template Derived0::Derived0(): Base () { } """ is indented by Emacs 21.4.1 as """ template Derived0::Derived0(): Base () { } """ I like the new indentation better, and I suppose it was an improvement introduced in the latest versions. I mention it, just in case... I attach three files: - test.cxx: a file to be indented (but already well indented); - test-wrong_indentation.cxx: test.cxx after indentation in batch mode with Emacs 22+; - cpp_indent.lisp: the indentation function. Used in: "emacs -batch test.cxx - l cpp_indent.lisp -f cpp_indent". Thank you for your great work, Vivien Mallet. --Boundary-00=_ecbnIzzH7LbWYfi Content-Type: text/x-c++src; charset="us-ascii"; name="test-wrong_indentation.cxx" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test-wrong_indentation.cxx" template Derived::Derived(): Base() // Problem: wrong indentation in batch mode. { } template Derived0::Derived0(): Base () // Just a note: Emacs 21 did not indent like that. { } --Boundary-00=_ecbnIzzH7LbWYfi Content-Type: text/x-c++src; charset="us-ascii"; name="test.cxx" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test.cxx" template Derived::Derived(): Base() // Problem: wrong indentation in batch mode. { } template Derived0::Derived0(): Base () // Just a note: Emacs 21 did not indent like that. { } --Boundary-00=_ecbnIzzH7LbWYfi Content-Type: text/plain; charset="us-ascii"; name="cpp_indent.lisp" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cpp_indent.lisp" (defun cpp_indent () (c-set-style "gnu") (c++-mode) (indent-region (point-min) (point-max) ()) (save-buffer) ) --Boundary-00=_ecbnIzzH7LbWYfi--