[Top][All Lists]

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

Re: substitute-key-definition problem with menus in Emacs 21

From: Stefan
Subject: Re: substitute-key-definition problem with menus in Emacs 21
Date: Sun, 10 Oct 2004 13:07:22 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin)

> Do these replacement functions do the job?

Shouldn't substitute-key-definition use `where-is-internal' ?
I do see a problem, tho: once we know

   ELISP> (where-is-internal 'find-file global-map nil nil 'noremap)
   ([open] [24 6] [menu-bar files open-file])

there is no easy way to get at the menu-item to copy&modify it:

   ELISP> (lookup-key global-map [menu-bar files open-file])

So we'd need to add a `noindirect' argument to lookup-key, which sounds like
a useful change anyway.

In any case, isn't your definition of substitute-key-definition equivalent to:

(defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
  (or prefix (setq prefix ""))
  (let* ((scan (or oldmap keymap))
         (prefix1 (vconcat prefix [nil]))
          (cons scan key-substitution-in-progress)))
    ;; Scan OLDMAP, finding each char or event-symbol that
    ;; has any definition, and act on it with hack-key.
     (lambda (char defn)
       (aset prefix1 (length prefix) char)
       (substitute-key-definition-key defn olddef newdef prefix1 keymap))

-- Stefan

reply via email to

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