[Top][All Lists]

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

Re: bypassing defining prefix keys

From: Richard Stallman
Subject: Re: bypassing defining prefix keys
Date: Mon, 05 Feb 2007 14:10:07 -0500

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

Actually this DOES define them as prefix keys; this is a valid way to
do so.  The other method is to define it as a symbol and give the
symbol the submap as a function definition.

It seems your completion command works with one method of doing so and
not with the other.  But it could handle both.

     ;; 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?

I think it is this: with a symbol in the way, `copy-keymap' won't copy
that symbol (since an interned symbol is unique), nor whatever map it
points to.  With no symbol, it will recursively copy the submap.

Why it should be relevant here, I am not sure.  Maybe some other mode does
(or did) `copy-keymap' on `dired-mode-map'.

reply via email to

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