Mercurial > hg > xemacs-beta
changeset 5208:9fa29ec759e3
Implement suggest-key-bindings in terms of teach-extended-commands-p
2010-04-29 Aidan Kehoe <kehoea@parhasard.net>
* cmdloop.el (suggest-key-bindings):
Make this available, documenting that it's for GNU Emacs
compatibility.
Implement it in terms of teach-extended-commands-p and
teach-extended-commands-timeout, using Ben's
set-symbol-value-handler functionality.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 29 Apr 2010 16:16:47 +0100 |
parents | 1096ef427b56 |
children | 23f00bfd78a4 cdca98f2d36f |
files | lisp/ChangeLog lisp/cmdloop.el lisp/obsolete.el |
diffstat | 3 files changed, 36 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Apr 29 15:49:21 2010 +0100 +++ b/lisp/ChangeLog Thu Apr 29 16:16:47 2010 +0100 @@ -1,3 +1,12 @@ +2010-04-29 Aidan Kehoe <kehoea@parhasard.net> + + * cmdloop.el (suggest-key-bindings): + Make this available, documenting that it's for GNU Emacs + compatibility. + Implement it in terms of teach-extended-commands-p and + teach-extended-commands-timeout, using Ben's + set-symbol-value-handler functionality. + 2010-04-17 Aidan Kehoe <kehoea@parhasard.net> * loadup.el (load-history): Be a bit more discriminate in the
--- a/lisp/cmdloop.el Thu Apr 29 15:49:21 2010 +0100 +++ b/lisp/cmdloop.el Thu Apr 29 16:16:47 2010 +0100 @@ -301,16 +301,31 @@ :group 'keyboard) ;That damn RMS went off and implemented something differently, after -;we had already implemented it. We can't support both properly until -;we have Lisp magic variables. -;(defvar suggest-key-bindings t -; "*FSFmacs equivalent of `teach-extended-commands-*'. -;Provided for compatibility only. -;Non-nil means show the equivalent key-binding when M-x command has one. -;The value can be a length of time to show the message for. -;If the value is non-nil and not a number, we wait 2 seconds.") -; -;(make-obsolete-variable 'suggest-key-bindings 'teach-extended-commands-p) +;we had already implemented it. +(defcustom suggest-key-bindings t + "*FSFmacs equivalent of `teach-extended-commands-p'. +Provided for compatibility only. +Non-nil means show the equivalent key-binding when M-x command has one. +The value can be a length of time to show the message for, in seconds. + +If the value is non-nil and not a number, we wait the number of seconds +specified by `teach-extended-commands-timeout'." + :type '(choice + (const :tag "off" nil) + (integer :tag "time" 2) + (other :tag "on"))) + +(dontusethis-set-symbol-value-handler + 'suggest-key-bindings + 'set-value + #'(lambda (sym args fun harg handler) + (setq args (car args)) + (if (null args) + (setq teach-extended-commands-p nil) + (setq teach-extended-commands-p t + teach-extended-commands-timeout + (or (and (integerp args) args) + (and args teach-extended-commands-timeout)))))) (defun execute-extended-command (prefix-arg) "Read a command name from the minibuffer using 'completing-read'.
--- a/lisp/obsolete.el Thu Apr 29 15:49:21 2010 +0100 +++ b/lisp/obsolete.el Thu Apr 29 16:16:47 2010 +0100 @@ -273,6 +273,8 @@ parent) (make-compatible 'set-keymap-parent 'set-keymap-parents) +(make-compatible-variable 'suggest-key-bindings 'teach-extended-commands-p) + ;; too bad there's not a way to check for aref, assq, and nconc ;; being called on the values of functions known to return keymaps, ;; or known to return vectors of events instead of strings...