unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Indenting code: C-M-\ v C-x C-q
@ 2003-11-11 19:34 Siegfried Heintze
  2003-11-11 20:26 ` Stephen H. Westin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Siegfried Heintze @ 2003-11-11 19:34 UTC (permalink / raw)


I accidently pasted an extra end brace in the middle of 3K lines of perl
code and spent 4 hours trying to find it! The first thing I did was try C-x
C-q to get it to indent my code so I could find the mismatching end brace.
This did not work!

Using C-x C-q works great for Java and other "Normal" languages that use
apostrophies and quotes for string literals but since perl allows me to use
qq[]  and qq|| for string literals I was not terribly surprised when C-x C-q
did not work for my perl code!  I figured that no one had gotten around to
accommodating the wierd syntax Perl allows for string literals.

I just I happend to be poking around the www.Xemacs.com and noticed
something about indenting perl code with C-M-\ and discovered it works great
for indenting perl code in regular emacs too!

Oh -- the time I could have saved if I had known this!  Why are there two
keys to do the same thing? Why do perl and elisp require C-M-\ and
everything else require C-x C-q? emacs drives me crazy sometimes.

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

* Re: Indenting code: C-M-\ v C-x C-q
  2003-11-11 19:34 Indenting code: C-M-\ v C-x C-q Siegfried Heintze
@ 2003-11-11 20:26 ` Stephen H. Westin
  2003-11-11 21:44 ` Thien-Thi Nguyen
  2003-11-11 23:03 ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen H. Westin @ 2003-11-11 20:26 UTC (permalink / raw)


"Siegfried Heintze" <siegfried@heintze.com> writes:

<snip>

> I just I happend to be poking around the www.Xemacs.com and noticed
> something about indenting perl code with C-M-\ and discovered it works great
> for indenting perl code in regular emacs too!
> 
> Oh -- the time I could have saved if I had known this!  Why are there two
> keys to do the same thing?

They don't. C-x C-q does a paragraph fill. With text, this means that
it takes the current paragraph (all the text surrounding the point and
between blank lines), treats it as a single line, then divides into
lines no wider than the fill column. C-M-\ indents programming code
within the currently selected region, without changing line breaks.

If writers of java-mode and such added auto indenting to "fill-paragraph",
I guess that's a nice extra feature.

<snip>

-- 
-Stephen H. Westin
Any information or opinions in this message are mine: they do not
represent the position of Cornell University or any of its sponsors.

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

* Re: Indenting code: C-M-\ v C-x C-q
  2003-11-11 19:34 Indenting code: C-M-\ v C-x C-q Siegfried Heintze
  2003-11-11 20:26 ` Stephen H. Westin
@ 2003-11-11 21:44 ` Thien-Thi Nguyen
  2003-11-11 23:03 ` Stefan Monnier
  2 siblings, 0 replies; 7+ messages in thread
From: Thien-Thi Nguyen @ 2003-11-11 21:44 UTC (permalink / raw)


"Siegfried Heintze" <siegfried@heintze.com> writes:

> Why are there two
> keys to do the same thing?

because you see two keys.  perhaps there are others you don't
see (that do the same thing).  what this means is that finding
the thing is the reward, but keys are simply keys, names are
simply names, fashion is simply fashion.  go to the root.

> Why do perl and elisp require C-M-\ and
> everything else require C-x C-q? emacs drives me crazy sometimes.

see "fashion".

thi

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

* Re: Indenting code: C-M-\ v C-x C-q
  2003-11-11 19:34 Indenting code: C-M-\ v C-x C-q Siegfried Heintze
  2003-11-11 20:26 ` Stephen H. Westin
  2003-11-11 21:44 ` Thien-Thi Nguyen
@ 2003-11-11 23:03 ` Stefan Monnier
  2003-11-14 21:06   ` Ole Laursen
  2 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2003-11-11 23:03 UTC (permalink / raw)


> Using C-x C-q works great for Java and other "Normal" languages that use

I don't know what config you're using but C-x C-q by default is just
a way to toggle the read-only bit of the buffer (i.e. to make it
read-only or writable).

You must be talking about something else like M-q (fill-paragraph) or
C-c C-q (which has no default binding and is left for major modes
to do as they please).
C-M-\ works in all modes (except for bugs, of course).


        Stefan

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

* Re: Indenting code: C-M-\ v C-x C-q
  2003-11-11 23:03 ` Stefan Monnier
@ 2003-11-14 21:06   ` Ole Laursen
  2003-11-14 21:14     ` Ole Laursen
  0 siblings, 1 reply; 7+ messages in thread
From: Ole Laursen @ 2003-11-14 21:06 UTC (permalink / raw)


Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > Using C-x C-q works great for Java and other "Normal" languages that use

[...]

> You must be talking about something else like M-q (fill-paragraph) or
> C-c C-q (which has no default binding and is left for major modes
> to do as they please).
> C-M-\ works in all modes (except for bugs, of course).

One of them being that it is almost impossible to type on some
keyboards. On a Danish keyboard, it requires 'Alt + Ctrl + Alt gr + >'.
Argh. On most keyboards I encounter, this sequence does not even work
because three modifier keys block the keyboard.

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/

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

* Re: Indenting code: C-M-\ v C-x C-q
  2003-11-14 21:06   ` Ole Laursen
@ 2003-11-14 21:14     ` Ole Laursen
  2003-11-14 21:55       ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Ole Laursen @ 2003-11-14 21:14 UTC (permalink / raw)


Ole Laursen <olau@hardworking.dk> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
> > > Using C-x C-q works great for Java and other "Normal" languages that use
> 
> [...]
> 
> > You must be talking about something else like M-q (fill-paragraph) or
> > C-c C-q (which has no default binding and is left for major modes
> > to do as they please).
> > C-M-\ works in all modes (except for bugs, of course).
> 
> One of them being that it is almost impossible to type on some
> keyboards. On a Danish keyboard, it requires 'Alt + Ctrl + Alt gr + >'.
> Argh. On most keyboards I encounter, this sequence does not even work
> because three modifier keys block the keyboard.

Of course, replacing the first 'Alt' with 'Esc' makes it work, but
that's just to cumbersome to be practical at all.

-- 
Ole Laursen
http://www.cs.auc.dk/~olau/

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

* Re: Indenting code: C-M-\ v C-x C-q
  2003-11-14 21:14     ` Ole Laursen
@ 2003-11-14 21:55       ` Stefan Monnier
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2003-11-14 21:55 UTC (permalink / raw)


>> One of them being that it is almost impossible to type on some
>> keyboards. On a Danish keyboard, it requires 'Alt + Ctrl + Alt gr + >'.
>> Argh. On most keyboards I encounter, this sequence does not even work
>> because three modifier keys block the keyboard.

> Of course, replacing the first 'Alt' with 'Esc' makes it work, but
> that's just to cumbersome to be practical at all.

Of course, nothing prevents you from rebinding it to some other key.


        Stefan

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

end of thread, other threads:[~2003-11-14 21:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-11 19:34 Indenting code: C-M-\ v C-x C-q Siegfried Heintze
2003-11-11 20:26 ` Stephen H. Westin
2003-11-11 21:44 ` Thien-Thi Nguyen
2003-11-11 23:03 ` Stefan Monnier
2003-11-14 21:06   ` Ole Laursen
2003-11-14 21:14     ` Ole Laursen
2003-11-14 21:55       ` Stefan Monnier

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