diff options
| author | Dmitry Gutov | 2015-06-22 03:23:38 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-06-22 03:25:38 +0300 |
| commit | 0cee2fbc7db279c8e2a0e5719b1bc14b6cbb420b (patch) | |
| tree | 78ba5ca202602983c25940baaf7bfa5d0c61ee44 | |
| parent | fa52edd4c4eb9e2d8ae2e43821460cfd594593b5 (diff) | |
| download | emacs-0cee2fbc7db279c8e2a0e5719b1bc14b6cbb420b.tar.gz 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.
| -rw-r--r-- | lisp/emacs-lisp/find-func.el | 33 |
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'." | |||
| 550 | (interactive (find-function-read 'defface)) | 550 | (interactive (find-function-read 'defface)) |
| 551 | (find-function-do-it face 'defface 'switch-to-buffer)) | 551 | (find-function-do-it face 'defface 'switch-to-buffer)) |
| 552 | 552 | ||
| 553 | ;;;###autoload | 553 | (defun find-function-on-key-do-it (key find-fn) |
| 554 | (defun find-function-on-key (key) | ||
| 555 | "Find the function that KEY invokes. KEY is a string. | 554 | "Find the function that KEY invokes. KEY is a string. |
| 556 | Set mark before moving, if the buffer already existed." | 555 | Set mark before moving, if the buffer already existed. |
| 557 | (interactive "kFind function on key: ") | 556 | |
| 557 | FIND-FN is the function to call to navigate to the function." | ||
| 558 | (let (defn) | 558 | (let (defn) |
| 559 | (save-excursion | 559 | (save-excursion |
| 560 | (let* ((event (and (eventp key) (aref key 0))) ; Null event OK below. | 560 | (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." | |||
| 575 | (message "%s is unbound" key-desc) | 575 | (message "%s is unbound" key-desc) |
| 576 | (if (consp defn) | 576 | (if (consp defn) |
| 577 | (message "%s runs %s" key-desc (prin1-to-string defn)) | 577 | (message "%s runs %s" key-desc (prin1-to-string defn)) |
| 578 | (find-function-other-window defn)))))) | 578 | (funcall find-fn defn)))))) |
| 579 | |||
| 580 | ;;;###autoload | ||
| 581 | (defun find-function-on-key (key) | ||
| 582 | "Find the function that KEY invokes. KEY is a string. | ||
| 583 | Set mark before moving, if the buffer already existed." | ||
| 584 | (interactive "kFind function on key: ") | ||
| 585 | (find-function-on-key-do-it key #'find-function)) | ||
| 586 | |||
| 587 | ;;;###autoload | ||
| 588 | (defun find-function-on-key-other-window (key) | ||
| 589 | "Find, in the other window, the function that KEY invokes. | ||
| 590 | See `find-function-on-key'." | ||
| 591 | (interactive "kFind function on key: ") | ||
| 592 | (find-function-on-key-do-it key #'find-function-other-window)) | ||
| 593 | |||
| 594 | ;;;###autoload | ||
| 595 | (defun find-function-on-key-other-frame (key) | ||
| 596 | "Find, in the other frame, the function that KEY invokes. | ||
| 597 | See `find-function-on-key'." | ||
| 598 | (interactive "kFind function on key: ") | ||
| 599 | (find-function-on-key-do-it key #'find-function-other-frame)) | ||
| 579 | 600 | ||
| 580 | ;;;###autoload | 601 | ;;;###autoload |
| 581 | (defun find-function-at-point () | 602 | (defun find-function-at-point () |
| @@ -600,6 +621,8 @@ Set mark before moving, if the buffer already existed." | |||
| 600 | (define-key ctl-x-4-map "F" 'find-function-other-window) | 621 | (define-key ctl-x-4-map "F" 'find-function-other-window) |
| 601 | (define-key ctl-x-5-map "F" 'find-function-other-frame) | 622 | (define-key ctl-x-5-map "F" 'find-function-other-frame) |
| 602 | (define-key ctl-x-map "K" 'find-function-on-key) | 623 | (define-key ctl-x-map "K" 'find-function-on-key) |
| 624 | (define-key ctl-x-4-map "K" 'find-function-on-key-other-window) | ||
| 625 | (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) | ||
| 603 | (define-key ctl-x-map "V" 'find-variable) | 626 | (define-key ctl-x-map "V" 'find-variable) |
| 604 | (define-key ctl-x-4-map "V" 'find-variable-other-window) | 627 | (define-key ctl-x-4-map "V" 'find-variable-other-window) |
| 605 | (define-key ctl-x-5-map "V" 'find-variable-other-frame)) | 628 | (define-key ctl-x-5-map "V" 'find-variable-other-frame)) |