unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [OT Personal Memory failure] Can someone remind me how to format code
@ 2007-10-21  0:52 reader
  2007-10-21  2:04 ` [OT Personal Memory failure] Can someone remind me how to formatcode Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: reader @ 2007-10-21  0:52 UTC (permalink / raw)
  To: help-gnu-emacs

I know there is a keyboard command in emacs that will format a region
of some common kinds of code such as shell script, emacs lisp, perl
etc.

I recall having marked out a region then using some keyboard combo to
format it.

M-x apropos RET format RET   gives far to many confusion hits to find
what I want.

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

* RE: [OT Personal Memory failure] Can someone remind me how to formatcode
  2007-10-21  0:52 [OT Personal Memory failure] Can someone remind me how to format code reader
@ 2007-10-21  2:04 ` Drew Adams
  2007-10-21  2:25   ` reader
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2007-10-21  2:04 UTC (permalink / raw)
  To: reader, help-gnu-emacs

> I know there is a keyboard command in emacs that will format a region
> of some common kinds of code such as shell script, emacs lisp, perl
> etc.
> I recall having marked out a region then using some keyboard combo to
> format it.
>
> M-x apropos RET format RET   gives far to many confusion hits to find
> what I want.

If by "format" you mean reindent in a conventional way, then try `C-M-q'
with the cursor at the beginning of a code section (e.g. defun in Lisp).

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

* Re: [OT Personal Memory failure] Can someone remind me how to formatcode
  2007-10-21  2:04 ` [OT Personal Memory failure] Can someone remind me how to formatcode Drew Adams
@ 2007-10-21  2:25   ` reader
  2007-10-21  2:41     ` [OT Personal Memory failure] Can someone remind me how toformatcode Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: reader @ 2007-10-21  2:25 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

>> I know there is a keyboard command in emacs that will format a region
>> of some common kinds of code such as shell script, emacs lisp, perl
>> etc.
>> I recall having marked out a region then using some keyboard combo to
>> format it.
>>
>> M-x apropos RET format RET   gives far to many confusion hits to find
>> what I want.
>
> If by "format" you mean reindent in a conventional way, then try `C-M-q'
> with the cursor at the beginning of a code section (e.g. defun in Lisp).

Thanks but having some trouble with that.

That does not appear for me under C-h b and search for C-M-q.  What is
that command called?

C-h-c  doesn't know about it here either.

When I just use the keys you mention it gets confused with a call to
KDE and brings up the KDE control application.

Going to a text console and trying C-M-q while editing a shell script
say C-M-q is not defined.

Trying M-x reindent<spc><spc> etc  appears to bring the wrong thing as
well.  `reindent-then-newline-and-indent'

Version:
GNU Emacs 22.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.10.7) of
2007-06-24 on reader

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

* RE: [OT Personal Memory failure] Can someone remind me how toformatcode
  2007-10-21  2:25   ` reader
@ 2007-10-21  2:41     ` Drew Adams
  2007-10-21 14:57       ` reader
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2007-10-21  2:41 UTC (permalink / raw)
  To: reader, help-gnu-emacs

> >> I know there is a keyboard command in emacs that will format a region
> >> of some common kinds of code such as shell script, emacs lisp, perl
> >> etc.
> >> I recall having marked out a region then using some keyboard combo to
> >> format it.
> >> M-x apropos RET format RET   gives far to many confusion hits to find
> >> what I want.
> >
> > If by "format" you mean reindent in a conventional way, then try `C-M-q'
> > with the cursor at the beginning of a code section (e.g. defun in Lisp).
>
> Thanks but having some trouble with that.
> That does not appear for me under C-h b and search for C-M-q.  What is
> that command called?
> C-h-c  doesn't know about it here either.

It's probably not bound (and probably not defined) for the mode you are in.
In Emacs-Lisp mode, it is bound to command `indent-sexp'. In c-mode and
java-mode, it is bound to `c-indent-exp'. In fortran-mode, it is bound to
`fortran-indent-subprogram'. If `C-h c' or `C-h k' says that it is not
bound, then you're probably out of luck for the mode you're in -
shell-script-mode, for instance.

> When I just use the keys you mention it gets confused with a call to
> KDE and brings up the KDE control application.

It sounds like your window manager is grabbing that key combination before
Emacs sees it. Someone else will have to help you with that; I know nothing
about it.

> Going to a text console and trying C-M-q while editing a shell script
> say C-M-q is not defined.
>
> Trying M-x reindent<spc><spc> etc  appears to bring the wrong thing as
> well.  `reindent-then-newline-and-indent'
>
> Version:
> GNU Emacs 22.1.50.1 (i686-pc-linux-gnu, GTK+ Version 2.10.7) of
> 2007-06-24 on reader

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

* Re: [OT Personal Memory failure] Can someone remind me how toformatcode
  2007-10-21  2:41     ` [OT Personal Memory failure] Can someone remind me how toformatcode Drew Adams
@ 2007-10-21 14:57       ` reader
  0 siblings, 0 replies; 5+ messages in thread
From: reader @ 2007-10-21 14:57 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

> It's probably not bound (and probably not defined) for the mode you are in.

Thanks again... I finally dredged up the command I was after by
searching thru old notes I've kept in more detail this time.

C-M-\  `indent-region'

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

end of thread, other threads:[~2007-10-21 14:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-21  0:52 [OT Personal Memory failure] Can someone remind me how to format code reader
2007-10-21  2:04 ` [OT Personal Memory failure] Can someone remind me how to formatcode Drew Adams
2007-10-21  2:25   ` reader
2007-10-21  2:41     ` [OT Personal Memory failure] Can someone remind me how toformatcode Drew Adams
2007-10-21 14:57       ` reader

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