* C++ variable declaration alignment.
@ 2012-07-18 15:16 Andrea Venturoli
2012-07-18 21:28 ` Peter
2012-07-19 20:48 ` Chris Gordon-Smith
0 siblings, 2 replies; 7+ messages in thread
From: Andrea Venturoli @ 2012-07-18 15:16 UTC (permalink / raw)
To: help-gnu-emacs
Hello.
I'm using emacs to code in C++ and I'm unhappy with how it alignes
variable declarations.
What I get is:
double a,
b;
What I'd like to get is:
double a,
b;
Is there any way to do this?
Also, suppose I have:
return a==b||
a==c||
a==d;
I'd like to get:
return a==b||
a==c||
a==d;
Is this possible too?
bye & Thanks
av.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: C++ variable declaration alignment.
2012-07-18 15:16 C++ variable declaration alignment Andrea Venturoli
@ 2012-07-18 21:28 ` Peter
2012-07-23 12:08 ` Andrea Venturoli
2012-07-19 20:48 ` Chris Gordon-Smith
1 sibling, 1 reply; 7+ messages in thread
From: Peter @ 2012-07-18 21:28 UTC (permalink / raw)
To: help-gnu-emacs
There may well be an easier answer - but I use the align.el package for any customised alignment issues. It is a great package written by John Wiegley and is a part of the Emacs distribution.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: C++ variable declaration alignment.
2012-07-18 21:28 ` Peter
@ 2012-07-23 12:08 ` Andrea Venturoli
0 siblings, 0 replies; 7+ messages in thread
From: Andrea Venturoli @ 2012-07-23 12:08 UTC (permalink / raw)
To: help-gnu-emacs
On 07/18/12 23:28, Peter wrote:
> There may well be an easier answer - but I use the align.el package for any customised alignment issues.
> It is a great package written by John Wiegley and is a part of the
Emacs distribution.
Thanks.
I tried it, but I'm not proficient with emacs lisp and found no good
documentation (at least not good for me).
Is there any howto?
bye & Thanks
av.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: C++ variable declaration alignment.
2012-07-18 15:16 C++ variable declaration alignment Andrea Venturoli
2012-07-18 21:28 ` Peter
@ 2012-07-19 20:48 ` Chris Gordon-Smith
2012-07-23 12:07 ` Andrea Venturoli
1 sibling, 1 reply; 7+ messages in thread
From: Chris Gordon-Smith @ 2012-07-19 20:48 UTC (permalink / raw)
To: help-gnu-emacs
Andrea Venturoli <ml.diespammer@netfence.it>:
> Hello.
> I'm using emacs to code in C++ and I'm unhappy with how it alignes
> variable declarations.
>
> What I get is:
>
> double a,
> b;
>
> What I'd like to get is:
> double a,
> b;
>
> Is there any way to do this?
>
>
>
> Also, suppose I have:
>
> return a==b||
> a==c||
> a==d;
>
> I'd like to get:
> return a==b||
> a==c||
> a==d;
>
> Is this possible too?
>
>
> bye & Thanks
> av.
Have you tried the various alignment options? In my .emacs I have:
;; Indentation style
(setq c-default-style "stroustrup")
But I could have had one of several others. 'gnu', 'k&r', 'bsd',
'whitesmith', 'ellemtel, 'linux'...
Chris Gordon-Smith
www.simsoup.info
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: C++ variable declaration alignment.
2012-07-19 20:48 ` Chris Gordon-Smith
@ 2012-07-23 12:07 ` Andrea Venturoli
2012-07-24 22:24 ` Chris Gordon-Smith
2012-07-26 15:50 ` Ludwig, Mark
0 siblings, 2 replies; 7+ messages in thread
From: Andrea Venturoli @ 2012-07-23 12:07 UTC (permalink / raw)
To: help-gnu-emacs
On 07/19/12 22:48, Chris Gordon-Smith wrote:
> Have you tried the various alignment options? In my .emacs I have:
> ;; Indentation style
> (setq c-default-style "stroustrup")
>
> But I could have had one of several others. 'gnu', 'k&r', 'bsd',
> 'whitesmith', 'ellemtel, 'linux'...
Yes.
Unless I'm missing something, none of them does what I asked.
Am I missing something?
bye & Thanks
av.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: C++ variable declaration alignment.
2012-07-23 12:07 ` Andrea Venturoli
@ 2012-07-24 22:24 ` Chris Gordon-Smith
2012-07-26 15:50 ` Ludwig, Mark
1 sibling, 0 replies; 7+ messages in thread
From: Chris Gordon-Smith @ 2012-07-24 22:24 UTC (permalink / raw)
To: help-gnu-emacs
Andrea Venturoli <ml.diespammer@netfence.it>:
> > But I could have had one of several others. 'gnu', 'k&r', 'bsd',
> > 'whitesmith', 'ellemtel, 'linux'...
>
> Yes.
> Unless I'm missing something, none of them does what I asked.
> Am I missing something?
>
You're probably not missing anything. I just wondered whether you had
tried all the available options.
My approach was to look at all the supported indentation schemes and
decide which I liked best. Out of these, I preferred stroustrup. I
didn't feel strongly enough about it to think I needed to find or
invent another.
Best Regards
CHris Gordon-Smith
www.simsoup.info
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: C++ variable declaration alignment.
2012-07-23 12:07 ` Andrea Venturoli
2012-07-24 22:24 ` Chris Gordon-Smith
@ 2012-07-26 15:50 ` Ludwig, Mark
1 sibling, 0 replies; 7+ messages in thread
From: Ludwig, Mark @ 2012-07-26 15:50 UTC (permalink / raw)
To: Andrea Venturoli, help-gnu-emacs@gnu.org
> From: Andrea Venturoli
> Sent: Monday, July 23, 2012 7:08 AM
> To: help-gnu-emacs@gnu.org
> Subject: Re: C++ variable declaration alignment.
>
> On 07/19/12 22:48, Chris Gordon-Smith wrote:
> > Have you tried the various alignment options? In my .emacs I have:
> > ;; Indentation style
> > (setq c-default-style "stroustrup")
> >
> > But I could have had one of several others. 'gnu', 'k&r', 'bsd',
> > 'whitesmith', 'ellemtel, 'linux'...
>
> Yes.
> Unless I'm missing something, none of them does what I asked.
> Am I missing something?
I had a need to make Emacs align C, C++, and Java code the way the rest of the organization was aligning by hand (with spaces in vi and other editors). The way I got it to do what I wanted was to create my own "style" -- and that requires writing a small amount of Emacs Lisp....
Cheers,
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-07-26 15:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-18 15:16 C++ variable declaration alignment Andrea Venturoli
2012-07-18 21:28 ` Peter
2012-07-23 12:08 ` Andrea Venturoli
2012-07-19 20:48 ` Chris Gordon-Smith
2012-07-23 12:07 ` Andrea Venturoli
2012-07-24 22:24 ` Chris Gordon-Smith
2012-07-26 15:50 ` Ludwig, Mark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).