find-func.el 18.3 KB
Newer Older
1
;;; find-func.el --- find the definition of the Emacs Lisp function near point
Dave Love's avatar
Dave Love committed
2

3 4
;; Copyright (C) 1997, 1999, 2001, 2002, 2003, 2004,
;;   2005 Free Software Foundation, Inc.
Dave Love's avatar
Dave Love committed
5 6 7

;; Author: Jens Petersen <petersen@kurims.kyoto-u.ac.jp>
;; Maintainer: petersen@kurims.kyoto-u.ac.jp
8
;; Keywords: emacs-lisp, functions, variables
Dave Love's avatar
Dave Love committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
;; Created: 97/07/25

;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
Lute Kamstra's avatar
Lute Kamstra committed
25 26
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
Dave Love's avatar
Dave Love committed
27 28 29 30 31 32

;;; Commentary:
;;
;; The funniest thing about this is that I can't imagine why a package
;; so obviously useful as this hasn't been written before!!
;; ;;; find-func
33 34 35 36
;; (find-function-setup-keys)
;;
;; or just:
;;
37
;; (load "find-func")
Dave Love's avatar
Dave Love committed
38
;;
39
;; if you don't like the given keybindings and away you go!  It does
40 41
;; pretty much what you would expect, putting the cursor at the
;; definition of the function or variable at point.
Dave Love's avatar
Dave Love committed
42
;;
43
;; The code started out from `describe-function', `describe-key'
Dave Love's avatar
Dave Love committed
44 45 46
;; ("help.el") and `fff-find-loaded-emacs-lisp-function' (Noah Friedman's
;; "fff.el").

47
;;; Code:
Dave Love's avatar
Dave Love committed
48

49 50
(require 'loadhist)

Dave Love's avatar
Dave Love committed
51
;;; User variables:
52

Stephen Eglen's avatar
Stephen Eglen committed
53
(defgroup find-function nil
54 55
  "Finds the definition of the Emacs Lisp symbol near point."
;;   :prefix "find-function"
Stephen Eglen's avatar
Stephen Eglen committed
56
  :group 'lisp)
Dave Love's avatar
Dave Love committed
57

58 59
(defconst find-function-space-re "\\(?:\\s-\\|\n\\|;.*\n\\)+")

60
(defcustom find-function-regexp
Richard M. Stallman's avatar
Richard M. Stallman committed
61 62
  ;; Match things like (defun foo ...), (defmacro foo ...),
  ;; (define-skeleton foo ...), (define-generic-mode 'foo ...),
63
  ;;  (define-derived-mode foo ...), (define-minor-mode foo)
64 65
  (concat
   "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\
Juri Linkov's avatar
Juri Linkov committed
66 67 68
ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\
foo\\|[^cfgv]\\w+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\
menu-bar-make-toggle\\)"
69
   find-function-space-re
70
   "\\('\\|\(quote \\)?%s\\(\\s-\\|$\\|\(\\|\)\\)")
Richard M. Stallman's avatar
Richard M. Stallman committed
71 72
  "The regexp used by `find-function' to search for a function definition.
Note it must contain a `%s' at the place where `format'
73
should insert the function name.  The default value avoids `defconst',
74
`defgroup', `defvar', `defface'.
Dave Love's avatar
Dave Love committed
75

76 77
Please send improvements and fixes to the maintainer."
  :type 'regexp
78
  :group 'find-function
79
  :version "21.1")
80 81

(defcustom find-variable-regexp
Juri Linkov's avatar
Juri Linkov committed
82 83 84 85 86
  (concat
   "^\\s-*(\\(def[^fumag]\\(\\w\\|\\s_\\)+\\*?\\|\
easy-mmode-def\\(map\\|syntax\\)\\|easy-menu-define\\)"
   find-function-space-re
   "%s\\(\\s-\\|$\\)")
87
  "The regexp used by `find-variable' to search for a variable definition.
Richard M. Stallman's avatar
Richard M. Stallman committed
88 89
Note it must contain a `%s' at the place where `format'
should insert the variable name.  The default value
90
avoids `defun', `defmacro', `defalias', `defadvice', `defgroup', `defface'.
91 92 93

