From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel 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 Message-ID: <0122CC6B2F0146488E31D2B40610507E@us.oracle.com> References: <874olx8yz7.fsf@regnitz.physics.niu.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1265303215 5329 80.91.229.12 (4 Feb 2010 17:06:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Feb 2010 17:06:55 +0000 (UTC) Cc: 'Stefan Monnier' To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 04 18:06:50 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nd5A8-0001O8-Js for ged-emacs-devel@m.gmane.org; Thu, 04 Feb 2010 18:06:41 +0100 Original-Received: from localhost ([127.0.0.1]:33063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nd54E-0006u1-EJ for ged-emacs-devel@m.gmane.org; Thu, 04 Feb 2010 12:00:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nd53Y-0006Q8-D8 for emacs-devel@gnu.org; Thu, 04 Feb 2010 11:59:52 -0500 Original-Received: from [199.232.76.173] (port=37118 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nd53X-0006PR-Ph for emacs-devel@gnu.org; Thu, 04 Feb 2010 11:59:51 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nd53W-0005Vz-Vw for emacs-devel@gnu.org; Thu, 04 Feb 2010 11:59:51 -0500 Original-Received: from rcsinet11.oracle.com ([148.87.113.123]:39502) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nd53W-0005Vn-KH for emacs-devel@gnu.org; Thu, 04 Feb 2010 11:59:50 -0500 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet11.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o14Gxk7b030457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Feb 2010 16:59:48 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o144YcWl012704; Thu, 4 Feb 2010 16:59:45 GMT Original-Received: from abhmt001.oracle.com by acsmt355.oracle.com with ESMTP id 11436421265302685; Thu, 04 Feb 2010 08:58:05 -0800 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 04 Feb 2010 08:58:04 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acqlr5a4bW5u95SGQeaEM515Eer+3QACPCeg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090202.4B6AFD02.00B5:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:120909 Archived-At: > 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.