all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Extending Alignment in C/C++ expressions (align.el)
@ 2007-09-10 12:37 Nordlöw
  2007-09-10 16:30 ` Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nordlöw @ 2007-09-10 12:37 UTC (permalink / raw)
  To: help-gnu-emacs

How can I extend the Emacs package align.el to make M-x align-entire
additionally align the if sub-expressions and opening curly-braces as
follows?:

if (x) { xi = -1; }
else (yyy) { yyyi = +1; }

should be aligned into

if   (x)   { xi   = -1; }
else (yyy) { yyyi = +1; }

(the example needs to be displayed in fixed-width font to be
understandable)

Thanks,
Nordlöw

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

* Re: Extending Alignment in C/C++ expressions (align.el)
  2007-09-10 12:37 Extending Alignment in C/C++ expressions (align.el) Nordlöw
@ 2007-09-10 16:30 ` Tom Tromey
  2007-09-10 20:10 ` Andreas Röhler
       [not found] ` <mailman.677.1189484458.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2007-09-10 16:30 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "Nordlöw" == Nordlöw  <per.nordlow@gmail.com> writes:

Nordlöw> How can I extend the Emacs package align.el to make M-x align-entire
Nordlöw> additionally align the if sub-expressions and opening curly-braces as
Nordlöw> follows?:

Perhaps try align-regexp.

Tom

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

* Re: Extending Alignment in C/C++ expressions (align.el)
  2007-09-10 12:37 Extending Alignment in C/C++ expressions (align.el) Nordlöw
  2007-09-10 16:30 ` Tom Tromey
@ 2007-09-10 20:10 ` Andreas Röhler
       [not found] ` <mailman.677.1189484458.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2007-09-10 20:10 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: Nordlöw

Am Montag, 10. September 2007 14:37 schrieb Nordlöw:
> if (x) { xi = -1; }
> else (yyy) { yyyi = +1; }
>
> should be aligned into
>
> if   (x)   { xi   = -1; }
> else (yyy) { yyyi = +1; }


Got it with command `align-entire'

with a customized `align-rules-list'.

Edited the regexp of `c-assignment': `[[{=]' instead of `='.
Then optional attributes 

- Repeat:
- Boolean : on   


Andreas Röhler

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

* Re: Extending Alignment in C/C++ expressions (align.el)
       [not found] ` <mailman.677.1189484458.18990.help-gnu-emacs@gnu.org>
@ 2007-09-11 11:14   ` Nordlöw
  2007-09-11 15:07     ` Tom Tromey
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nordlöw @ 2007-09-11 11:14 UTC (permalink / raw)
  To: help-gnu-emacs

On 10 Sep, 18:30, Tom Tromey <tro...@redhat.com> wrote:
> >>>>> "Nordlöw" == Nordlöw  <per.nord...@gmail.com> writes:
>
> Nordlöw> How can I extend the Emacs package align.el to make M-x align-entire
> Nordlöw> additionally align the if sub-expressions and opening curly-braces as
> Nordlöw> follows?:
>
> Perhaps try align-regexp.
>
> Tom

The variable `align-rules-list' is really big. How can I easily change/
extend the part concerning c-assignment? Is there perhaps some variant
of add-to-list(), say modify-list-item(), that does just that?

Thanks again,
Per Nordlöw

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

* Re: Extending Alignment in C/C++ expressions (align.el)
  2007-09-11 11:14   ` Nordlöw
@ 2007-09-11 15:07     ` Tom Tromey
  2007-09-11 16:51     ` Andreas Röhler
       [not found]     ` <mailman.713.1189529369.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2007-09-11 15:07 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> "Nordlöw" == Nordlöw  <per.nordlow@gmail.com> writes:

>> Perhaps try align-regexp.

Nordlöw> The variable `align-rules-list' is really big. How can I easily change/
Nordlöw> extend the part concerning c-assignment? Is there perhaps some variant
Nordlöw> of add-to-list(), say modify-list-item(), that does just that?

I didn't look at this.  I thought you could just C-u M-x align-regexp
and it would prompt you for everything.

Tom

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

* Re: Extending Alignment in C/C++ expressions (align.el)
  2007-09-11 11:14   ` Nordlöw
  2007-09-11 15:07     ` Tom Tromey
@ 2007-09-11 16:51     ` Andreas Röhler
       [not found]     ` <mailman.713.1189529369.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2007-09-11 16:51 UTC (permalink / raw)
  To: help-gnu-emacs

