Mercurial > emacs
annotate lisp/emacs-lisp/find-func.el @ 22841:330629423307
(push_key_description): Output multibyte char as itself.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 28 Jul 1998 23:10:44 +0000 |
parents | be3e1a724828 |
children | 2c2eb47ec8e3 |
rev | line source |
---|---|
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
1 ;;; find-func.el --- find the definition of the Emacs Lisp function near point |
20183 | 2 |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Jens Petersen <petersen@kurims.kyoto-u.ac.jp> | |
6 ;; Maintainer: petersen@kurims.kyoto-u.ac.jp | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
7 ;; Keywords: emacs-lisp, functions, variables |
20183 | 8 ;; Created: 97/07/25 |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
27 ;;; Commentary: | |
28 ;; | |
29 ;; The funniest thing about this is that I can't imagine why a package | |
30 ;; so obviously useful as this hasn't been written before!! | |
31 ;; | |
32 ;; Put this file in your `load-path', byte-compile it and add the | |
33 ;; following code in your init file: | |
34 ;; | |
35 ;; ;;; find-func | |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
36 ;; (find-function-setup-keys) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
37 ;; |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
38 ;; or just: |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
39 ;; |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
40 ;; (load "find-func") |
20183 | 41 ;; |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
42 ;; if you don't like the given keybindings and away you go! It does |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
43 ;; pretty much what you would expect, putting the cursor at the |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
44 ;; definition of the function or variable at point. |
20183 | 45 ;; |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
46 ;; The code started out from `describe-function', `describe-key' |
20183 | 47 ;; ("help.el") and `fff-find-loaded-emacs-lisp-function' (Noah Friedman's |
48 ;; "fff.el"). | |
49 | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
50 ;;;; Code: |
20183 | 51 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
52 (require 'loadhist) |
20183 | 53 |
54 ;;; User variables: | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
55 |
20962 | 56 (defgroup find-function nil |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
57 "Finds the definition of the Emacs Lisp symbol near point." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
58 ;; :prefix "find-function" |
20962 | 59 :group 'lisp) |
20183 | 60 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
61 (defcustom find-function-regexp |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
62 "^\\s-*(def[^cgv\W]\\w+\\*?\\s-+%s\\(\\s-\\|$\\)" |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
63 "The regexp used by `find-function' to search for a function |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
64 definition. Note it must contain a `%s' at the place where `format' |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
65 should insert the function name. The default value avoids `defconst', |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
66 `defgroup', `defvar'. |
20183 | 67 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
68 Please send improvements and fixes to the maintainer." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
69 :type 'regexp |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
70 :group 'find-function |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
71 :version 20.3) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
72 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
73 (defcustom find-variable-regexp |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
74 "^\\s-*(def[^uma\W]\\w+\\*?\\s-+%s\\(\\s-\\|$\\)" |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
75 "The regexp used by `find-variable' to search for a variable definition. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
76 It should match right up to the variable name. The default value |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
77 avoids `defun', `defmacro', `defalias', `defadvice'. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
78 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
79 Please send improvements and fixes to the maintainer." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
80 :type 'regexp |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
81 :group 'find-function |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
82 :version 20.3) |
20183 | 83 |
20962 | 84 (defcustom find-function-source-path nil |
20183 | 85 "The default list of directories where find-function searches. |
86 | |
87 If this variable is `nil' then find-function searches `load-path' by | |
20962 | 88 default." |
89 :type '(repeat directory) | |
90 :group 'find-function) | |
20183 | 91 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
92 (defcustom find-function-recenter-line 1 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
93 "The window line-number from which to start displaying a symbol definition. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
94 A value of nil implies center the beginning of the definition. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
95 See the function `center-to-window-line' for more information, and |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
96 `find-function' and `find-variable'." |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
97 :group 'find-function |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
98 :version 20.3) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
99 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
100 (defcustom find-function-after-hook nil |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
101 "Hook run after finding symbol definition. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
102 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
103 See the functions `find-function' and `find-variable'." |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
104 :group 'find-function |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
105 :version 20.3) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
106 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
107 ;;; Functions: |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
108 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
109 (defun find-function-search-for-symbol (symbol variable-p library) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
110 "Search for SYMBOL in LIBRARY. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
111 If VARIABLE-P is nil, `find-function-regexp' is used, otherwise |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
112 `find-variable-regexp' is used." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
113 (if (null library) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
114 (error "Don't know where `%s' is defined" symbol)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
115 (if (string-match "\\.el\\(c\\)\\'" library) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
116 (setq library (substring library 0 (match-beginning 1)))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
117 (let* ((path find-function-source-path) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
118 (filename (if (file-exists-p library) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
119 library |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
120 ;; use `file-name-sans-extension' here? (if it gets fixed) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
121 (if (string-match "\\(\\.el\\)\\'" library) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
122 (setq library (substring library 0 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
123 (match-beginning 1)))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
124 (or (locate-library (concat library ".el") t path) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
125 (locate-library library t path))))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
126 (if (not filename) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
127 (error "The library \"%s\" is not in the path." library)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
128 (with-current-buffer (find-file-noselect filename) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
129 (save-match-data |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
130 (let ((regexp (format (if variable-p |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
131 find-variable-regexp |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
132 find-function-regexp) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
133 (regexp-quote (symbol-name symbol)))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
134 (syn-table (syntax-table))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
135 (unwind-protect |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
136 (progn |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
137 (set-syntax-table emacs-lisp-mode-syntax-table) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
138 (goto-char (point-min)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
139 (if (re-search-forward regexp nil t) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
140 (progn |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
141 (beginning-of-line) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
142 (cons (current-buffer) (point))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
143 (error "Cannot find definition of `%s' in library \"%s\"" |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
144 symbol library))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
145 (set-syntax-table syn-table))))))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
146 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
147 (defun find-function-noselect (function) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
148 "Returns a pair (BUFFER . POINT) pointing to the definition of FUNCTION. |
20183 | 149 |
150 Finds the Emacs Lisp library containing the definition of FUNCTION | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
151 in a buffer and the point of the definition. The buffer is |
20183 | 152 not selected. |
153 | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
154 If the file where FUNCTION is defined is not known, then it is |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
155 searched for in `find-function-source-path' if non `nil', otherwise |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
156 in `load-path'." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
157 (if (not function) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
158 (error "You didn't specify a function")) |
20183 | 159 (and (subrp (symbol-function function)) |
160 (error "%s is a primitive function" function)) | |
161 (let ((def (symbol-function function)) | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
162 aliases) |
20183 | 163 (while (symbolp def) |
164 (or (eq def function) | |
165 (if aliases | |
166 (setq aliases (concat aliases | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
167 (format ", which is an alias for `%s'" |
20183 | 168 (symbol-name def)))) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
169 (setq aliases (format "`%s' an alias for `%s'" |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
170 function (symbol-name def))))) |
20183 | 171 (setq function (symbol-function function) |
172 def (symbol-function function))) | |
173 (if aliases | |
174 (message aliases)) | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
175 (let ((library |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
176 (cond ((eq (car-safe def) 'autoload) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
177 (nth 1 def)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
178 ((symbol-file function))))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
179 (find-function-search-for-symbol function nil library)))) |
20183 | 180 |
181 (defun function-at-point () | |
182 (or (condition-case () | |
183 (let ((stab (syntax-table))) | |
184 (unwind-protect | |
185 (save-excursion | |
186 (set-syntax-table emacs-lisp-mode-syntax-table) | |
187 (or (not (zerop (skip-syntax-backward "_w"))) | |
188 (eq (char-syntax (char-after (point))) ?w) | |
189 (eq (char-syntax (char-after (point))) ?_) | |
190 (forward-sexp -1)) | |
191 (skip-chars-forward "`'") | |
192 (let ((obj (read (current-buffer)))) | |
193 (and (symbolp obj) (fboundp obj) obj))) | |
194 (set-syntax-table stab))) | |
195 (error nil)) | |
196 (condition-case () | |
197 (save-excursion | |
198 (save-restriction | |
199 (narrow-to-region (max (point-min) (- (point) 1000)) (point-max)) | |
200 (backward-up-list 1) | |
201 (forward-char 1) | |
202 (let (obj) | |
203 (setq obj (read (current-buffer))) | |
204 (and (symbolp obj) (fboundp obj) obj)))) | |
205 (error nil)))) | |
206 | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
207 (defun find-function-read (&optional variable-p) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
208 "Read and return an interned symbol, defaulting to the one near point. |
20183 | 209 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
210 If the optional VARIABLE-P is nil, then a function is gotten |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
211 defaulting to the value of the function `function-at-point', otherwise |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
212 a variable is asked for, with the default coming from |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
213 `variable-at-point'." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
214 (let ((symb (funcall (if variable-p |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
215 'variable-at-point |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
216 'function-at-point))) |
20183 | 217 (enable-recursive-minibuffers t) |
218 val) | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
219 (if (equal symb 0) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
220 (setq symb nil)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
221 (setq val (if variable-p |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
222 (completing-read |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
223 (concat "Find variable" |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
224 (if symb |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
225 (format " (default %s)" symb)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
226 ": ") |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
227 obarray 'boundp t nil) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
228 (completing-read |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
229 (concat "Find function" |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
230 (if symb |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
231 (format " (default %s)" symb)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
232 ": ") |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
233 obarray 'fboundp t nil))) |
20183 | 234 (list (if (equal val "") |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
235 symb |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
236 (intern val))))) |
20183 | 237 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
238 (defun find-function-do-it (symbol variable-p switch-fn) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
239 "Find Emacs Lisp SYMBOL in a buffer and display it with SWITCH-FN. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
240 If VARIABLE-P is nil, a function definition is searched for, otherwise |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
241 a variable definition is searched for. The start of a definition is |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
242 centered according to the variable `find-function-recenter-line'. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
243 See also `find-function-after-hook'. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
244 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
245 Point is saved in the buffer if it is one of the current buffers." |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
246 (let* ((orig-point (point)) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
247 (orig-buf (window-buffer)) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
248 (orig-buffers (buffer-list)) |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
249 (buffer-point (save-excursion |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
250 (funcall (if variable-p |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
251 'find-variable-noselect |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
252 'find-function-noselect) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
253 symbol))) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
254 (new-buf (car buffer-point)) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
255 (new-point (cdr buffer-point))) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
256 (when buffer-point |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
257 (when (memq new-buf orig-buffers) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
258 (push-mark orig-point)) |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
259 (funcall switch-fn new-buf) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
260 (goto-char new-point) |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
261 (recenter find-function-recenter-line) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
262 (run-hooks find-function-after-hook)))) |
20183 | 263 |
20184
c8d4024e07de
(find-function, find-function-other-window, find-function-other-frame,
Dave Love <fx@gnu.org>
parents:
20183
diff
changeset
|
264 ;;;###autoload |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
265 (defun find-function (function) |
20183 | 266 "Find the definition of the function near point in the current window. |
267 | |
268 Finds the Emacs Lisp library containing the definition of the function | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
269 near point (selected by `function-at-point') in a buffer and |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
270 places point before the definition. Point is saved in the buffer if |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
271 it is one of the current buffers. |
20183 | 272 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
273 The library where FUNCTION is defined is searched for in |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
274 `find-function-source-path', if non `nil', otherwise in `load-path'. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
275 See also `find-function-recenter-line' and `find-function-after-hook'." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
276 (interactive (find-function-read)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
277 (find-function-do-it function nil 'switch-to-buffer)) |
20183 | 278 |
20184
c8d4024e07de
(find-function, find-function-other-window, find-function-other-frame,
Dave Love <fx@gnu.org>
parents:
20183
diff
changeset
|
279 ;;;###autoload |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
280 (defun find-function-other-window (function) |
20183 | 281 "Find the definition of the function near point in the other window. |
282 | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
283 See `find-function' for more details." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
284 (interactive (find-function-read)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
285 (find-function-do-it function nil 'switch-to-buffer-other-window)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
286 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
287 ;;;###autoload |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
288 (defun find-function-other-frame (function) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
289 "Find the definition of the function near point in the another frame. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
290 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
291 See `find-function' for more details." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
292 (interactive (find-function-read)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
293 (find-function-do-it function nil 'switch-to-buffer-other-frame)) |
20183 | 294 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
295 (defun find-variable-noselect (variable) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
296 "Returns a pair `(buffer . point)' pointing to the definition of SYMBOL. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
297 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
298 Finds the Emacs Lisp library containing the definition of SYMBOL |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
299 in a buffer and the point of the definition. The buffer is |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
300 not selected. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
301 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
302 The library where VARIABLE is defined is searched for in |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
303 `find-function-source-path', if non `nil', otherwise in `load-path'." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
304 (if (not variable) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
305 (error "You didn't specify a variable")) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
306 (let ((library (symbol-file variable))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
307 (find-function-search-for-symbol variable 'variable library))) |
20183 | 308 |
20184
c8d4024e07de
(find-function, find-function-other-window, find-function-other-frame,
Dave Love <fx@gnu.org>
parents:
20183
diff
changeset
|
309 ;;;###autoload |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
310 (defun find-variable (variable) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
311 "Find the definition of the variable near point in the current window. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
312 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
313 Finds the Emacs Lisp library containing the definition of the variable |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
314 near point (selected by `variable-at-point') in a buffer and |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
315 places point before the definition. Point is saved in the buffer if |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
316 it is one of the current buffers. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
317 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
318 The library where VARIABLE is defined is searched for in |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
319 `find-function-source-path', if non `nil', otherwise in `load-path'. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
320 See also `find-function-recenter-line' and `find-function-after-hook'." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
321 (interactive (find-function-read 'variable)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
322 (find-function-do-it variable t 'switch-to-buffer)) |
20183 | 323 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
324 ;;;###autoload |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
325 (defun find-variable-other-window (variable) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
326 "Find the definition of the variable near point in the other window. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
327 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
328 See `find-variable' for more details." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
329 (interactive (find-function-read 'variable)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
330 (find-function-do-it variable t 'switch-to-buffer-other-window)) |
20183 | 331 |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
332 ;;;###autoload |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
333 (defun find-variable-other-frame (variable) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
334 "Find the definition of the variable near point in the another frame. |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
335 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
336 See `find-variable' for more details." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
337 (interactive (find-function-read 'variable)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
338 (find-function-do-it variable t 'switch-to-buffer-other-frame)) |
20183 | 339 |
20184
c8d4024e07de
(find-function, find-function-other-window, find-function-other-frame,
Dave Love <fx@gnu.org>
parents:
20183
diff
changeset
|
340 ;;;###autoload |
20183 | 341 (defun find-function-on-key (key) |
342 "Find the function that KEY invokes. KEY is a string. | |
343 Point is saved if FUNCTION is in the current buffer." | |
344 (interactive "kFind function on key: ") | |
22641
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
345 (let ((defn (key-binding key)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
346 (key-desc (key-description key))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
347 (if (or (null defn) (integerp defn)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
348 (message "%s is unbound" key-desc) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
349 (if (consp defn) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
350 (message "%s runs %s" key-desc (prin1-to-string defn)) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
351 (find-function-other-window defn))))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
352 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
353 ;;;###autoload |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
354 (defun find-function-at-point () |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
355 "Find directly the function at point in the other window." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
356 (interactive) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
357 (let ((symb (function-at-point))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
358 (when symb |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
359 (find-function-other-window symb)))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
360 |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
361 ;;;###autoload |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
362 (defun find-variable-at-point () |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
363 "Find directly the function at point in the other window." |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
364 (interactive) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
365 (let ((symb (variable-at-point))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
366 (when (and symb (not (equal symb 0))) |
1c5197790616
Require `loadhist'. Variable
Richard M. Stallman <rms@gnu.org>
parents:
22487
diff
changeset
|
367 (find-variable-other-window symb)))) |
20183 | 368 |
22759
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
369 ;;;###autoload |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
370 (defun find-function-setup-keys () |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
371 "Define some key bindings for the find-function family of functions." |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
372 (define-key ctl-x-map "F" 'find-function) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
373 (define-key ctl-x-4-map "F" 'find-function-other-window) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
374 (define-key ctl-x-5-map "F" 'find-function-other-frame) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
375 (define-key ctl-x-map "K" 'find-function-on-key) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
376 (define-key ctl-x-map "V" 'find-variable) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
377 (define-key ctl-x-4-map "V" 'find-variable-other-window) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
378 (define-key ctl-x-5-map "V" 'find-variable-other-frame)) |
be3e1a724828
(find-function-regexp): Added :version 20.3.
Richard M. Stallman <rms@gnu.org>
parents:
22641
diff
changeset
|
379 |
20183 | 380 (provide 'find-func) |
381 | |
382 ;;; find-func.el ends here |