Please send improvements and fixes to the maintainer."
  :type 'regexp
94
  :group 'find-function
95
  :version "21.1")
Dave Love's avatar
Dave Love committed
96

Richard M. Stallman's avatar
Richard M. Stallman committed
97 98 99 100 101 102 103 104 105
(defcustom find-face-regexp
  (concat"^\\s-*(defface" find-function-space-re "%s\\(\\s-\\|$\\)")
  "The regexp used by `find-face' to search for a face definition.
Note it must contain a `%s' at the place where `format'
should insert the face name.

Please send improvements and fixes to the maintainer."
  :type 'regexp
  :group 'find-function
106
  :version "22.1")
Richard M. Stallman's avatar
Richard M. Stallman committed
107 108 109 110 111 112 113 114 115 116

(defvar find-function-regexp-alist
  '((nil . find-function-regexp)
    (defvar . find-variable-regexp)
    (defface . find-face-regexp))
  "Alist mapping definition types into regexp variables.
Each regexp variable's value should actually be a format string
to be used to substitute the desired symbol name into the regexp.")
(put 'find-function-regexp-alist 'risky-local-variable t)

Stephen Eglen's avatar
Stephen Eglen committed
117
(defcustom find-function-source-path nil
Richard M. Stallman's avatar
Richard M. Stallman committed
118
  "The default list of directories where `find-function' searches.
Dave Love's avatar
Dave Love committed
119

Richard M. Stallman's avatar
Richard M. Stallman committed
120
If this variable is nil then `find-function' searches `load-path' by
Stephen Eglen's avatar
Stephen Eglen committed
121 122 123
default."
  :type '(repeat directory)
  :group 'find-function)
Dave Love's avatar
Dave Love committed
124

125 126 127
(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.
128 129 130
See `find-function' and `find-variable'."
  :type '(choice (const :tag "Center" nil)
		 integer)
131
  :group 'find-function
132
  :version "20.3")
133 134 135 136 137

(defcustom find-function-after-hook nil
  "Hook run after finding symbol definition.

See the functions `find-function' and `find-variable'."
138
  :group 'find-function
139
  :version "20.3")
140 141 142

;;; Functions:

143 144 145 146 147 148
(defun find-library-suffixes ()
  (let ((suffixes nil))
    (dolist (suffix load-suffixes (nreverse suffixes))
      (unless (string-match "elc" suffix) (push suffix suffixes)))))

(defun find-library-name (library)
149
  "Return the absolute file name of the Lisp source of LIBRARY."
150 151 152
  ;; Strip off the extension to take advantage of library suffixes in
  ;; the call to `locate-file'.
  (if (string-match "\\.el\\(c\\(\\..*\\)?\\)?\\'" library)
153
      (setq library (replace-match "" t t library)))
154 155
  (or (locate-file library
		   (or find-function-source-path load-path)
Stefan Monnier's avatar
Stefan Monnier committed
156
		   (append (find-library-suffixes) '("")))
157
      (error "Can't find library %s" library)))
158

159 160 161 162 163 164 165 166
(defvar find-function-C-source-directory
  (let ((dir (expand-file-name "src" source-directory)))
    (when (and (file-directory-p dir) (file-readable-p dir))
      dir))
  "Directory where the C source files of Emacs can be found.
If nil, do not try to find the source code of functions and variables
defined in C.")

Richard M. Stallman's avatar
Richard M. Stallman committed
167
(defun find-function-C-source (fun-or-var file type)
168
  "Find the source location where FUN-OR-VAR is defined in FILE.
Richard M. Stallman's avatar
Richard M. Stallman committed
169
TYPE should be nil to find a function, or `defvar' to find a variable."
170 171 172 173 174 175 176
  (unless find-function-C-source-directory
    (setq find-function-C-source-directory
	  (read-directory-name "Emacs C source dir: " nil nil t)))
  (setq file (expand-file-name file find-function-C-source-directory))
  (unless (file-readable-p file)
    (error "The C source file %s is not available"
	   (file-name-nondirectory file)))
Richard M. Stallman's avatar
Richard M. Stallman committed
177
  (unless type
178 179 180 181
    (setq fun-or-var (indirect-function fun-or-var)))
  (with-current-buffer (find-file-noselect file)
    (goto-char (point-min))
    (unless (re-search-forward
Richard M. Stallman's avatar
Richard M. Stallman committed
182
	     (if type
183 184 185 186 187 188 189 190 191 192
		 (concat "DEFVAR[A-Z_]*[ \t\n]*([ \t\n]*\""
			 (regexp-quote (symbol-name fun-or-var))
			 "\"")
	       (concat "DEFUN[ \t\n]*([ \t\n]*\""
		       (regexp-quote (subr-name fun-or-var))
		       "\""))
	     nil t)
      (error "Can't find source for %s" fun-or-var))
    (cons (current-buffer) (match-beginning 0))))

