summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2015-06-22 03:23:38 +0300
committerDmitry Gutov <dgutov@yandex.ru>2015-06-22 03:25:38 +0300
commit0cee2fbc7db279c8e2a0e5719b1bc14b6cbb420b (patch)
tree78ba5ca202602983c25940baaf7bfa5d0c61ee44 /lisp/emacs-lisp
parentfa52edd4c4eb9e2d8ae2e43821460cfd594593b5 (diff)
downloademacs-0cee2fbc7db279c8e2a0e5719b1bc14b6cbb420b.tar.gz
emacs-0cee2fbc7db279c8e2a0e5719b1bc14b6cbb420b.tar.bz2
emacs-0cee2fbc7db279c8e2a0e5719b1bc14b6cbb420b.zip
Make find-function-on-key use the current window
* lisp/emacs-lisp/find-func.el (find-function-on-key-do-it): Extract from `find-function-on-key', add a second argument. (find-function-on-key): Use it (bug#19679). (find-function-on-key-other-window) (find-function-on-key-other-frame): New commands.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/find-func.el33
1 files changed, 28 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 54f8340862d..cd23cd77f4a 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -550,11 +550,11 @@ See also `find-function-recenter-line' and `find-function-after-hook'."
(interactive (find-function-read 'defface))
(find-function-do-it face 'defface 'switch-to-buffer))
-;;;###autoload
-(defun find-function-on-key (key)
+(defun find-function-on-key-do-it (key find-fn)
"Find the function that KEY invokes. KEY is a string.
-Set mark before moving, if the buffer already existed."
- (interactive "kFind function on key: ")
+Set mark before moving, if the buffer already existed.
+
+FIND-FN is the function to call to navigate to the function."
(let (defn)
(save-excursion
(let* ((event (and (eventp key) (aref key 0))) ; Null event OK below.
@@ -575,7 +575,28 @@ Set mark before moving, if the buffer already existed."
(message "%s is unbound" key-desc)
(if (consp defn)
(message "%s runs %s" key-desc (prin1-to-string defn))
- (find-function-other-window defn))))))
+ (funcall find-fn defn))))))
+
+;;;###autoload
+(defun find-function-on-key (key)
+ "Find the function that KEY invokes. KEY is a string.
+Set mark before moving, if the buffer already existed."
+ (interactive "kFind function on key: ")
+ (find-function-on-key-do-it key #'find-function))
+
+;;;###autoload
+(defun find-function-on-key-other-window (key)
+ "Find, in the other window, the function that KEY invokes.
+See `find-function-on-key'."
+ (interactive "kFind function on key: ")
+ (find-function-on-key-do-it key #'find-function-other-window))
+
+;;;###autoload
+(defun find-function-on-key-other-frame (key)
+ "Find, in the other frame, the function that KEY invokes.
+See `find-function-on-key'."
+ (interactive "kFind function on key: ")
+ (find-function-on-key-do-it key #'find-function-other-frame))
;;;###autoload
(defun find-function-at-point ()
@@ -600,6 +621,8 @@ Set mark before moving, if the buffer already existed."
(define-key ctl-x-4-map "F" 'find-function-other-window)
(define-key ctl-x-5-map "F" 'find-function-other-frame)
(define-key ctl-x-map "K" 'find-function-on-key)
+ (define-key ctl-x-4-map "K" 'find-function-on-key-other-window)
+ (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame)
(define-key ctl-x-map "V" 'find-variable)
(define-key ctl-x-4-map "V" 'find-variable-other-window)
(define-key ctl-x-5-map "V" 'find-variable-other-frame))