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: bypassing defining prefix keys Date: Sun, 4 Feb 2007 11:58:33 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1170619193 16508 80.91.229.12 (4 Feb 2007 19:59:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 4 Feb 2007 19:59:53 +0000 (UTC) To: "Emacs-Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 04 20:59:43 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 1HDnWX-0006GG-Jt for ged-emacs-devel@m.gmane.org; Sun, 04 Feb 2007 20:59:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDnWZ-0005wp-0L for ged-emacs-devel@m.gmane.org; Sun, 04 Feb 2007 14:59:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HDnWO-0005wg-1f for emacs-devel@gnu.org; Sun, 04 Feb 2007 14:59:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HDnWL-0005wU-LZ for emacs-devel@gnu.org; Sun, 04 Feb 2007 14:59:30 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HDnWL-0005wR-DU for emacs-devel@gnu.org; Sun, 04 Feb 2007 14:59:29 -0500 Original-Received: from rgminet01.oracle.com ([148.87.113.118]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1HDnWK-0005nu-SM for emacs-devel@gnu.org; Sun, 04 Feb 2007 14:59:29 -0500 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.186.111]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id l14JxQP3026481 for ; Sun, 4 Feb 2007 12:59:26 -0700 Original-Received: from rcsmt251.oracle.com (rcsmt251.oracle.com [148.87.90.196]) by rgmgw2.us.oracle.com (Switch-3.2.4/Switch-3.1.7) with ESMTP id l14JrMV0007971 for ; Sun, 4 Feb 2007 12:59:26 -0700 Original-Received: from dhcp-amer-csvpn-gw1-141-144-65-58.vpn.oracle.com by rcsmt250.oracle.com with ESMTP id 2420015471170619125; Sun, 04 Feb 2007 12:58:45 -0700 X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-Whitelist: TRUE X-Whitelist: TRUE X-Brightmail-Tracker: AAAAAQAAAAI= 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:65861 Archived-At: Perhaps this is a bug report; perhaps it is a request for info. I see a behavior that I don't much like, but I don't know if that behavior might be desirable for some other reason. I have code that binds `S-tab' in all keymaps to a command that completes key sequences. Then, for instance, you can use `C-x S-tab' to complete `C-x' to anything in keymap `ctl-x-map'. Or you can use `f1 S-tab' to do more or less what `f1 f1' does: show the `f1' bindings and their commands, and let you invoke one - you can think of my key-completion feature as generalizing what `f1 f1' does for help. You can also use `S-tab' at the top level, to "complete" to any key. So, for instance, as an alternative to using `C-x S-tab', you can use `S-tab' and then pick the completion candidate `C-x'. This shows the possible completions of `C-x', just as `C-x S-tab' does. This works fine, for all prefix keys. However, it does not work for, say, `* S-tab' in Dired mode, because `*' is not actually defined as a prefix key there. The same problem exists for `%'. You can still use `S-tab' at the top level of Dired, then pick `*' from the list of *Completions* (which, in turn, shows the possible completions of `*'), and then pick, say, `/' to invoke `dired-mark-directories'. But if you use `* S-tab' then you get the error message "* is undefined". Here's why. In dired.el, instead of defining `*' and `%' as prefix keys, a shortcut is taken. `*' and `%' are each bound to nil, so that they are undefined in `dired-mode-map', and then each of the `*-' and `%- key sequences is bound directly in `dired-mode-map'. That is: (define-key dired-mode-map "*" nil) (define-key dired-mode-map "*/" 'dired-mark-directories) ... This explains the behavior I get, but I wonder if `*' and `%' should be defined this way. Is there a guideline or policy on this? Obviously, it would be better for my key-completion code if `*' and `%' were defined as real prefix keys. This comment appears in dired.el as the rationale for the current implementation of `%'. Presumably it is meant for `*' as well. ;; Make all regexp commands share a `%' prefix: ;; We used to get to the submap via a symbol dired-regexp-prefix, ;; but that seems to serve little purpose, and copy-keymap ;; does a better job without it. I don't understand the part about `copy-keymap' (which is not used in dired.el, in any case). What is the `copy-keymap' limitation that is hinted at here? Is it important that the Dired code avoid defining prefix keys this way? Can someone speak to whether this is still the best way for dired.el to define the `*' and `%' pseudo prefix keys? If it's not the best way, can we please use real prefix keys? Thx.