From: Alan Mackenzie <acm@muc.de>
To: Leo <sdl.web@gmail.com>
Cc: 11107@debbugs.gnu.org
Subject: bug#11107: 24.0.94; indentation in objc-mode
Date: Thu, 29 Mar 2012 13:35:28 +0000 [thread overview]
Message-ID: <20120329133528.GB2961__13211.6229077385$1333028280$gmane$org@acm.acm> (raw)
In-Reply-To: <m2mx71a57v.fsf@gmail.com>
Hello, Leo.
On Wed, Mar 28, 2012 at 09:23:32AM +0800, Leo wrote:
> -(IBAction)loginClicked:(id)sender
> {
> if (![username.text isEqualToString:@""]&&![password.text isEqualToString:@""]&&![companyCode.text isEqualToString:@""]) {
> if ([username.text isMatchedByRegex:@"[a-zA-Z0-9]+"]&&[password.text isMatchedByRegex:@"[a-zA-Z0-9]+"]&&[companyCode.text isMatchedByRegex:@"[a-zA-Z0-9]+"]) {
> ;
> } else {
> UIAlertView *alert = [[[UIAlertView alloc]
> initWithTitle:@""
> message:@""
> delegate:self
> cancelButtonTitle:@""
> otherButtonTitles:nil] autorelease];
> [alert show];
> }
> } else {
> UIAlertView *alert = [[[UIAlertView alloc]
> initWithTitle:@""
> message:@""
> delegate:self
> cancelButtonTitle:@""
> otherButtonTitles:nil] autorelease];
> [alert show];
> }
> }
> 1. Emacs -q
> 2. Open the attach file
> 3. Eval in the file buffer:
> - (c-set-style "bsd")
> - (setq c-basic-offset 4)
> Try indenting the file, you will see : in the message name not aligned
> properly as shown in this picture.
What is happening here is this:
cancelButtonTitle would, if its : were lined up, not be sufficiently
indented from the enclosing [. Here "sufficiently indented" is
determined by the variable c-objc-method-arg-min-delta-to-bracket, whose
default value is 2. On failing that test, the line gets indented
c-basic-offset columns after that [.
The simplest WAY TO FIX THIS is to give a lower value to
c-objc-method-arg-min-delta-to-bracket (honestly, I didn't invent that
name ;-), probably a negative number. You can set this variable via
M-x customize-variable, or your favourite other method.
There is actually a lineup-function c-lineup-ObjC-method-args which
should do exactly what you want, but sadly it doesn't work at all. I'll
need to fix it sometime.
########################################################################
OPTIONAL SECTION
If you're interested in what's going on here, do C-c C-o on the
cancelButtonTitle line, then hit <CR>. You get
(default (c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +)).
The "default" means "execute the functions in the following list until
one returns non-nil". The first one returns nil on the
cancelButtonTitle. The second one returns 4, the relative indentation
used.
All this is detailed in the CC Mode manual in the chapter "Customizing
indentation" and its subsections, in particular "Line-Up Functions"
together with its subsections.
#########################################################################
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2012-03-29 13:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 1:23 bug#11107: 24.0.94; indentation in objc-mode Leo
2012-03-29 13:35 ` Alan Mackenzie [this message]
[not found] ` <20120329133528.GB2961@acm.acm>
2012-03-31 21:19 ` Leo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='20120329133528.GB2961__13211.6229077385$1333028280$gmane$org@acm.acm' \
--to=acm@muc.de \
--cc=11107@debbugs.gnu.org \
--cc=sdl.web@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.