[Top][All Lists]

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

C-x C-q and undo [was: Bind `q' to `quit-window' or similar in *Messages

From: Drew Adams
Subject: C-x C-q and undo [was: Bind `q' to `quit-window' or similar in *Messages*]
Date: Thu, 4 Feb 2010 08:58:00 -0800

> I've often felt that C-x C-q should turn on the undo-log when
> making a buffer writeable.  It hasn't bothered me enough to actually
> code it up and try it, but maybe people could try it out and see if it
> leads to problems.

I was wondering the same thing.
But maybe the two should not always be coupled.

It's easy enough to enable undo, with command `buffer-enable-undo'. Of course,
that's not bound to a key, by default. (Likewise, disabling.)

The prefix arg for `C-x C-q' is used only to specify on or off explicitly. One
possibility would be to have plain `C-u' toggle read-only and call
`buffer-enable-undo' or `buffer-disable-undo' as appropriate. So:

C-1 C-x C-q would turn read-only ON (and not affect undo)
C-  C-x C-q would turn read-only OFF   "   "   "   "
C-u C-x C-q would toggle read-only and turn undo on/off accordingly

Even more flexible: We could have an option, `toggle-read-only-affects-undo'. If
non-nil, then `C-x C-q' without `C-u' would affect undo; with `C-u' it would not
affect undo. If nil, the behavior would be reversed: without `C-u' would not
affect undo; with `C-u' it would affect undo.

reply via email to

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