aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love1999-01-10 18:18:58 +0000
committerDave Love1999-01-10 18:18:58 +0000
commit4a8ea8dc2d77d444fecdb356bbfb4fef8febf282 (patch)
treed5f5352396af46706468652dc25b594d37334101
parente714d2cfd430a5ca4a73f1da037343685c028400 (diff)
downloademacs-4a8ea8dc2d77d444fecdb356bbfb4fef8febf282.tar.gz
emacs-4a8ea8dc2d77d444fecdb356bbfb4fef8febf282.zip
(find-function-on-key): DTRT for mouse
bindings.
-rw-r--r--lisp/emacs-lisp/find-func.el29
1 files changed, 21 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 2a31042b813..a37e64502dc 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -1,6 +1,6 @@
1;;; find-func.el --- find the definition of the Emacs Lisp function near point 1;;; find-func.el --- find the definition of the Emacs Lisp function near point
2 2
3;; Copyright (C) 1997 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 1999 Free Software Foundation, Inc.
4 4
5;; Author: Jens Petersen <petersen@kurims.kyoto-u.ac.jp> 5;; Author: Jens Petersen <petersen@kurims.kyoto-u.ac.jp>
6;; Maintainer: petersen@kurims.kyoto-u.ac.jp 6;; Maintainer: petersen@kurims.kyoto-u.ac.jp
@@ -351,13 +351,26 @@ See `find-variable' for more details."
351 "Find the function that KEY invokes. KEY is a string. 351 "Find the function that KEY invokes. KEY is a string.
352Point is saved if FUNCTION is in the current buffer." 352Point is saved if FUNCTION is in the current buffer."
353 (interactive "kFind function on key: ") 353 (interactive "kFind function on key: ")
354 (let ((defn (key-binding key)) 354 (save-excursion
355 (key-desc (key-description key))) 355 (let* ((event (aref key 0))
356 (if (or (null defn) (integerp defn)) 356 (start (event-start event))
357 (message "%s is unbound" key-desc) 357 (modifiers (event-modifiers event))
358 (if (consp defn) 358 (window (and (or (memq 'click modifiers) (memq 'down modifiers)
359 (message "%s runs %s" key-desc (prin1-to-string defn)) 359 (memq 'drag modifiers))
360 (find-function-other-window defn))))) 360 (posn-window start))))
361 ;; For a mouse button event, go to the button it applies to
362 ;; to get the right key bindings. And go to the right place
363 ;; in case the keymap depends on where you clicked.
364 (when (windowp window)
365 (set-buffer (window-buffer window))
366 (goto-char (posn-point start)))
367 (let ((defn (key-binding key))
368 (key-desc (key-description key)))
369 (if (or (null defn) (integerp defn))
370 (message "%s is unbound" key-desc)
371 (if (consp defn)
372 (message "%s runs %s" key-desc (prin1-to-string defn))
373 (find-function-other-window defn)))))))
361 374
362;;;###autoload 375;;;###autoload
363(defun find-function-at-point () 376(defun find-function-at-point ()