Mercurial > emacs
comparison lisp/progmodes/etags.el @ 32311:035ce2227d76
Docstring fixes.
(initialize-new-tags-table): Use run-hook-with-args-until-success.
(find-tag): Use pop-to-buffer if switch-to-buffer failed.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 08 Oct 2000 19:25:30 +0000 |
parents | 8b7b0c7c65db |
children | 581b490bcb94 |
comparison
equal
deleted
inserted
replaced
32310:bb71607dc3db | 32311:035ce2227d76 |
---|---|
19 | 19 |
20 ;; You should have received a copy of the GNU General Public License | 20 ;; You should have received a copy of the GNU General Public License |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
23 ;; Boston, MA 02111-1307, USA. | 23 ;; Boston, MA 02111-1307, USA. |
24 | |
25 ;;; Commentary: | |
24 | 26 |
25 ;;; Code: | 27 ;;; Code: |
26 | 28 |
27 (require 'ring) | 29 (require 'ring) |
28 (eval-when-compile (require 'cl)) ; for `gensym' | 30 (eval-when-compile (require 'cl)) ; for `gensym' |
79 | 81 |
80 (defvar tags-table-computed-list nil | 82 (defvar tags-table-computed-list nil |
81 "List of tags tables to search, computed from `tags-table-list'. | 83 "List of tags tables to search, computed from `tags-table-list'. |
82 This includes tables implicitly included by other tables. The list is not | 84 This includes tables implicitly included by other tables. The list is not |
83 always complete: the included tables of a table are not known until that | 85 always complete: the included tables of a table are not known until that |
84 table is read into core. An element that is `t' is a placeholder | 86 table is read into core. An element that is t is a placeholder |
85 indicating that the preceding element is a table that has not been read | 87 indicating that the preceding element is a table that has not been read |
86 into core and might contain included tables to search. | 88 into core and might contain included tables to search. |
87 See `tags-table-check-computed-list'.") | 89 See `tags-table-check-computed-list'.") |
88 | 90 |
89 (defvar tags-table-computed-list-for nil | 91 (defvar tags-table-computed-list-for nil |
142 | 144 |
143 If non-nil, value should be a list of triples (TITLE FUNCTION | 145 If non-nil, value should be a list of triples (TITLE FUNCTION |
144 TO-SEARCH). For each triple, `tags-apropos' processes TO-SEARCH and | 146 TO-SEARCH). For each triple, `tags-apropos' processes TO-SEARCH and |
145 lists tags from it. TO-SEARCH should be an alist, obarray, or symbol. | 147 lists tags from it. TO-SEARCH should be an alist, obarray, or symbol. |
146 If it is a symbol, the symbol's value is used. | 148 If it is a symbol, the symbol's value is used. |
147 TITLE. a string, is a title used to label the additional list of tags. | 149 TITLE, a string, is a title used to label the additional list of tags. |
148 FUNCTION is a function to call when a symbol is selected in the | 150 FUNCTION is a function to call when a symbol is selected in the |
149 *Tags List* buffer. It will be called with one argument SYMBOL which | 151 *Tags List* buffer. It will be called with one argument SYMBOL which |
150 is the symbol being selected. | 152 is the symbol being selected. |
151 | 153 |
152 Example value: | 154 Example value: |
188 | 190 |
189 ;; Hooks for file formats. | 191 ;; Hooks for file formats. |
190 | 192 |
191 (defvar tags-table-format-hooks '(etags-recognize-tags-table | 193 (defvar tags-table-format-hooks '(etags-recognize-tags-table |
192 tags-recognize-empty-tags-table) | 194 tags-recognize-empty-tags-table) |
193 "List of functions to be called in a tags table buffer to identify the type of tags table. | 195 "Hook to be called in a tags table buffer to identify the type of tags table. |
194 The functions are called in order, with no arguments, | 196 The functions are called in order, with no arguments, |
195 until one returns non-nil. The function should make buffer-local bindings | 197 until one returns non-nil. The function should make buffer-local bindings |
196 of the format-parsing tags function variables if successful.") | 198 of the format-parsing tags function variables if successful.") |
197 | 199 |
198 (defvar file-of-tag-function nil | 200 (defvar file-of-tag-function nil |
199 "Function to do the work of `file-of-tag' (which see).") | 201 "Function to do the work of `file-of-tag' (which see).") |
200 (defvar tags-table-files-function nil | 202 (defvar tags-table-files-function nil |
201 "Function to do the work of `tags-table-files' (which see).") | 203 "Function to do the work of `tags-table-files' (which see).") |
202 (defvar tags-completion-table-function nil | 204 (defvar tags-completion-table-function nil |
203 "Function to build the tags-completion-table.") | 205 "Function to build the `tags-completion-table'.") |
204 (defvar snarf-tag-function nil | 206 (defvar snarf-tag-function nil |
205 "Function to get info about a matched tag for `goto-tag-location-function'.") | 207 "Function to get info about a matched tag for `goto-tag-location-function'.") |
206 (defvar goto-tag-location-function nil | 208 (defvar goto-tag-location-function nil |
207 "Function of to go to the location in the buffer specified by a tag. | 209 "Function of to go to the location in the buffer specified by a tag. |
208 One argument, the tag info returned by `snarf-tag-function'.") | 210 One argument, the tag info returned by `snarf-tag-function'.") |
238 ;; We used to initialize find-tag-marker-ring and tags-location-ring | 240 ;; We used to initialize find-tag-marker-ring and tags-location-ring |
239 ;; here, to new empty rings. But that is wrong, because those | 241 ;; here, to new empty rings. But that is wrong, because those |
240 ;; are global. | 242 ;; are global. |
241 | 243 |
242 ;; Value is t if we have found a valid tags table buffer. | 244 ;; Value is t if we have found a valid tags table buffer. |
243 (let ((hooks tags-table-format-hooks)) | 245 (run-hook-with-args-until-success 'tags-table-format-hooks)) |
244 (while (and hooks | |
245 (not (funcall (car hooks)))) | |
246 (setq hooks (cdr hooks))) | |
247 hooks)) | |
248 | 246 |
249 ;;;###autoload | 247 ;;;###autoload |
250 (defun visit-tags-table (file &optional local) | 248 (defun visit-tags-table (file &optional local) |
251 "Tell tags commands to use tags table file FILE. | 249 "Tell tags commands to use tags table file FILE. |
252 FILE should be the name of a file created with the `etags' program. | 250 FILE should be the name of a file created with the `etags' program. |
884 onto a ring and may be popped back to with \\[pop-tag-mark]. | 882 onto a ring and may be popped back to with \\[pop-tag-mark]. |
885 Contrast this with the ring of marks gone to by the command. | 883 Contrast this with the ring of marks gone to by the command. |
886 | 884 |
887 See documentation of variable `tags-file-name'." | 885 See documentation of variable `tags-file-name'." |
888 (interactive (find-tag-interactive "Find tag: ")) | 886 (interactive (find-tag-interactive "Find tag: ")) |
889 (switch-to-buffer (find-tag-noselect tagname next-p regexp-p))) | 887 (let ((buf (find-tag-noselect tagname next-p regexp-p))) |
888 (condition-case nil | |
889 (switch-to-buffer buf) | |
890 (error (pop-to-buffer buf))))) | |
890 ;;;###autoload (define-key esc-map "." 'find-tag) | 891 ;;;###autoload (define-key esc-map "." 'find-tag) |
891 | 892 |
892 ;;;###autoload | 893 ;;;###autoload |
893 (defun find-tag-other-window (tagname &optional next-p regexp-p) | 894 (defun find-tag-other-window (tagname &optional next-p regexp-p) |
894 "Find tag (in current tags table) whose name contains TAGNAME. | 895 "Find tag (in current tags table) whose name contains TAGNAME. |
1627 tags-loop-operate nil) | 1628 tags-loop-operate nil) |
1628 (tags-loop-continue (or file-list-form t)))) | 1629 (tags-loop-continue (or file-list-form t)))) |
1629 | 1630 |
1630 ;;;###autoload | 1631 ;;;###autoload |
1631 (defun tags-query-replace (from to &optional delimited file-list-form start end) | 1632 (defun tags-query-replace (from to &optional delimited file-list-form start end) |
1632 "Query-replace-regexp FROM with TO through all files listed in tags table. | 1633 "`Query-replace-regexp' FROM with TO through all files listed in tags table. |
1633 Third arg DELIMITED (prefix arg) means replace only word-delimited matches. | 1634 Third arg DELIMITED (prefix arg) means replace only word-delimited matches. |
1634 If you exit (\\[keyboard-quit] or ESC), you can resume the query-replace | 1635 If you exit (\\[keyboard-quit] or ESC), you can resume the query-replace |
1635 with the command \\[tags-loop-continue]. | 1636 with the command \\[tags-loop-continue]. |
1636 | 1637 |
1637 See documentation of variable `tags-file-name'." | 1638 See documentation of variable `tags-file-name'." |