emacs-devel
[Top][All Lists]
Advanced

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

Re: Assignment of misc packages for emacs


From: Kim F. Storm
Subject: Re: Assignment of misc packages for emacs
Date: 06 Jun 2002 01:10:20 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Miles Bader <address@hidden> writes:

> Richard Stallman <address@hidden> writes:
> >     Is there any reason we couldn't make it call out to lisp to do the
> >     formatting?
> > 
> > It's ok with me if someone finds it easy to do.
> 
> What do you think of the appended patch?  It moves all the formatting
> and prompting for keyboard-menus to lisp (and in the process gets rid
> of the one-line-at-a-time interface, since the lisp code just displays
> the whole menu at once).
> 

I would suggest that the key-menu-prompt function uses an abnormal
hook key-menu-format-entry-function to make it easy to provide
alternative formattings of the entries without having to deal with the
overall formatting and prompting of the key-menu (which need to be
more complex than the current implementation as Stefan has pointed
out).

Something like:

(defvar key-menu-format-entry-function nil
  "Function called to format key-menu entry.
Arguments are: EVENT PROMPT &optional BINDING TOGGLE-TYPE TOGGLE-STATE.
If nil, `key-menu-format-entry' is used.")

;; Args correspond to a menu ENTRY.
(defun key-menu-format-entry (event prompt &optional binding toggle-type 
toggle-state)
  (if (eq event (aref prompt 0))
      (format "%s%s"
              (propertize (char-to-string event)
                          'face key-menu-event-face)
              (substring prompt 1))
    (format "%s = %s"
            (propertize (char-to-string event)
                        'face key-menu-event-face)
            prompt)))

(defun key-menu-prompt (menu)
  "Display the keyboard-menu MENU, and read the user's response.
This function is appropiate for `key-menu-prompt-function', which see."
  (let* (...)
    (dolist (entry (cdr menu))
      (let* ((entry-prompt
              (apply (or key-menu-format-entry-function 'key-menu-format-entry) 
entry))
        ...


-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

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