help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [OT Personal Memory failure] Can someone remind me how toformatcode


From: Drew Adams
Subject: RE: [OT Personal Memory failure] Can someone remind me how toformatcode
Date: Sat, 20 Oct 2007 19:41:40 -0700

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]