Am Dienstag, 11. September 2007 13:14 schrieb Nordlöw:
> On 10 Sep, 18:30, Tom Tromey <tro...@redhat.com> wrote:
> > >>>>> "Nordlöw" == Nordlöw  <per.nord...@gmail.com> writes:
> >
> > Nordlöw> How can I extend the Emacs package align.el to make M-x
> > align-entire Nordlöw> additionally align the if sub-expressions and
> > opening curly-braces as Nordlöw> follows?:
> >
> > Perhaps try align-regexp.
> >
> > Tom
>
> The variable `align-rules-list' is really big. How can I easily change/
> extend the part concerning c-assignment? Is there perhaps some variant
> of add-to-list(), say modify-list-item(), that does just that?
>
> Thanks again,
> Per Nordlöw


Don't know. Anyway, customization seems easier then
writing new code:

M-x customize-variable align-rules-list

C-s c-assignment

Then below you see the regexp-string, which matters.

[^-=!^&*+<>/| 	
]\(\s-*[-=!^&*+<>/|]*\)=\(\s-*\)\([^= 	
]\|$\)


In the middle a single, not parentised `=' - the char taken for indentation.

Simply extend expression here, replace `=' by `[{(=]' -
a group of signes. (Or any others you want indentation
work on...)

Then still two switches AFAIR.

Just below:

Set first attributes Value Menu to "Repeat:"

And again below `Bolean' to "on".

So it works for me.



Andreas Röhler 

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

* Re: Extending Alignment in C/C++ expressions (align.el)
       [not found]     ` <mailman.713.1189529369.18990.help-gnu-emacs@gnu.org>
@ 2007-09-11 20:23       ` Nordlöw
  0 siblings, 0 replies; 7+ messages in thread
From: Nordlöw @ 2007-09-11 20:23 UTC (permalink / raw)
  To: help-gnu-emacs

On 11 Sep, 18:51, Andreas Röhler <andreas.roeh...@online.de> wrote:
> Am Dienstag, 11. September 2007 13:14 schrieb Nordlöw:
>
>
>
> > On 10 Sep, 18:30, Tom Tromey <tro...@redhat.com> wrote:
> > > >>>>> "Nordlöw" == Nordlöw  <per.nord...@gmail.com> writes:
>
> > > Nordlöw> How can I extend the Emacs package align.el to make M-x
> > > align-entire Nordlöw> additionally align the if sub-expressions and
> > > opening curly-braces as Nordlöw> follows?:
>
> > > Perhaps try align-regexp.
>
> > > Tom
>
> > The variable `align-rules-list' is really big. How can I easily change/
> > extend the part concerning c-assignment? Is there perhaps some variant
> > of add-to-list(), say modify-list-item(), that does just that?
>
> > Thanks again,
> > Per Nordlöw
>
> Don't know. Anyway, customization seems easier then
> writing new code:
>
> M-x customize-variable align-rules-list
>
> C-s c-assignment
>
> Then below you see the regexp-string, which matters.
>
> [^-=!^&*+<>/|
> ]\(\s-*[-=!^&*+<>/|]*\)=\(\s-*\)\([^=
> ]\|$\)
>
> In the middle a single, not parentised `=' - the char taken for indentation.
>
> Simply extend expression here, replace `=' by `[{(=]' -
> a group of signes. (Or any others you want indentation
> work on...)
>
> Then still two switches AFAIR.
>
> Just below:
>
> Set first attributes Value Menu to "Repeat:"
>
> And again below `Bolean' to "on".
>
> So it works for me.
>
> Andreas Röhler

Superb! Works for me! I am in now align heaven...

Emacs developers:
However I do think that the variable align-rules-list is too big. I
think it should be divided up into smaller pieces that can be
individually customized. If I save my customization of align-rules-
list I won't be affected by other changes made to it through updates
in the Emacs CVS repository.

Thank you very much,
Nordlöw

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

end of thread, other threads:[~2007-09-11 20:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-10 12:37 Extending Alignment in C/C++ expressions (align.el) Nordlöw
2007-09-10 16:30 ` Tom Tromey
2007-09-10 20:10 ` Andreas Röhler
     [not found] ` <mailman.677.1189484458.18990.help-gnu-emacs@gnu.org>
2007-09-11 11:14   ` Nordlöw
2007-09-11 15:07     ` Tom Tromey
2007-09-11 16:51     ` Andreas Röhler
     [not found]     ` <mailman.713.1189529369.18990.help-gnu-emacs@gnu.org>
2007-09-11 20:23       ` Nordlöw

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.