From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miguel Guedes Newsgroups: gmane.emacs.help Subject: Edge case in c-cleanup Date: Sun, 08 Feb 2015 17:16:54 +0000 Message-ID: <54d79a07$1$20811$862e30e2@ngroups.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1423416019 16163 80.91.229.3 (8 Feb 2015 17:20:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Feb 2015 17:20:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 08 18:20:19 2015 Return-path: Envelope-to: geh-help-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 1YKVWr-0005Kz-Ug for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Feb 2015 18:20:18 +0100 Original-Received: from localhost ([::1]:57244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKVWr-0006i6-Dd for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Feb 2015 12:20:17 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!81.171.118.62.MISMATCH!peer02.fr7!news.highwinds-media.com!not-for-mail Original-X-Trace: DXC=oCL`Tm8P<7e105dZ:BUm0iG^cGF?V7mId0Loi@@ESdUjURVEhGKT; [jNJKfKgb_UVdY\T7jIeACYdPkag`I2KbSk^:RCP8DkRXfm:3IWf\Tf7j Original-X-Complaints-To: abuse@blocknews.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Original-NNTP-Posting-Host: ae3b6582.ngroups.net X-Received-Bytes: 1937 X-Received-Body-CRC: 3208814124 Original-Xref: usenet.stanford.edu gnu.emacs.help:210303 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102579 Archived-At: I have got the following clean ups defined in a c style (c-add-style): (c-cleanup-list . (brace-else-brace brace-elseif-brace brace-catch-brace empty-defun-braces one-liner-defun defun-close-semi space-before-funcall compact-empty-funcall)) I have noticed a minor annoying edge case that can be best illustrated as given by: int bazillion() { if(booz) { foo(); } // typing closing brace, issues newline else // no opening brace means `elseĀ“ isn't placed above bar(); } Since in my current setup typing `}' automatically issues a newline, emacs won't correctly place an else statement next to the closing brace above (as desired) *if it does not* contain an opening brace. For instance, this would work just fine: int bazillion() { if(booz) { foo(); } else { // else is moved up next to the closing brace bar(); // after typing the subsequent opening brace } } Is there are way of resolving this via a style setting perhaps such that `elseĀ“ statements without opening braces are correctly placed? Unsure if I made my question clear enough so please ask for clarification if in doubt.