comparison lisp/cmdloop.el @ 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 fd36a980d701
children d27c1ee1943b 308d34e9f07d
comparison
equal deleted inserted replaced
5207:1096ef427b56 5208:9fa29ec759e3
299 `teach-extended-commands-p' is true." 299 `teach-extended-commands-p' is true."
300 :type 'number 300 :type 'number
301 :group 'keyboard) 301 :group 'keyboard)
302 302
303 ;That damn RMS went off and implemented something differently, after 303 ;That damn RMS went off and implemented something differently, after
304 ;we had already implemented it. We can't support both properly until 304 ;we had already implemented it.
305 ;we have Lisp magic variables. 305 (defcustom suggest-key-bindings t
306 ;(defvar suggest-key-bindings t 306 "*FSFmacs equivalent of `teach-extended-commands-p'.
307 ; "*FSFmacs equivalent of `teach-extended-commands-*'. 307 Provided for compatibility only.
308 ;Provided for compatibility only. 308 Non-nil means show the equivalent key-binding when M-x command has one.
309 ;Non-nil means show the equivalent key-binding when M-x command has one. 309 The value can be a length of time to show the message for, in seconds.
310 ;The value can be a length of time to show the message for. 310
311 ;If the value is non-nil and not a number, we wait 2 seconds.") 311 If the value is non-nil and not a number, we wait the number of seconds
312 ; 312 specified by `teach-extended-commands-timeout'."
313 ;(make-obsolete-variable 'suggest-key-bindings 'teach-extended-commands-p) 313 :type '(choice
314 (const :tag "off" nil)
315 (integer :tag "time" 2)
316 (other :tag "on")))
317
318 (dontusethis-set-symbol-value-handler
319 'suggest-key-bindings
320 'set-value
321 #'(lambda (sym args fun harg handler)
322 (setq args (car args))
323 (if (null args)
324 (setq teach-extended-commands-p nil)
325 (setq teach-extended-commands-p t
326 teach-extended-commands-timeout
327 (or (and (integerp args) args)
328 (and args teach-extended-commands-timeout))))))
314 329
315 (defun execute-extended-command (prefix-arg) 330 (defun execute-extended-command (prefix-arg)
316 "Read a command name from the minibuffer using 'completing-read'. 331 "Read a command name from the minibuffer using 'completing-read'.
317 Then call the specified command using 'command-execute' and return its 332 Then call the specified command using 'command-execute' and return its
318 return value. If the command asks for a prefix argument, supply the 333 return value. If the command asks for a prefix argument, supply the