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: RE: TAB for non-editing modes Date: Sat, 22 Sep 2007 12:01:08 -0700 Message-ID: References: <200709221635.l8MGZUdZ007370@oogie-boogie.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1190487781 28059 80.91.229.12 (22 Sep 2007 19:03:01 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Sep 2007 19:03:01 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 22 21:02:55 2007 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.50) id 1IZAFh-00067x-Vl for ged-emacs-devel@m.gmane.org; Sat, 22 Sep 2007 21:02:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZAFf-0004Kh-Nz for ged-emacs-devel@m.gmane.org; Sat, 22 Sep 2007 15:02:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IZAFX-0004D0-8L for emacs-devel@gnu.org; Sat, 22 Sep 2007 15:02:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IZAFW-0004CI-H6 for emacs-devel@gnu.org; Sat, 22 Sep 2007 15:02:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IZAFW-0004C7-B9 for emacs-devel@gnu.org; Sat, 22 Sep 2007 15:02:42 -0400 Original-Received: from agminet01.oracle.com ([141.146.126.228]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IZAFV-000607-Ny for emacs-devel@gnu.org; Sat, 22 Sep 2007 15:02:41 -0400 Original-Received: from agmgw1.us.oracle.com (agmgw1.us.oracle.com [152.68.180.212]) by agminet01.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l8MJ2c2r005201 for ; Sat, 22 Sep 2007 14:02:38 -0500 Original-Received: from acsmt351.oracle.com (acsmt351.oracle.com [141.146.40.151]) by agmgw1.us.oracle.com (Switch-3.2.0/Switch-3.2.0) with ESMTP id l8MIG8WV024013 for ; Sat, 22 Sep 2007 13:02:38 -0600 Original-Received: from dhcp-amer-whq-csvpn-gw3-141-144-80-168.vpn.oracle.com by acsmt351.oracle.com with ESMTP id 3237136381190487652; Sat, 22 Sep 2007 12:00:52 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-reply-to: <200709221635.l8MGZUdZ007370@oogie-boogie.ics.uci.edu> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-Detected-Kernel: Linux 2.4-2.6 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:79521 Archived-At: > > TAB does not do anything for pcvs, dired, log-view and maybe others > > It would be nice if TAB would do something for these modes too. > > > > It seems harmless to add that functionality in modes that are > > read-only and have distinguishable links. I don't see that this > > is very useful in Dired, though. > > Why not? I'd rather have TAB run dired-next-line instead of throwing > an error "Buffer is read-only" as it does now. That is truly a waste of a key binding, IMO. `n' does that already. I have nothing against giving `TAB' a useful binding in Dired, but there is no sense duplicating `n' for that. If no truly useful Dired binding for `TAB' can be found now, then let's leave it alone - something will come up eventually. The problem with binding it now to something that is not particularly useful is that that binding can become cast in stone, a sacred cow that is later defended against replacing with a truly useful binding. If we don't bind `TAB' in Dired to something useful now, we might consider unbinding it there, more precisely, binding it to `undefined'. It is silly for `TAB' to invoke `indent-for-tab-command' in Dired. Generalizing this (note: a topic change) - Similarly for other bindings that invoke commands that modify the buffer - why not bind them to `undefined'? I do that in read-only buffers such as *Buffer List*. Besides preventing the read-only error message, it prevents users from thinking that a key sequence might be unavailable for their own use. I made this suggestion on 2004-10-17 in thread "bind buffer-modifying keys to `undefined' in buffers where nomodification should occur?". Kim suggested perhaps using `ignore' instead of `undefined', but he pointed out some problems with `C-h b' for `ignore'. RMS said he didn't want to make such a change then, because the release of Emacs 22 was imminent (;-)). Perhaps this or something similar could be reconsidered now. FWIW, I do this rather primitively, by just having a list of buffer-modifying commands and then binding them to `undefined'. Perhaps a better mechanism could be devised. Here is the code I use. As you can see, I neglected to include `indent-for-tab-command', and there are no doubt other buffer-modifying commands that might be included. (defun undefine-keys-bound-to (command keymap &optional oldmap) "Bind to `undefined' all keys currently bound to COMMAND in KEYMAP. If optional argument OLDMAP is specified, rebinds in KEYMAP as `undefined' all keys that are currently bound to COMMAND in OLDMAP but are not bound in KEYMAP." (unless (where-is-internal command keymap 'first-only) (substitute-key-definition command 'undefined keymap oldmap))) (defcustom buffer-modifying-cmds '(delete-char quoted-insert transpose-chars kill-region yank kill-word indent-new-comment-line kill-sentence fill-paragraph transpose-words yank-pop zap-to-char just-one-space indent-for-comment delete-indentation kill-sexp split-line transpose-sexps backward-kill-sentence) "*Buffer-modifying commands used in `undefine-killer-commands'." :type '(repeat symbol)) (defun undefine-killer-commands (keymap &optional oldmap) "Bind `undefined' to KEYMAP keys bound to buffer-modifying commands. If optional arg OLDMAP is specified, rebinds in KEYMAP as `undefined' the keys that are currently bound to buffer-modifying commands in OLDMAP but are not bound in KEYMAP. The buffer-modifying commands used: `buffer-modifying-cmds'." (mapcar (lambda (cmd) (undefine-keys-bound-to cmd keymap oldmap)) buffer-modifying-cmds)) A typical use: (undefine-killer-commands Buffer-menu-mode-map (current-global-map))