comparison lisp/help.el @ 2955:f34f9e634b81

(describe-key, describe-key-briefly): Discard the click or drag that follows a down event.
author Richard M. Stallman <rms@gnu.org>
date Sat, 22 May 1993 18:23:31 +0000
parents 05ff97695d32
children 6cd314c2ddde
comparison
equal deleted inserted replaced
2954:0dfd1927264e 2955:f34f9e634b81
99 (set-buffer-modified-p nil)))) 99 (set-buffer-modified-p nil))))
100 100
101 (defun describe-key-briefly (key) 101 (defun describe-key-briefly (key)
102 "Print the name of the function KEY invokes. KEY is a string." 102 "Print the name of the function KEY invokes. KEY is a string."
103 (interactive "kDescribe key briefly: ") 103 (interactive "kDescribe key briefly: ")
104 ;; If this key seq ends with a down event, discard the
105 ;; following click or drag event. Otherwise that would
106 ;; erase the message.
107 (let ((type (aref key (1- (length key)))))
108 (if (listp type) (setq type (car type)))
109 (and (symbolp type)
110 (memq 'down (event-modifiers type))
111 (setq foo (read-event))))
104 (let ((defn (key-binding key))) 112 (let ((defn (key-binding key)))
105 (if (or (null defn) (integerp defn)) 113 (if (or (null defn) (integerp defn))
106 (message "%s is undefined" (key-description key)) 114 (message "%s is undefined" (key-description key))
107 (message "%s runs the command %s" 115 (message "%s runs the command %s"
108 (key-description key) 116 (key-description key)
125 " \\[scroll-other-window] to scroll the help."))))) 133 " \\[scroll-other-window] to scroll the help.")))))
126 134
127 (defun describe-key (key) 135 (defun describe-key (key)
128 "Display documentation of the function invoked by KEY. KEY is a string." 136 "Display documentation of the function invoked by KEY. KEY is a string."
129 (interactive "kDescribe key: ") 137 (interactive "kDescribe key: ")
138 ;; If this key seq ends with a down event, discard the
139 ;; following click or drag event. Otherwise that would
140 ;; erase the message.
141 (let ((type (aref key (1- (length key)))))
142 (if (listp type) (setq type (car type)))
143 (and (symbolp type)
144 (memq 'down (event-modifiers type))
145 (read-event)))
130 (let ((defn (key-binding key))) 146 (let ((defn (key-binding key)))
131 (if (or (null defn) (integerp defn)) 147 (if (or (null defn) (integerp defn))
132 (message "%s is undefined" (key-description key)) 148 (message "%s is undefined" (key-description key))
133 (with-output-to-temp-buffer "*Help*" 149 (with-output-to-temp-buffer "*Help*"
134 (prin1 defn) 150 (prin1 defn)