From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: c-mode indentation of parenthesized expressions Date: Thu, 05 Feb 2009 20:48:53 +0200 Message-ID: <87d4dwvhwq.fsf@iki.fi> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233860724 24461 80.91.229.12 (5 Feb 2009 19:05:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Feb 2009 19:05:24 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thomas Christensen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 05 20:06:38 2009 Return-path: Envelope-to: geh-help-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 1LV9Y0-0004Vu-OS for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Feb 2009 20:06:01 +0100 Original-Received: from localhost ([127.0.0.1]:48670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LV9Wh-0005h1-IS for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Feb 2009 14:04:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LV9Hm-00071K-1U for help-gnu-emacs@gnu.org; Thu, 05 Feb 2009 13:49:14 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LV9Hj-0006zx-FG for help-gnu-emacs@gnu.org; Thu, 05 Feb 2009 13:49:12 -0500 Original-Received: from [199.232.76.173] (port=55778 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LV9Hj-0006zh-5T for help-gnu-emacs@gnu.org; Thu, 05 Feb 2009 13:49:11 -0500 Original-Received: from mta-out.inet.fi ([195.156.147.13]:50681 helo=jenni1.inet.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LV9Hi-0000bL-1m for help-gnu-emacs@gnu.org; Thu, 05 Feb 2009 13:49:11 -0500 Original-Received: from mithlond.arda.local (80.220.180.181) by jenni1.inet.fi (8.5.014) id 48FC59C704AC34E4; Thu, 5 Feb 2009 20:48:55 +0200 Original-Received: from dtw by mithlond.arda.local with local (Exim 4.69) (envelope-from ) id 1LV9HR-0001Bf-9W; Thu, 05 Feb 2009 20:48:53 +0200 In-Reply-To: (Thomas Christensen's message of "Thu\, 05 Feb 2009 19\:14\:02 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61929 Archived-At: On 2009-02-05 19:14 (+0100), Thomas Christensen wrote: > a = foo(1, 2, 3, > 4) > > It aligns with the parenthesis. > > I want to change this to twice the default indent, which I have set to a > tab in the example below, like this: > > a = (2 + 4 + > 5) You can change it temporarily by putting the cursor on the second line and pressing "C-c C-o". Minibuffer dialog offers arglist-cont-nonempty: just press Enter and then answer ++ (that is, two plus signs) to the latter question. You can also add your own styles. This example adds a style called "my-style" which is based on "linux" style. We put the style definition to c-mode-common-hook so that it gets defined when turning on a programming mode that is managed by Emacs cc-mode package. (add-hook 'c-mode-common-hook '(lambda () (c-add-style "my-style" '("linux" (c-offsets-alist (arglist-cont-nonempty '++)))))) Then change to that style with "C-c ." or c-set-style function. Another possibility to get the new style added is "(eval-after-load 'cc-mode '(c-add-style ...))".