Mercurial > emacs
comparison lisp/progmodes/etags.el @ 360:066d9d0dd901
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sun, 28 Jul 1991 13:34:25 +0000 |
parents | 8bfd98a0dcdd |
children | 4a1a5ad2d9d0 |
comparison
equal
deleted
inserted
replaced
359:da45fa7bc8d1 | 360:066d9d0dd901 |
---|---|
16 ;; You should have received a copy of the GNU General Public License | 16 ;; You should have received a copy of the GNU General Public License |
17 ;; along with GNU Emacs; see the file COPYING. If not, write to | 17 ;; along with GNU Emacs; see the file COPYING. If not, write to |
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | 19 |
20 | 20 |
21 (provide 'tags) | 21 (provide 'etags) |
22 | |
23 ;;;###autoload | |
24 (defvar tags-file-name nil "\ | |
25 *File name of tag table. | |
26 To switch to a new tag table, setting this variable is sufficient. | |
27 Use the `etags' program to make a tag table file.") | |
22 | 28 |
23 (defvar tag-table-files nil | 29 (defvar tag-table-files nil |
24 "List of file names covered by current tag table. | 30 "List of file names covered by current tag table. |
25 nil means it has not been computed yet; do (tag-table-files) to compute it.") | 31 nil means it has not been computed yet; do (tag-table-files) to compute it.") |
26 | 32 |
27 (defvar last-tag nil | 33 (defvar last-tag nil |
28 "Tag found by the last find-tag.") | 34 "Tag found by the last find-tag.") |
29 | 35 |
36 ;;;###autoload | |
30 (defun visit-tags-table (file) | 37 (defun visit-tags-table (file) |
31 "Tell tags commands to use tag table file FILE. | 38 "Tell tags commands to use tag table file FILE. |
32 FILE should be the name of a file created with the `etags' program. | 39 FILE should be the name of a file created with the `etags' program. |
33 A directory name is ok too; it means file TAGS in that directory." | 40 A directory name is ok too; it means file TAGS in that directory." |
34 (interactive (list (read-file-name "Visit tags table: (default TAGS) " | 41 (interactive (list (read-file-name "Visit tags table: (default TAGS) " |
76 (forward-char size)) | 83 (forward-char size)) |
77 (goto-char (1- prev)) | 84 (goto-char (1- prev)) |
78 (buffer-substring (point) | 85 (buffer-substring (point) |
79 (progn (beginning-of-line) (point)))))) | 86 (progn (beginning-of-line) (point)))))) |
80 | 87 |
88 ;;;###autoload | |
81 (defun tag-table-files () | 89 (defun tag-table-files () |
82 "Return a list of files in the current tag table. | 90 "Return a list of files in the current tag table. |
83 File names returned are absolute." | 91 File names returned are absolute." |
84 (save-excursion | 92 (save-excursion |
85 (visit-tags-table-buffer) | 93 (visit-tags-table-buffer) |
126 string)))) | 134 string)))) |
127 (list (if (equal spec "") | 135 (list (if (equal spec "") |
128 default | 136 default |
129 spec)))) | 137 spec)))) |
130 | 138 |
139 ;;;###autoload | |
131 (defun find-tag (tagname &optional next other-window) | 140 (defun find-tag (tagname &optional next other-window) |
132 "Find tag (in current tag table) whose name contains TAGNAME. | 141 "Find tag (in current tag table) whose name contains TAGNAME. |
133 Selects the buffer that the tag is contained in | 142 Selects the buffer that the tag is contained in |
134 and puts point at its definition. | 143 and puts point at its definition. |
135 If TAGNAME is a null string, the expression in the buffer | 144 If TAGNAME is a null string, the expression in the buffer |
184 (beginning-of-line)) | 193 (beginning-of-line)) |
185 (setq tags-loop-form '(find-tag nil t)) | 194 (setq tags-loop-form '(find-tag nil t)) |
186 ;; Return t in case used as the tags-loop-form. | 195 ;; Return t in case used as the tags-loop-form. |
187 t) | 196 t) |
188 | 197 |
198 ;;;###autoload | |
199 (define-key esc-map "." 'find-tag) | |
200 | |
201 ;;;###autoload | |
189 (defun find-tag-other-window (tagname &optional next) | 202 (defun find-tag-other-window (tagname &optional next) |
190 "Find tag (in current tag table) whose name contains TAGNAME. | 203 "Find tag (in current tag table) whose name contains TAGNAME. |
191 Selects the buffer that the tag is contained in in another window | 204 Selects the buffer that the tag is contained in in another window |
192 and puts point at its definition. | 205 and puts point at its definition. |
193 If TAGNAME is a null string, the expression in the buffer | 206 If TAGNAME is a null string, the expression in the buffer |
199 See documentation of variable tags-file-name." | 212 See documentation of variable tags-file-name." |
200 (interactive (if current-prefix-arg | 213 (interactive (if current-prefix-arg |
201 '(nil t) | 214 '(nil t) |
202 (find-tag-tag "Find tag other window: "))) | 215 (find-tag-tag "Find tag other window: "))) |
203 (find-tag tagname next t)) | 216 (find-tag tagname next t)) |
217 ;;;###autoload | |
218 (define-key ctl-x-4-map "." 'find-tag-other-window) | |
204 | 219 |
205 (defvar next-file-list nil | 220 (defvar next-file-list nil |
206 "List of files for next-file to process.") | 221 "List of files for next-file to process.") |
207 | 222 |
223 ;;;###autoload | |
208 (defun next-file (&optional initialize) | 224 (defun next-file (&optional initialize) |
209 "Select next file among files in current tag table. | 225 "Select next file among files in current tag table. |
210 Non-nil argument (prefix arg, if interactive) | 226 Non-nil argument (prefix arg, if interactive) |
211 initializes to the beginning of the list of files in the tag table." | 227 initializes to the beginning of the list of files in the tag table." |
212 (interactive "P") | 228 (interactive "P") |
219 | 235 |
220 (defvar tags-loop-form nil | 236 (defvar tags-loop-form nil |
221 "Form for tags-loop-continue to eval to process one file. | 237 "Form for tags-loop-continue to eval to process one file. |
222 If it returns nil, it is through with one file; move on to next.") | 238 If it returns nil, it is through with one file; move on to next.") |
223 | 239 |
240 ;;;###autoload | |
224 (defun tags-loop-continue (&optional first-time) | 241 (defun tags-loop-continue (&optional first-time) |
225 "Continue last \\[tags-search] or \\[tags-query-replace] command. | 242 "Continue last \\[tags-search] or \\[tags-query-replace] command. |
226 Used noninteractively with non-nil argument | 243 Used noninteractively with non-nil argument |
227 to begin such a command. See variable tags-loop-form." | 244 to begin such a command. See variable tags-loop-form." |
228 (interactive) | 245 (interactive) |
231 (goto-char (point-min)))) | 248 (goto-char (point-min)))) |
232 (while (not (eval tags-loop-form)) | 249 (while (not (eval tags-loop-form)) |
233 (next-file) | 250 (next-file) |
234 (message "Scanning file %s..." buffer-file-name) | 251 (message "Scanning file %s..." buffer-file-name) |
235 (goto-char (point-min)))) | 252 (goto-char (point-min)))) |
236 | 253 ;;;###autoload |
254 (define-key esc-map "," 'tags-loop-continue) | |
255 | |
256 ;;;###autoload | |
237 (defun tags-search (regexp) | 257 (defun tags-search (regexp) |
238 "Search through all files listed in tag table for match for REGEXP. | 258 "Search through all files listed in tag table for match for REGEXP. |
239 Stops when a match is found. | 259 Stops when a match is found. |
240 To continue searching for next match, use command \\[tags-loop-continue]. | 260 To continue searching for next match, use command \\[tags-loop-continue]. |
241 | 261 |
246 (tags-loop-continue nil) | 266 (tags-loop-continue nil) |
247 (setq tags-loop-form | 267 (setq tags-loop-form |
248 (list 're-search-forward regexp nil t)) | 268 (list 're-search-forward regexp nil t)) |
249 (tags-loop-continue t))) | 269 (tags-loop-continue t))) |
250 | 270 |
271 ;;;###autoload | |
251 (defun tags-query-replace (from to &optional delimited) | 272 (defun tags-query-replace (from to &optional delimited) |
252 "Query-replace-regexp FROM with TO through all files listed in tag table. | 273 "Query-replace-regexp FROM with TO through all files listed in tag table. |
253 Third arg DELIMITED (prefix arg) means replace only word-delimited matches. | 274 Third arg DELIMITED (prefix arg) means replace only word-delimited matches. |
254 If you exit (C-G or ESC), you can resume the query-replace | 275 If you exit (C-G or ESC), you can resume the query-replace |
255 with the command \\[tags-loop-continue]. | 276 with the command \\[tags-loop-continue]. |
261 (list 're-search-forward from nil t)) | 282 (list 're-search-forward from nil t)) |
262 (list 'not (list 'perform-replace from to t t | 283 (list 'not (list 'perform-replace from to t t |
263 (not (null delimited)))))) | 284 (not (null delimited)))))) |
264 (tags-loop-continue t)) | 285 (tags-loop-continue t)) |
265 | 286 |
287 ;;;###autoload | |
266 (defun list-tags (string) | 288 (defun list-tags (string) |
267 "Display list of tags in file FILE. | 289 "Display list of tags in file FILE. |
268 FILE should not contain a directory spec | 290 FILE should not contain a directory spec |
269 unless it has one in the tag table." | 291 unless it has one in the tag table." |
270 (interactive "sList tags (in file): ") | 292 (interactive "sList tags (in file): ") |
282 (progn (skip-chars-forward "^\177") | 304 (progn (skip-chars-forward "^\177") |
283 (point)))) | 305 (point)))) |
284 (terpri) | 306 (terpri) |
285 (forward-line 1))))) | 307 (forward-line 1))))) |
286 | 308 |
309 ;;;###autoload | |
287 (defun tags-apropos (string) | 310 (defun tags-apropos (string) |
288 "Display list of all tags in tag table REGEXP matches." | 311 "Display list of all tags in tag table REGEXP matches." |
289 (interactive "sTag apropos (regexp): ") | 312 (interactive "sTag apropos (regexp): ") |
290 (with-output-to-temp-buffer "*Tags List*" | 313 (with-output-to-temp-buffer "*Tags List*" |
291 (princ "Tags matching regexp ") | 314 (princ "Tags matching regexp ") |