diff options
| author | Gerd Moellmann | 2001-03-09 16:24:53 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-03-09 16:24:53 +0000 |
| commit | c085b77c3f1b6fbeef408628eb86a980f4aacc58 (patch) | |
| tree | 675ca3cec5088a8bf8adb12c6f68978999329694 | |
| parent | 3cfd8357bb40fdd1bd85c452de3885b4fc0c81ae (diff) | |
| download | emacs-c085b77c3f1b6fbeef408628eb86a980f4aacc58.tar.gz emacs-c085b77c3f1b6fbeef408628eb86a980f4aacc58.zip | |
(string-key-binding): Renamed from
mode-line-key-binding. Handle any event on a string. Check for
`keymap' properties as well as `local-map' properties.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/help.el | 33 |
2 files changed, 24 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a121cc8ed57..9be4546aa82 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2001-03-09 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-03-09 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * help.el (string-key-binding): Renamed from | ||
| 4 | mode-line-key-binding. Handle any event on a string. Check for | ||
| 5 | `keymap' properties as well as `local-map' properties. | ||
| 6 | |||
| 3 | * comint.el (comint-insert-clicked-input): Use the last key | 7 | * comint.el (comint-insert-clicked-input): Use the last key |
| 4 | from this-command-keys to lookup the global key definition. | 8 | from this-command-keys to lookup the global key definition. |
| 5 | 9 | ||
diff --git a/lisp/help.el b/lisp/help.el index 84f3f52824e..83d8a65a9c9 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -206,17 +206,24 @@ With arg, you are asked to choose which language." | |||
| 206 | (goto-char (point-min)) | 206 | (goto-char (point-min)) |
| 207 | (set-buffer-modified-p nil)))) | 207 | (set-buffer-modified-p nil)))) |
| 208 | 208 | ||
| 209 | (defun mode-line-key-binding (key) | 209 | (defun string-key-binding (key) |
| 210 | "Value is the binding of KEY in the mode line or nil if none." | 210 | "Value is the binding of KEY in a string. |
| 211 | (let (string-info defn) | 211 | If KEY is an event on a string, and that string has a `local-map' |
| 212 | (when (and (eq 'mode-line (aref key 0)) | 212 | or `keymap' property, return the binding of KEY in the string's keymap." |
| 213 | (consp (setq string-info (nth 4 (event-start (aref key 1)))))) | 213 | (let* ((defn nil) |
| 214 | (let* ((string (car string-info)) | 214 | (start (when (vectorp key) |
| 215 | (pos (cdr string-info)) | 215 | (if (memq (aref key 0) '(mode-line header-line)) |
| 216 | (local-map (and (> pos 0) | 216 | (event-start (aref key 1)) |
| 217 | (< pos (length string)) | 217 | (event-start (aref key 0))))) |
| 218 | (get-text-property pos 'local-map string)))) | 218 | (string-info (and (consp start) (nth 4 start)))) |
| 219 | (setq defn (and local-map (lookup-key local-map key))))) | 219 | (when string-info |
| 220 | (let* ((string (car string-info)) | ||
| 221 | (pos (cdr string-info)) | ||
| 222 | (local-map (and (> pos 0) | ||
| 223 | (< pos (length string)) | ||
| 224 | (or (get-text-property pos 'local-map string) | ||
| 225 | (get-text-property pos 'keymap string))))) | ||
| 226 | (setq defn (and local-map (lookup-key local-map key))))) | ||
| 220 | defn)) | 227 | defn)) |
| 221 | 228 | ||
| 222 | (defun describe-key-briefly (key &optional insert) | 229 | (defun describe-key-briefly (key &optional insert) |
| @@ -239,7 +246,7 @@ If INSERT (the prefix arg) is non-nil, insert the message in the buffer." | |||
| 239 | (set-buffer (window-buffer window)) | 246 | (set-buffer (window-buffer window)) |
| 240 | (goto-char position))) | 247 | (goto-char position))) |
| 241 | ;; Ok, now look up the key and name the command. | 248 | ;; Ok, now look up the key and name the command. |
| 242 | (let ((defn (or (mode-line-key-binding key) | 249 | (let ((defn (or (string-key-binding key) |
| 243 | (key-binding key))) | 250 | (key-binding key))) |
| 244 | (key-desc (key-description key))) | 251 | (key-desc (key-description key))) |
| 245 | (if (or (null defn) (integerp defn)) | 252 | (if (or (null defn) (integerp defn)) |
| @@ -324,7 +331,7 @@ If FUNCTION is nil, applies `message' to it, thus printing it." | |||
| 324 | (progn | 331 | (progn |
| 325 | (set-buffer (window-buffer window)) | 332 | (set-buffer (window-buffer window)) |
| 326 | (goto-char position))) | 333 | (goto-char position))) |
| 327 | (let ((defn (or (mode-line-key-binding key) (key-binding key)))) | 334 | (let ((defn (or (string-key-binding key) (key-binding key)))) |
| 328 | (if (or (null defn) (integerp defn)) | 335 | (if (or (null defn) (integerp defn)) |
| 329 | (message "%s is undefined" (key-description key)) | 336 | (message "%s is undefined" (key-description key)) |
| 330 | (with-output-to-temp-buffer "*Help*" | 337 | (with-output-to-temp-buffer "*Help*" |