changeset 22759:be3e1a724828

(find-function-regexp): Added :version 20.3. (find-variable-regexp, find-function-after-hook): Likewise. (find-function-recenter-line): Likewise. (find-function-recenter-line): Remove autoload cookie. (find-function-do-it): Made more solid. `save-excursion' around call to `find-function-noselect'. `find-function-other-window' and `find-function-other-frame' point behaviour should be correct now when function in a current buffer. (find-function-setup-keys): New function to set up keybindings.
author Richard M. Stallman <rms@gnu.org>
date Tue, 14 Jul 1998 23:42:21 +0000
parents dbd9ecc9dbac
children e080fa4636c7
files lisp/emacs-lisp/find-func.el
diffstat 1 files changed, 36 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/find-func.el	Tue Jul 14 22:17:35 1998 +0000
+++ b/lisp/emacs-lisp/find-func.el	Tue Jul 14 23:42:21 1998 +0000
@@ -33,10 +33,13 @@
 ;; following code in your init file:
 ;;
 ;; ;;; find-func
+;; (find-function-setup-keys)
+;;
+;; or just:
+;;
 ;; (load "find-func")
 ;;
-;; and away you go!  The default given keybindings as the ones
-;; protected by autoload cookies at the bottom of this file.  It does
+;; if you don't like the given keybindings and away you go!  It does
 ;; pretty much what you would expect, putting the cursor at the
 ;; definition of the function or variable at point.
 ;;
@@ -64,7 +67,8 @@
 
 Please send improvements and fixes to the maintainer."
   :type 'regexp
-  :group 'find-function)
+  :group 'find-function
+  :version 20.3)
 
 (defcustom find-variable-regexp
   "^\\s-*(def[^uma\W]\\w+\\*?\\s-+%s\\(\\s-\\|$\\)"
@@ -74,7 +78,8 @@
 
 Please send improvements and fixes to the maintainer."
   :type 'regexp
-  :group 'find-function)
+  :group 'find-function
+  :version 20.3)
 
 (defcustom find-function-source-path nil
   "The default list of directories where find-function searches.
@@ -84,22 +89,20 @@
   :type '(repeat directory)
   :group 'find-function)
 
-
-;;; Functions:
-
-;;;###autoload
 (defcustom find-function-recenter-line 1
   "The window line-number from which to start displaying a symbol definition.
 A value of nil implies center the beginning of the definition.
 See the function `center-to-window-line' for more information, and
 `find-function' and `find-variable'."
-  :group 'find-function)
+  :group 'find-function
+  :version 20.3)
 
 (defcustom find-function-after-hook nil
   "Hook run after finding symbol definition.
 
 See the functions `find-function' and `find-variable'."
-  :group 'find-function)
+  :group 'find-function
+  :version 20.3)
 
 ;;; Functions:
 
@@ -240,17 +243,21 @@
 See also `find-function-after-hook'.
 
 Point is saved in the buffer if it is one of the current buffers."
-  (let ((orig-point (point))
+  (let* ((orig-point (point))
+	(orig-buf (window-buffer))
 	(orig-buffers (buffer-list))
-	(buffer-point (funcall (if variable-p
-				   'find-variable-noselect
-				 'find-function-noselect)
-			       symbol)))
+	(buffer-point (save-excursion
+			(funcall (if variable-p
+				      'find-variable-noselect
+				    'find-function-noselect)
+				  symbol)))
+	(new-buf (car buffer-point))
+	(new-point (cdr buffer-point)))
     (when buffer-point
-      (funcall switch-fn (car buffer-point))
-      (when (memq (car buffer-point) orig-buffers)
+      (when (memq new-buf orig-buffers)
 	(push-mark orig-point))
-      (goto-char (cdr buffer-point))
+      (funcall switch-fn new-buf)
+      (goto-char new-point)
       (recenter find-function-recenter-line)
       (run-hooks find-function-after-hook))))
 
@@ -359,6 +366,17 @@
     (when (and symb (not (equal symb 0)))
       (find-variable-other-window symb))))
 
+;;;###autoload
+(defun find-function-setup-keys ()
+  "Define some key bindings for the find-function family of functions."
+  (define-key ctl-x-map "F" 'find-function)
+  (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-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))
+
 (provide 'find-func)
 
 ;;; find-func.el ends here