unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* M-x indent-region
@ 2003-05-05  0:36 Sanford Selznick
  2003-05-05  6:12 ` Kai Großjohann
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sanford Selznick @ 2003-05-05  0:36 UTC (permalink / raw)


In emacs, 'M-x indent-region' is the best indent I've ever seen.

How can I trigger this action from the command-line and have emacs 
indent an individual file?

Thank you,
  Sanford

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

* Re: M-x indent-region
  2003-05-05  0:36 M-x indent-region Sanford Selznick
@ 2003-05-05  6:12 ` Kai Großjohann
  2003-05-05  8:03 ` Alfred M. Szmidt
       [not found] ` <mailman.5568.1052122245.21513.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Kai Großjohann @ 2003-05-05  6:12 UTC (permalink / raw)


Sanford Selznick <see-message@for.real.address.com> writes:

> In emacs, 'M-x indent-region' is the best indent I've ever seen.
>
> How can I trigger this action from the command-line and have emacs 
> indent an individual file?

Maybe something like this.

emacs -batch --eval '(find-file "foo)' \
             --eval '(indent-region (point-min) (point-max))' 
             -f save-buffer -f save-buffers-kill-emacs

But I haven't tested it.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

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

* Re: M-x indent-region
  2003-05-05  0:36 M-x indent-region Sanford Selznick
  2003-05-05  6:12 ` Kai Großjohann
@ 2003-05-05  8:03 ` Alfred M. Szmidt
       [not found] ` <mailman.5568.1052122245.21513.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Alfred M. Szmidt @ 2003-05-05  8:03 UTC (permalink / raw)
  Cc: help-gnu-emacs

   In emacs, 'M-x indent-region' is the best indent I've ever seen.

   How can I trigger this action from the command-line and have emacs
   indent an individual file?

Whats wrong with just using GNU indent?  They should do the same
thing.

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

* Re: M-x indent-region
       [not found] ` <mailman.5568.1052122245.21513.help-gnu-emacs@gnu.org>
@ 2003-05-05 17:14   ` Sanford Selznick
  2003-05-05 18:49     ` Kai Großjohann
  0 siblings, 1 reply; 8+ messages in thread
From: Sanford Selznick @ 2003-05-05 17:14 UTC (permalink / raw)


In article <mailman.5568.1052122245.21513.help-gnu-emacs@gnu.org>,
 "Alfred M. Szmidt" <ams@kemisten.nu> wrote:
>    In emacs, 'M-x indent-region' is the best indent I've ever seen.
> 
>    How can I trigger this action from the command-line and have emacs
>    indent an individual file?
> 
> Whats wrong with just using GNU indent?  They should do the same
> thing.

Well, for starters, it doesn't indent C++.  ;-)  Beyond that, it's more 
of a reformatter than a pure indenter, like emacs.  The emacs indent 
doesn't change the line number of any given token... all it does is 
change the indent of a given line.

Best,
  Sanford


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

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

* Re: M-x indent-region
  2003-05-05 17:14   ` Sanford Selznick
@ 2003-05-05 18:49     ` Kai Großjohann
  2003-05-05 22:38       ` Sanford Selznick
  0 siblings, 1 reply; 8+ messages in thread
From: Kai Großjohann @ 2003-05-05 18:49 UTC (permalink / raw)


Sanford Selznick <see-message@for.real.address.com> writes:

> Well, for starters, it doesn't indent C++.  ;-)  Beyond that, it's more 
> of a reformatter than a pure indenter, like emacs.  The emacs indent 
> doesn't change the line number of any given token... all it does is 
> change the indent of a given line.

I'm sure you can tell GNU indent to abstain from adding or removing
newlines.  But then, I haven't used it.

-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

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

* Re: M-x indent-region
  2003-05-05 18:49     ` Kai Großjohann
@ 2003-05-05 22:38       ` Sanford Selznick
  2003-05-06 16:45         ` Kai Großjohann
  0 siblings, 1 reply; 8+ messages in thread
From: Sanford Selznick @ 2003-05-05 22:38 UTC (permalink / raw)


In article <84k7d5kz3h.fsf@lucy.is.informatik.uni-duisburg.de>,
 kai.grossjohann@gmx.net (Kai Grossjohann) wrote:

> Sanford Selznick <see-message@for.real.address.com> writes:
> 
> > Well, for starters, it doesn't indent C++.  ;-)  Beyond that, it's more 
> > of a reformatter than a pure indenter, like emacs.  The emacs indent 
> > doesn't change the line number of any given token... all it does is 
> > change the indent of a given line.
> 
> I'm sure you can tell GNU indent to abstain from adding or removing
> newlines.  But then, I haven't used it.

Then maybe you should try it and you'll know for sure.  ;-)

I got your previous suggestion is working.  Thank you!

Best,
  Sanford


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

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

* Re: M-x indent-region
  2003-05-05 22:38       ` Sanford Selznick
@ 2003-05-06 16:45         ` Kai Großjohann
  2003-05-07  3:47           ` Sanford Selznick
  0 siblings, 1 reply; 8+ messages in thread
From: Kai Großjohann @ 2003-05-06 16:45 UTC (permalink / raw)


Sanford Selznick <see-message@for.real.address.com> writes:

> Then maybe you should try it and you'll know for sure.  ;-)

Yeah.  Maybe it helps to set a really long max line length, and to
tell it to honor existing newlines.

But so far I've still only read the documentation, not tested it.
It's not important enough for me...
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)

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

* Re: M-x indent-region
  2003-05-06 16:45         ` Kai Großjohann
@ 2003-05-07  3:47           ` Sanford Selznick
  0 siblings, 0 replies; 8+ messages in thread
From: Sanford Selznick @ 2003-05-07  3:47 UTC (permalink / raw)


In article <84el3cuiqd.fsf@lucy.is.informatik.uni-duisburg.de>,
 kai.grossjohann@gmx.net (Kai Grossjohann) wrote:
> Yeah.  Maybe it helps to set a really long max line length, and to
> tell it to honor existing newlines.
> 
> But so far I've still only read the documentation, not tested it.
> It's not important enough for me...

Obviously.  ;-)

Here's how the final version ended up...

emacs -batch -eval '(find-file "~/test")' -eval '(c-mode)' -eval 
'(indent-region (point-min) (point-max) nil)' -eval '(save-buffer)' 
-eval '(kill-buffer (current-buffer))'

Where '~/test' is the file that will be wrapped in place, keeping all 
tokens on the line they started on.  Note the '(c-mode)' in case the 
file doesn't end in a c-program extension.  And note the third argument 
on indent-region, which I'm not entirely sure is necessary or not.  But 
it's working fine.

Thanks again for your help.

-Sanford

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

end of thread, other threads:[~2003-05-07  3:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-05  0:36 M-x indent-region Sanford Selznick
2003-05-05  6:12 ` Kai Großjohann
2003-05-05  8:03 ` Alfred M. Szmidt
     [not found] ` <mailman.5568.1052122245.21513.help-gnu-emacs@gnu.org>
2003-05-05 17:14   ` Sanford Selznick
2003-05-05 18:49     ` Kai Großjohann
2003-05-05 22:38       ` Sanford Selznick
2003-05-06 16:45         ` Kai Großjohann
2003-05-07  3:47           ` Sanford Selznick

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).