Mercurial > emacs
comparison lisp/progmodes/etags.el @ 29080:3b2040b6030a
Add to debug-ignored-errors.
(visit-tags-table-buffer): Clear out buffers holding old tables when
making a new list.
(etags-recognize-tags-table, tags-recognize-empty-tags-table): Use mapc.
(tags-with-face): Use make-symbol, not gensym.
author | Dave Love <fx@gnu.org> |
---|---|
date | Mon, 22 May 2000 18:03:36 +0000 |
parents | d53c2c6bc56f |
children | a4b321043588 |
comparison
equal
deleted
inserted
replaced
29079:3313f117f0ed | 29080:3b2040b6030a |
---|---|
1 ;;; etags.el --- etags facility for Emacs | 1 ;;; etags.el --- etags facility for Emacs |
2 ;; Copyright (C) 1985, 1986, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1998 | 2 ;; Copyright (C) 1985, 86, 88, 89, 92, 93, 94, 95, 96, 98, 2000 |
3 ;; Free Software Foundation, Inc. | 3 ;; Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Roland McGrath <roland@gnu.org> | 5 ;; Author: Roland McGrath <roland@gnu.org> |
6 ;; Keywords: tools | 6 ;; Keywords: tools |
7 | 7 |
631 (or (null tags-table-list) | 631 (or (null tags-table-list) |
632 (memq tags-table-list tags-table-set-list) | 632 (memq tags-table-list tags-table-set-list) |
633 (setq tags-table-set-list | 633 (setq tags-table-set-list |
634 (cons tags-table-list | 634 (cons tags-table-list |
635 tags-table-set-list))) | 635 tags-table-set-list))) |
636 ;; Clear out buffers holding old tables. | |
637 (dolist (table tags-table-list) | |
638 (let ((buffer (find-buffer-visiting table))) | |
639 (if buffer | |
640 (kill-buffer buffer)))) | |
636 (setq tags-table-list (list local-tags-file-name)))) | 641 (setq tags-table-list (list local-tags-file-name)))) |
637 | 642 |
638 ;; Recompute tags-table-computed-list. | 643 ;; Recompute tags-table-computed-list. |
639 (tags-table-check-computed-list) | 644 (tags-table-check-computed-list) |
640 ;; Set the tags table list state variables to start | 645 ;; Set the tags table list state variables to start |
781 (list (if no-default | 786 (list (if no-default |
782 (read-string prompt) | 787 (read-string prompt) |
783 (find-tag-tag prompt))))) | 788 (find-tag-tag prompt))))) |
784 | 789 |
785 (defvar find-tag-history nil) | 790 (defvar find-tag-history nil) |
791 | |
792 ;; Dynamic bondage: | |
793 (eval-when-compile | |
794 (defvar etags-case-fold-search) | |
795 (defvar etags-syntax-table)) | |
786 | 796 |
787 ;;;###autoload | 797 ;;;###autoload |
788 (defun find-tag-noselect (tagname &optional next-p regexp-p) | 798 (defun find-tag-noselect (tagname &optional next-p regexp-p) |
789 "Find tag (in current tags table) whose name contains TAGNAME. | 799 "Find tag (in current tags table) whose name contains TAGNAME. |
790 Returns the buffer containing the tag's definition and moves its point there, | 800 Returns the buffer containing the tag's definition and moves its point there, |
1106 (defun etags-recognize-tags-table () | 1116 (defun etags-recognize-tags-table () |
1107 (and (etags-verify-tags-table) | 1117 (and (etags-verify-tags-table) |
1108 ;; It is annoying to flash messages on the screen briefly, | 1118 ;; It is annoying to flash messages on the screen briefly, |
1109 ;; and this message is not useful. -- rms | 1119 ;; and this message is not useful. -- rms |
1110 ;; (message "%s is an `etags' TAGS file" buffer-file-name) | 1120 ;; (message "%s is an `etags' TAGS file" buffer-file-name) |
1111 (mapcar (lambda (elt) (set (make-local-variable (car elt)) (cdr elt))) | 1121 (mapc (lambda (elt) (set (make-local-variable (car elt)) (cdr elt))) |
1112 '((file-of-tag-function . etags-file-of-tag) | 1122 '((file-of-tag-function . etags-file-of-tag) |
1113 (tags-table-files-function . etags-tags-table-files) | 1123 (tags-table-files-function . etags-tags-table-files) |
1114 (tags-completion-table-function . etags-tags-completion-table) | 1124 (tags-completion-table-function . etags-tags-completion-table) |
1115 (snarf-tag-function . etags-snarf-tag) | 1125 (snarf-tag-function . etags-snarf-tag) |
1116 (goto-tag-location-function . etags-goto-tag-location) | 1126 (goto-tag-location-function . etags-goto-tag-location) |
1117 (find-tag-regexp-search-function . re-search-forward) | 1127 (find-tag-regexp-search-function . re-search-forward) |
1118 (find-tag-regexp-tag-order . (tag-re-match-p)) | 1128 (find-tag-regexp-tag-order . (tag-re-match-p)) |
1119 (find-tag-regexp-next-line-after-failure-p . t) | 1129 (find-tag-regexp-next-line-after-failure-p . t) |
1120 (find-tag-search-function . search-forward) | 1130 (find-tag-search-function . search-forward) |
1121 (find-tag-tag-order . (tag-exact-file-name-match-p | 1131 (find-tag-tag-order . (tag-exact-file-name-match-p |
1122 tag-exact-match-p | 1132 tag-exact-match-p |
1123 tag-symbol-match-p | 1133 tag-symbol-match-p |
1124 tag-word-match-p | 1134 tag-word-match-p |
1125 tag-any-match-p)) | 1135 tag-any-match-p)) |
1126 (find-tag-next-line-after-failure-p . nil) | 1136 (find-tag-next-line-after-failure-p . nil) |
1127 (list-tags-function . etags-list-tags) | 1137 (list-tags-function . etags-list-tags) |
1128 (tags-apropos-function . etags-tags-apropos) | 1138 (tags-apropos-function . etags-tags-apropos) |
1129 (tags-included-tables-function . etags-tags-included-tables) | 1139 (tags-included-tables-function . etags-tags-included-tables) |
1130 (verify-tags-table-function . etags-verify-tags-table) | 1140 (verify-tags-table-function . etags-verify-tags-table) |
1131 )))) | 1141 )))) |
1132 | 1142 |
1133 ;; Return non-nil iff the current buffer is a valid etags TAGS file. | 1143 ;; Return non-nil iff the current buffer is a valid etags TAGS file. |
1134 (defun etags-verify-tags-table () | 1144 (defun etags-verify-tags-table () |
1135 ;; Use eq instead of = in case char-after returns nil. | 1145 ;; Use eq instead of = in case char-after returns nil. |
1136 (eq (char-after 1) ?\f)) | 1146 (eq (char-after 1) ?\f)) |
1283 t)) | 1293 t)) |
1284 | 1294 |
1285 (defmacro tags-with-face (face &rest body) | 1295 (defmacro tags-with-face (face &rest body) |
1286 "Execute BODY, give output to `standard-output' face FACE." | 1296 "Execute BODY, give output to `standard-output' face FACE." |
1287 (let ((pp (gensym "twf-"))) | 1297 (let ((pp (gensym "twf-"))) |
1288 `(let ((,pp (with-current-buffer standard-output (point)))) | 1298 `(let ((,old-point (with-current-buffer standard-output (point)))) |
1289 ,@body | 1299 ,@body |
1290 (put-text-property ,pp (with-current-buffer standard-output (point)) | 1300 (put-text-property ,old-point (with-current-buffer standard-output |
1301 (point)) | |
1291 'face ,face standard-output)))) | 1302 'face ,face standard-output)))) |
1292 | 1303 |
1293 (defun etags-tags-apropos-additional (regexp) | 1304 (defun etags-tags-apropos-additional (regexp) |
1294 "Display tags matching REGEXP from `tags-apropos-additional-actions'." | 1305 "Display tags matching REGEXP from `tags-apropos-additional-actions'." |
1295 (with-current-buffer standard-output | 1306 (with-current-buffer standard-output |
1371 | 1382 |
1372 ;; Recognize an empty file and give it local values of the tags table format | 1383 ;; Recognize an empty file and give it local values of the tags table format |
1373 ;; variables which do nothing. | 1384 ;; variables which do nothing. |
1374 (defun tags-recognize-empty-tags-table () | 1385 (defun tags-recognize-empty-tags-table () |
1375 (and (zerop (buffer-size)) | 1386 (and (zerop (buffer-size)) |
1376 (mapcar (lambda (sym) (set (make-local-variable sym) 'ignore)) | 1387 (mapc (lambda (sym) (set (make-local-variable sym) 'ignore)) |
1377 '(tags-table-files-function | 1388 '(tags-table-files-function |
1378 tags-completion-table-function | 1389 tags-completion-table-function |
1379 find-tag-regexp-search-function | 1390 find-tag-regexp-search-function |
1380 find-tag-search-function | 1391 find-tag-search-function |
1381 tags-apropos-function | 1392 tags-apropos-function |
1382 tags-included-tables-function)) | 1393 tags-included-tables-function)) |
1383 (set (make-local-variable 'verify-tags-table-function) | 1394 (set (make-local-variable 'verify-tags-table-function) |
1384 (lambda () (zerop (buffer-size)))))) | 1395 (lambda () (zerop (buffer-size)))))) |
1385 | 1396 |
1386 ;; Match qualifier functions for tagnames. | 1397 ;; Match qualifier functions for tagnames. |
1387 ;; XXX these functions assume etags file format. | 1398 ;; XXX these functions assume etags file format. |
1816 (message "Making completion list...") | 1827 (message "Making completion list...") |
1817 (with-output-to-temp-buffer "*Completions*" | 1828 (with-output-to-temp-buffer "*Completions*" |
1818 (display-completion-list | 1829 (display-completion-list |
1819 (all-completions pattern 'tags-complete-tag nil))) | 1830 (all-completions pattern 'tags-complete-tag nil))) |
1820 (message "Making completion list...%s" "done"))))) | 1831 (message "Making completion list...%s" "done"))))) |
1832 | |
1833 (dolist (x '("^No tags table in use; use .* to select one$" | |
1834 "^There is no default tag$" | |
1835 "^No previous tag locations$" | |
1836 "^File .* is not a valid tags table$" | |
1837 "^No \\(more \\|\\)tags \\(matching\\|containing\\) " | |
1838 "^Rerun etags: `.*' not found in " | |
1839 "^All files processed$" | |
1840 "^No .* or .* in progress$" | |
1841 "^File .* not in current tags tables$" | |
1842 "^No tags table loaded" | |
1843 "^Nothing to complete$")) | |
1844 (add-to-list 'debug-ignored-errors x)) | |
1821 | 1845 |
1822 (provide 'etags) | 1846 (provide 'etags) |
1823 | 1847 |
1824 ;;; etags.el ends here | 1848 ;;; etags.el ends here |