all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* c-offset-alist corner case failure?
@ 2006-03-08  7:01 Karl Fogel
  2006-03-09  3:50 ` Miles Bader
  2006-03-09 10:40 ` Alan Mackenzie
  0 siblings, 2 replies; 4+ messages in thread
From: Karl Fogel @ 2006-03-08  7:01 UTC (permalink / raw)
  Cc: Vincent Lefèvre

In GNU Emacs 22.0.50.5 (i686-pc-linux-gnu) of 2005-12-17:

I was looking for a way to avoid this indentation in C mode:

    return rtq_error_create(
                            RTQ_ERR_NODE_UNKNOWN_KIND, NULL,
                            _("Unrecognized node kind: '%s'"),
                            rtq_path_local_style(path, pool));

I wanted (indeed, expected) to get something like this instead:

    return rtq_error_create(
      RTQ_ERR_NODE_UNKNOWN_KIND, NULL,
      _("Unrecognized node kind: '%s'"),
      rtq_path_local_style(path, pool));

Luckily, the variable 'c-offsets-alist' seemed to have a way to
control this, via the 'arglist-cont' element:

   arglist-cont -- Subsequent argument list lines when no
                   arguments follow on the same line as the
                   arglist opening paren.

In the C mode buffer in question, I examined the value of that cons
cell in 'c-offsets-alist':

   M-x eval
   (assoc 'arglist-cont c-offsets-alist)
     ==> (arglist-cont c-lineup-gcc-asm-reg 0)

First I tried setting it to the simplest thing, an integer:

   M-x eval
   (let ((cell (assoc 'arglist-cont c-offsets-alist)))
      (if cell
        (setcdr cell 0)))

I used 'assoc' again to make sure the above expression had the
intended effect, which it had:

   (assoc 'arglist-cont c-offsets-alist)
     ==> (arglist-cont . 0)

But it had no effect on indentation; tabbing resulted in the same
indentation as before.  I tried setting to '+', to get a multiple of
c-basic-offset:

   (let ((cell (assoc 'arglist-cont c-offsets-alist)))
      (if cell
        (setcdr cell '+)))

Still no effect on indentation, though.  I tried setting it to 2, also
with no change in behavior.

Does everyone else see the same behavior?  Am I misinterpreting the
documentation of 'arglist-cont', or is there a buglet here?

-Karl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c-offset-alist corner case failure?
  2006-03-08  7:01 c-offset-alist corner case failure? Karl Fogel
@ 2006-03-09  3:50 ` Miles Bader
  2006-03-09 10:40 ` Alan Mackenzie
  1 sibling, 0 replies; 4+ messages in thread
From: Miles Bader @ 2006-03-09  3:50 UTC (permalink / raw)
  Cc: Vincent Lefèvre, emacs-devel

Karl Fogel <kfogel@red-bean.com> writes:
> I was looking for a way to avoid this indentation in C mode:
>
>     return rtq_error_create(
>                             RTQ_ERR_NODE_UNKNOWN_KIND, NULL,

FWIW, this is the code I use to do something similar:

   (defun miles-c-lineup-arglist-intro-indented-after-function (langelem)
     (save-excursion
       (beginning-of-line)
       (backward-up-list 1)
       (backward-sexp)
       (vector (+ (current-column) c-basic-offset))))

   (c-set-offset 'arglist-intro
                 'miles-c-lineup-arglist-intro-indented-after-function)

-Miles
-- 
"Suppose He doesn't give a shit?  Suppose there is a God but He
just doesn't give a shit?"  [George Carlin]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c-offset-alist corner case failure?
  2006-03-08  7:01 c-offset-alist corner case failure? Karl Fogel
  2006-03-09  3:50 ` Miles Bader
@ 2006-03-09 10:40 ` Alan Mackenzie
  2006-03-09 12:51   ` Vincent Lefevre
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Mackenzie @ 2006-03-09 10:40 UTC (permalink / raw)
  Cc: emacs-devel, bug-cc-mode, Vincent Lefèvre

Hi, Karl!

On Wed, 8 Mar 2006, Karl Fogel wrote:

>In GNU Emacs 22.0.50.5 (i686-pc-linux-gnu) of 2005-12-17:

>I was looking for a way to avoid this indentation in C mode:

>    return rtq_error_create(
>                            RTQ_ERR_NODE_UNKNOWN_KIND, NULL, <=========
>                            _("Unrecognized node kind: '%s'"),
>                            rtq_path_local_style(path, pool));

>I wanted (indeed, expected) to get something like this instead:

>    return rtq_error_create(
>      RTQ_ERR_NODE_UNKNOWN_KIND, NULL,
>      _("Unrecognized node kind: '%s'"),
>      rtq_path_local_style(path, pool));

>Luckily, ....

Hey man, this isn't luck!

> .... the variable 'c-offsets-alist' seemed to have a way to
>control this, via the 'arglist-cont' element:

>   arglist-cont -- Subsequent argument list lines when no
>                   arguments follow on the same line as the
>                   arglist opening paren.

The pertinent line is actually an arglist-intro, which you can see by
doing C-c C-s.  You could also do C-c C-o and play around with the
indentation interactively.

[ .... ]

>Does everyone else see the same behavior?  Am I misinterpreting the
>documentation of 'arglist-cont', or is there a buglet here?

The critical word in the description of arglist-cont is "Subsequent" - it
doesn't apply to the first such line.  However, perhaps it isn't obvious
that the line with the paren doesn't count as the first argument list
line.  Would it be better to make this

  arglist-cont -- Second and subsequent argument list lines
                  ^^^^^^^^^^^
                  when no arguments follow on the same line as
                  the arglist opening paren.

, or perhaps

  arglist-cont -- Subsequent argument list lines (after an
                                                 ^^^^^^^^^
                  arglist-intro) when no arguments follow on
                  ^^^^^^^^^^^^^^^
                  the same line as the arglist opening paren.

?  Or could you perhaps suggest a better way to remove the confusion?
There are several *-cont syntactic symbols described with "subsequent".

>-Karl

-- 
Alan Mackenzie (Munich, Germany)





-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c-offset-alist corner case failure?
  2006-03-09 10:40 ` Alan Mackenzie
@ 2006-03-09 12:51   ` Vincent Lefevre
  0 siblings, 0 replies; 4+ messages in thread
From: Vincent Lefevre @ 2006-03-09 12:51 UTC (permalink / raw)
  Cc: Karl Fogel, emacs-devel, bug-cc-mode

On 2006-03-09 10:40:37 +0000, Alan Mackenzie wrote:
> The critical word in the description of arglist-cont is "Subsequent" - it
> doesn't apply to the first such line.  However, perhaps it isn't obvious
> that the line with the paren doesn't count as the first argument list
> line.  Would it be better to make this
> 
>   arglist-cont -- Second and subsequent argument list lines
>                   ^^^^^^^^^^^
>                   when no arguments follow on the same line as
>                   the arglist opening paren.
> 
> , or perhaps
> 
>   arglist-cont -- Subsequent argument list lines (after an
>                                                  ^^^^^^^^^
>                   arglist-intro) when no arguments follow on
>                   ^^^^^^^^^^^^^^^
>                   the same line as the arglist opening paren.
> 
> ?  Or could you perhaps suggest a better way to remove the confusion?

If the opening paren is not part of the arglist, then I think that
arglist-intro should add "after the opening paren". And concerning
arglist-cont and arglist-cont-nonempty, replace "the arglist opening
paren" by "the opening paren before the argument list".

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-03-09 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-08  7:01 c-offset-alist corner case failure? Karl Fogel
2006-03-09  3:50 ` Miles Bader
2006-03-09 10:40 ` Alan Mackenzie
2006-03-09 12:51   ` Vincent Lefevre

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.