193 194 195 196 197 198 199 200 201 202 203 204
;;;###autoload
(defun find-library (library)
  "Find the elisp source of LIBRARY."
  (interactive
   (list
    (completing-read "Library name: "
		     'locate-file-completion
		     (cons (or find-function-source-path load-path)
			   (find-library-suffixes)))))
  (let ((buf (find-file-noselect (find-library-name library))))
    (condition-case nil (switch-to-buffer buf) (error (pop-to-buffer buf)))))

205
;;;###autoload
Richard M. Stallman's avatar
Richard M. Stallman committed
206 207 208 209 210 211
(defun find-function-search-for-symbol (symbol type library)
  "Search for SYMBOL's definition of type TYPE in LIBRARY.
If TYPE is nil, look for a function definition.
Otherwise, TYPE specifies the kind of definition,
and it is interpreted via `find-function-regexp-alist'.
The search is done in the source for library LIBRARY."
212 213
  (if (null library)
      (error "Don't know where `%s' is defined" symbol))
214 215
  ;; Some functions are defined as part of the construct
  ;; that defines something else.
216
  (while (and (symbolp symbol) (get symbol 'definition-name))
217
    (setq symbol (get symbol 'definition-name)))
218
  (if (string-match "\\`src/\\(.*\\.c\\)\\'" library)
Richard M. Stallman's avatar
Richard M. Stallman committed
219
      (find-function-C-source symbol (match-string 1 library) type)
Dave Love's avatar
Dave Love committed
220 221
    (if (string-match "\\.el\\(c\\)\\'" library)
	(setq library (substring library 0 (match-beginning 1))))
Richard M. Stallman's avatar
Richard M. Stallman committed
222 223
    (let* ((filename (find-library-name library))
	   (regexp-symbol (cdr (assq type find-function-regexp-alist))))
Dave Love's avatar
Dave Love committed
224
      (with-current-buffer (find-file-noselect filename)
Richard M. Stallman's avatar
Richard M. Stallman committed
225
	(let ((regexp (format (symbol-value regexp-symbol)
226
			      (regexp-quote (symbol-name symbol))))
227
	      (case-fold-search))
228 229 230 231
	  (with-syntax-table emacs-lisp-mode-syntax-table
	    (goto-char (point-min))
	    (if (or (re-search-forward regexp nil t)
		    (re-search-forward
232
		     (concat "^([^ ]+" find-function-space-re "['(]"
233
			     (regexp-quote (symbol-name symbol))
234
			     "\\_>")
235 236 237 238 239 240
		     nil t))
		(progn
		  (beginning-of-line)
		  (cons (current-buffer) (point)))
	      (error "Cannot find definition of `%s' in library `%s'"
		     symbol library))))))))
241

242
;;;###autoload
243
(defun find-function-noselect (function)
Richard M. Stallman's avatar
Richard M. Stallman committed
244
  "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION.
Dave Love's avatar
Dave Love committed
245

246
Finds the source file containing the definition of FUNCTION
247
in a buffer and the point of the definition.  The buffer is
Dave Love's avatar
Dave Love committed
248 249
not selected.

250
If the file where FUNCTION is defined is not known, then it is
Richard M. Stallman's avatar
Richard M. Stallman committed
251
searched for in `find-function-source-path' if non nil, otherwise
252
in `load-path'."
Dave Love's avatar
Dave Love committed
253 254 255
  (if (not function)
      (error "You didn't specify a function"))
  (let ((def (symbol-function function))
256
	aliases)
Dave Love's avatar
Dave Love committed
257 258 259 260
    (while (symbolp def)
      (or (eq def function)
	  (if aliases
	      (setq aliases (concat aliases
261
				    (format ", which is an alias for `%s'"
Dave Love's avatar
Dave Love committed
262
					    (symbol-name def))))
263 264
	    (setq aliases (format "`%s' an alias for `%s'"
				  function (symbol-name def)))))
Dave Love's avatar
Dave Love committed
265 266 267
      (setq function (symbol-function function)
	    def (symbol-function function)))
    (if aliases
268
	(message "%s" aliases))
269 270 271
    (let ((library
	   (cond ((eq (car-safe def) 'autoload)
		  (nth 1 def))
272 273
		 ((subrp def)
		  (help-C-file-name def 'subr))
274
		 ((symbol-file function 'defun)))))
275
      (find-function-search-for-symbol function nil library))))
Dave Love's avatar
Dave Love committed
276

Richard M. Stallman's avatar
Richard M. Stallman committed
277
(defun find-function-read (&optional type)
278
  "Read and return an interned symbol, defaulting to the one near point.
Dave Love's avatar
Dave Love committed
279

Richard M. Stallman's avatar
Richard M. Stallman committed
280 281 282 283 284 285 286 287 288 289 290 291 292
If TYPE is nil, insist on a symbol with a function definition.
Otherwise TYPE should be `defvar' or `defface'.
If TYPE is nil, defaults using `function-called-at-point',
otherwise uses `variable-at-point'."
  (let ((symb (if (null type)
		  (function-called-at-point)
		(if (eq type 'defvar)
		    (variable-at-point)
		  (variable-at-point t))))
	(predicate (cdr (assq type '((nil . fboundp) (defvar . boundp)
				     (defface . facep)))))
	(prompt (cdr (assq type '((nil . "function") (defvar . "variable")
				  (defface . "face")))))
Dave Love's avatar
Dave Love committed
293 294
	(enable-recursive-minibuffers t)
	val)
295 296
    (if (equal symb 0)
	(setq symb nil))
Richard M. Stallman's avatar
Richard M. Stallman committed
297 298 299 300 301 302 303
    (setq val (completing-read
	       (concat "Find "
		       prompt
		       (if symb
			   (format " (default %s)" symb))
		       ": ")
	       obarray predicate t nil))
Dave Love's avatar
Dave Love committed
304
    (list (if (equal val "")
305 306
	      symb
	    (intern val)))))
Dave Love's avatar
Dave Love committed
307

Richard M. Stallman's avatar
Richard M. Stallman committed
308
(defun find-function-do-it (symbol type switch-fn)
Richard M. Stallman's avatar
Richard M. Stallman committed
309
  "Find Emacs Lisp SYMBOL in a buffer and display it.
Richard M. Stallman's avatar
Richard M. Stallman committed
310 311 312 313 314 315 316
TYPE is nil to search for a function definition,
or else `defvar' or `defface'.

The variable `find-function-recenter-line' controls how
to recenter the display.  SWITCH-FN is the function to call
to display and select the buffer.
See also `find-function-after-hook'.
317

Richard M. Stallman's avatar
Richard M. Stallman committed
318
Set mark before moving, if the buffer already existed."
319 320
  (let* ((orig-point (point))
	(orig-buf (window-buffer))
321
	(orig-buffers (buffer-list))
322
	(buffer-point (save-excursion
Richard M. Stallman's avatar
Richard M. Stallman committed
323
			(find-definition-noselect symbol type)))
324 325
	(new-buf (car buffer-point))
	(new-point (cdr buffer-point)))
326
    (when buffer-point
327
      (when (memq new-buf orig-buffers)
328
	(push-mark orig-point))
329 330
      (funcall switch-fn new-buf)
      (goto-char new-point)
331
      (recenter find-function-recenter-line)
332
      (run-hooks 'find-function-after-hook))))
Dave Love's avatar
Dave Love committed
333

334
;;;###autoload
335
(defun find-function (function)
Dave Love's avatar
Dave Love committed
336
  "Find the definition of the FUNCTION near point.
Dave Love's avatar
Dave Love committed
337

338
Finds the source file containing the definition of the function
339
near point (selected by `function-called-at-point') in a buffer and
Richard M. Stallman's avatar
Richard M. Stallman committed
340 341
places point before the definition.
Set mark before moving, if the buffer already existed.
Dave Love's avatar
Dave Love committed
342

343
The library where FUNCTION is defined is searched for in
Richard M. Stallman's avatar
Richard M. Stallman committed
344
`find-function-source-path', if non nil, otherwise in `load-path'.
345 346 347
See also `find-function-recenter-line' and `find-function-after-hook'."
  (interactive (find-function-read))
  (find-function-do-it function nil 'switch-to-buffer))
Dave Love's avatar
Dave Love committed
348

349
;;;###autoload
350
(defun find-function-other-window (function)
Dave Love's avatar
Dave Love committed
351
  "Find, in another window, the definition of FUNCTION near point.
Dave Love's avatar
Dave Love committed
352

353 354 355
See `find-function' for more details."
  (interactive (find-function-read))
  (find-function-do-it function nil 'switch-to-buffer-other-window))
Dave Love's avatar
Dave Love committed
356

357
;;;###autoload
358
(defun find-function-other-frame (function)
359
  "Find, in another frame, the definition of FUNCTION near point.
Dave Love's avatar
Dave Love committed
360

361 362 363 364
See `find-function' for more details."
  (interactive (find-function-read))
  (find-function-do-it function nil 'switch-to-buffer-other-frame))

365
;;;###autoload
366
(defun find-variable-noselect (variable &optional file)
367
  "Return a pair `(BUFFER . POINT)' pointing to the definition of VARIABLE.
368

369 370
Finds the library containing the definition of VARIABLE in a buffer and
the point of the definition.  The buffer is not selected.
371

372
The library where VARIABLE is defined is searched for in FILE or
Richard M. Stallman's avatar
Richard M. Stallman committed
373
`find-function-source-path', if non nil, otherwise in `load-path'."
374
  (if (not variable)
375 376 377 378 379
      (error "You didn't specify a variable")
    (let ((library (or file
                       (symbol-file variable 'defvar)
                       (help-C-file-name variable 'var))))
      (find-function-search-for-symbol variable 'defvar library))))
380 381 382

;;;###autoload
(defun find-variable (variable)
Dave Love's avatar
Dave Love committed
383
  "Find the definition of the VARIABLE near point.
384

385
Finds the library containing the definition of the variable
386
near point (selected by `variable-at-point') in a buffer and
Richard M. Stallman's avatar
Richard M. Stallman committed
387 388 389
places point before the definition.

Set mark before moving, if the buffer already existed.
390 391

The library where VARIABLE is defined is searched for in
Richard M. Stallman's avatar
Richard M. Stallman committed
392
`find-function-source-path', if non nil, otherwise in `load-path'.
393
See also `find-function-recenter-line' and `find-function-after-hook'."
394 395
  (interactive (find-function-read 'defvar))
  (find-function-do-it variable 'defvar 'switch-to-buffer))
Dave Love's avatar
Dave Love committed
396

397 398
;;;###autoload
(defun find-variable-other-window (variable)
Dave Love's avatar
Dave Love committed
399
  "Find, in another window, the definition of VARIABLE near point.
400 401

See `find-variable' for more details."
402 403
  (interactive (find-function-read 'defvar))
  (find-function-do-it variable 'defvar 'switch-to-buffer-other-window))
404 405 406

;;;###autoload
(defun find-variable-other-frame (variable)
407
  "Find, in another frame, the definition of VARIABLE near point.
408 409

See `find-variable' for more details."
410 411
  (interactive (find-function-read 'defvar))
  (find-function-do-it variable 'defvar 'switch-to-buffer-other-frame))
Dave Love's avatar
Dave Love committed
412

Richard M. Stallman's avatar
Richard M. Stallman committed
413 414 415
;;;###autoload
(defun find-definition-noselect (symbol type &optional file)
  "Return a pair `(BUFFER . POINT)' pointing to the definition of SYMBOL.
416 417 418
TYPE says what type of definition: nil for a function, `defvar' for a
variabke, `defface' for a face.  This function does not switch to the
buffer nor display it.
Richard M. Stallman's avatar
Richard M. Stallman committed
419 420 421

The library where SYMBOL is defined is searched for in FILE or
`find-function-source-path', if non nil, otherwise in `load-path'."
422 423 424 425 426 427 428 429
  (cond
   ((not symbol)
    (error "You didn't specify a symbol"))
   ((null type)
    (find-function-noselect symbol))
   ((eq type 'defvar)
    (find-variable-noselect symbol file))
   (t
Richard M. Stallman's avatar
Richard M. Stallman committed
430
    (let ((library (or file (symbol-file symbol type))))
431
      (find-function-search-for-symbol symbol type library)))))
Richard M. Stallman's avatar
Richard M. Stallman committed
432

433 434
;; For symmetry, this should be called find-face; but some programs
;; assume that, if that name is defined, it means something else.
Richard M. Stallman's avatar
Richard M. Stallman committed
435
;;;###autoload
436
(defun find-face-definition (face)
Richard M. Stallman's avatar
Richard M. Stallman committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450
  "Find the definition of FACE.  FACE defaults to the name near point.

Finds the Emacs Lisp library containing the definition of the face
near point (selected by `variable-at-point') in a buffer and
places point before the definition.

Set mark before moving, if the buffer already existed.

The library where FACE is defined is searched for in
`find-function-source-path', if non nil, otherwise in `load-path'.
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))

451
;;;###autoload
Dave Love's avatar
Dave Love committed
452 453
(defun find-function-on-key (key)
  "Find the function that KEY invokes.  KEY is a string.
Richard M. Stallman's avatar
Richard M. Stallman committed
454
Set mark before moving, if the buffer already existed."
Dave Love's avatar
Dave Love committed
455
  (interactive "kFind function on key: ")
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
  (let (defn)
    (save-excursion
      (let* ((event (and (eventp key) (aref key 0))) ; Null event OK below.
	     (start (event-start event))
	     (modifiers (event-modifiers event))
	     (window (and (or (memq 'click modifiers) (memq 'down modifiers)
			      (memq 'drag modifiers))
			  (posn-window start))))
	;; For a mouse button event, go to the button it applies to
	;; to get the right key bindings.  And go to the right place
	;; in case the keymap depends on where you clicked.
	(when (windowp window)
	  (set-buffer (window-buffer window))
	  (goto-char (posn-point start)))
	(setq defn (key-binding key))))
    (let ((key-desc (key-description key)))
      (if (or (null defn) (integerp defn))
	  (message "%s is unbound" key-desc)
	(if (consp defn)
	    (message "%s runs %s" key-desc (prin1-to-string defn))
	  (find-function-other-window defn))))))
477 478 479 480 481

;;;###autoload
(defun find-function-at-point ()
  "Find directly the function at point in the other window."
  (interactive)
482
  (let ((symb (function-called-at-point)))
483 484 485 486 487
    (when symb
      (find-function-other-window symb))))

;;;###autoload
(defun find-variable-at-point ()
488
  "Find directly the variable at point in the other window."
489 490 491 492
  (interactive)
  (let ((symb (variable-at-point)))
    (when (and symb (not (equal symb 0)))
      (find-variable-other-window symb))))
Dave Love's avatar
Dave Love committed
493

494 495 496 497 498 499 500 501 502 503 504
;;;###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))

Dave Love's avatar
Dave Love committed
505 506
(provide 'find-func)

507
;; arch-tag: 43ecd81c-74dc-4d9a-8f63-a61e55670d64
Dave Love's avatar
Dave Love committed
508
;;; find-func.el ends here