aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/find-func.el41
1 files changed, 21 insertions, 20 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 74afa4a4a64..c4ae7f12b38 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -352,26 +352,27 @@ See `find-variable' for more details."
352 "Find the function that KEY invokes. KEY is a string. 352 "Find the function that KEY invokes. KEY is a string.
353Point is saved if FUNCTION is in the current buffer." 353Point is saved if FUNCTION is in the current buffer."
354 (interactive "kFind function on key: ") 354 (interactive "kFind function on key: ")
355 (save-excursion 355 (let (defn)
356 (let* ((event (and (eventp key) (aref key 0))) ; Null event OK below. 356 (save-excursion
357 (start (event-start event)) 357 (let* ((event (and (eventp key) (aref key 0))) ; Null event OK below.
358 (modifiers (event-modifiers event)) 358 (start (event-start event))
359 (window (and (or (memq 'click modifiers) (memq 'down modifiers) 359 (modifiers (event-modifiers event))
360 (memq 'drag modifiers)) 360 (window (and (or (memq 'click modifiers) (memq 'down modifiers)
361 (posn-window start)))) 361 (memq 'drag modifiers))
362 ;; For a mouse button event, go to the button it applies to 362 (posn-window start))))
363 ;; to get the right key bindings. And go to the right place 363 ;; For a mouse button event, go to the button it applies to
364 ;; in case the keymap depends on where you clicked. 364 ;; to get the right key bindings. And go to the right place
365 (when (windowp window) 365 ;; in case the keymap depends on where you clicked.
366 (set-buffer (window-buffer window)) 366 (when (windowp window)
367 (goto-char (posn-point start))) 367 (set-buffer (window-buffer window))
368 (let ((defn (key-binding key)) 368 (goto-char (posn-point start)))
369 (key-desc (key-description key))) 369 (setq defn (key-binding key))))
370 (if (or (null defn) (integerp defn)) 370 (let ((key-desc (key-description key)))
371 (message "%s is unbound" key-desc) 371 (if (or (null defn) (integerp defn))
372 (if (consp defn) 372 (message "%s is unbound" key-desc)
373 (message "%s runs %s" key-desc (prin1-to-string defn)) 373 (if (consp defn)
374 (find-function-other-window defn))))))) 374 (message "%s runs %s" key-desc (prin1-to-string defn))
375 (find-function-other-window defn))))))
375 376
376;;;###autoload 377;;;###autoload
377(defun find-function-at-point () 378(defun find-function-at-point ()