diff options
| author | Stefan Monnier | 2008-06-05 05:55:37 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-06-05 05:55:37 +0000 |
| commit | dcaaec2302d82bc05431bb9b0bd11bc048b346a1 (patch) | |
| tree | 5791e625be92ac903a6698fc8d24fe0fc3b69ca3 | |
| parent | e7438ece8cbb0dad050d279690102e83b58849c6 (diff) | |
| download | emacs-dcaaec2302d82bc05431bb9b0bd11bc048b346a1.tar.gz emacs-dcaaec2302d82bc05431bb9b0bd11bc048b346a1.zip | |
(tags-verify-table): Be careful to use and update
tags-file-name and tags-table-list from the right buffer.
(tags-table-check-computed-list, tags-table-extend-computed-list)
(find-tag-noselect): Use with-current-buffer.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/etags.el | 81 |
2 files changed, 40 insertions, 46 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 37d24c0e1fd..2f889f6ac53 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,10 @@ | |||
| 1 | 2008-06-05 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2008-06-05 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * progmodes/etags.el (tags-verify-table): Be careful to use and update | ||
| 4 | tags-file-name and tags-table-list from the right buffer. | ||
| 5 | (tags-table-check-computed-list, tags-table-extend-computed-list) | ||
| 6 | (find-tag-noselect): Use with-current-buffer. | ||
| 7 | |||
| 3 | * emacs-lisp/trace.el (trace-entry-message, trace-exit-message): | 8 | * emacs-lisp/trace.el (trace-entry-message, trace-exit-message): |
| 4 | Use print-circle. | 9 | Use print-circle. |
| 5 | 10 | ||
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 7249e342e41..7aea6158f26 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el | |||
| @@ -301,8 +301,7 @@ file the tag was in." | |||
| 301 | current-prefix-arg)) | 301 | current-prefix-arg)) |
| 302 | (or (stringp file) (signal 'wrong-type-argument (list 'stringp file))) | 302 | (or (stringp file) (signal 'wrong-type-argument (list 'stringp file))) |
| 303 | ;; Bind tags-file-name so we can control below whether the local or | 303 | ;; Bind tags-file-name so we can control below whether the local or |
| 304 | ;; global value gets set. Calling visit-tags-table-buffer will | 304 | ;; global value gets set. |
| 305 | ;; initialize a buffer for the file and set tags-file-name to the | ||
| 306 | ;; Calling visit-tags-table-buffer with tags-file-name set to FILE will | 305 | ;; Calling visit-tags-table-buffer with tags-file-name set to FILE will |
| 307 | ;; initialize a buffer for FILE and set tags-file-name to the | 306 | ;; initialize a buffer for FILE and set tags-file-name to the |
| 308 | ;; fully-expanded name. | 307 | ;; fully-expanded name. |
| @@ -338,8 +337,7 @@ file the tag was in." | |||
| 338 | ;; it is initialized as a tag table buffer. | 337 | ;; it is initialized as a tag table buffer. |
| 339 | (save-excursion | 338 | (save-excursion |
| 340 | (tags-verify-table (buffer-file-name table-buffer)))) | 339 | (tags-verify-table (buffer-file-name table-buffer)))) |
| 341 | (save-excursion | 340 | (with-current-buffer table-buffer |
| 342 | (set-buffer table-buffer) | ||
| 343 | (if (tags-included-tables) | 341 | (if (tags-included-tables) |
| 344 | ;; Insert the included tables into the list we | 342 | ;; Insert the included tables into the list we |
| 345 | ;; are processing. | 343 | ;; are processing. |
| @@ -378,8 +376,7 @@ such table and puts its included tables into the list." | |||
| 378 | (setq computed (cons (car tables) computed) | 376 | (setq computed (cons (car tables) computed) |
| 379 | table-buffer (get-file-buffer (car tables))) | 377 | table-buffer (get-file-buffer (car tables))) |
| 380 | (if table-buffer | 378 | (if table-buffer |
| 381 | (save-excursion | 379 | (with-current-buffer table-buffer |
| 382 | (set-buffer table-buffer) | ||
| 383 | (if (tags-included-tables) | 380 | (if (tags-included-tables) |
| 384 | ;; Insert the included tables into the list we | 381 | ;; Insert the included tables into the list we |
| 385 | ;; are processing. | 382 | ;; are processing. |
| @@ -448,18 +445,19 @@ Returns non-nil if it is a valid table." | |||
| 448 | (funcall verify-tags-table-function)) | 445 | (funcall verify-tags-table-function)) |
| 449 | (revert-buffer t t) | 446 | (revert-buffer t t) |
| 450 | (tags-table-mode))) | 447 | (tags-table-mode))) |
| 451 | (and (file-exists-p file) | 448 | (when (file-exists-p file) |
| 452 | (progn | 449 | (let* ((buf (find-file-noselect file)) |
| 453 | (set-buffer (find-file-noselect file)) | 450 | (newfile (buffer-file-name buf))) |
| 454 | (or (string= file buffer-file-name) | 451 | (unless (string= file newfile) |
| 455 | ;; find-file-noselect has changed the file name. | 452 | ;; find-file-noselect has changed the file name. |
| 456 | ;; Propagate the change to tags-file-name and tags-table-list. | 453 | ;; Propagate the change to tags-file-name and tags-table-list. |
| 457 | (let ((tail (member file tags-table-list))) | 454 | (let ((tail (member file tags-table-list))) |
| 458 | (if tail | 455 | (if tail (setcar tail newfile))) |
| 459 | (setcar tail buffer-file-name)) | 456 | (if (eq file tags-file-name) (setq tags-file-name newfile))) |
| 460 | (if (eq file tags-file-name) | 457 | ;; Only change buffer now that we're done using potentially |
| 461 | (setq tags-file-name buffer-file-name)))) | 458 | ;; buffer-local variables. |
| 462 | (tags-table-mode))))) | 459 | (set-buffer buf) |
| 460 | (tags-table-mode))))) | ||
| 463 | 461 | ||
| 464 | ;; Subroutine of visit-tags-table-buffer. Search the current tags tables | 462 | ;; Subroutine of visit-tags-table-buffer. Search the current tags tables |
| 465 | ;; for one that has tags for THIS-FILE (or that includes a table that | 463 | ;; for one that has tags for THIS-FILE (or that includes a table that |
| @@ -883,22 +881,21 @@ See documentation of variable `tags-file-name'." | |||
| 883 | (setq last-tag tagname)) | 881 | (setq last-tag tagname)) |
| 884 | ;; Record the location so we can pop back to it later. | 882 | ;; Record the location so we can pop back to it later. |
| 885 | (let ((marker (make-marker))) | 883 | (let ((marker (make-marker))) |
| 886 | (save-excursion | 884 | (with-current-buffer |
| 887 | (set-buffer | 885 | ;; find-tag-in-order does the real work. |
| 888 | ;; find-tag-in-order does the real work. | 886 | (find-tag-in-order |
| 889 | (find-tag-in-order | 887 | (if (and next-p last-tag) last-tag tagname) |
| 890 | (if (and next-p last-tag) last-tag tagname) | 888 | (if regexp-p |
| 891 | (if regexp-p | 889 | find-tag-regexp-search-function |
| 892 | find-tag-regexp-search-function | 890 | find-tag-search-function) |
| 893 | find-tag-search-function) | 891 | (if regexp-p |
| 894 | (if regexp-p | 892 | find-tag-regexp-tag-order |
| 895 | find-tag-regexp-tag-order | 893 | find-tag-tag-order) |
| 896 | find-tag-tag-order) | 894 | (if regexp-p |
| 897 | (if regexp-p | 895 | find-tag-regexp-next-line-after-failure-p |
| 898 | find-tag-regexp-next-line-after-failure-p | 896 | find-tag-next-line-after-failure-p) |
| 899 | find-tag-next-line-after-failure-p) | 897 | (if regexp-p "matching" "containing") |
| 900 | (if regexp-p "matching" "containing") | 898 | (or (not next-p) (not last-tag))) |
| 901 | (or (not next-p) (not last-tag)))) | ||
| 902 | (set-marker marker (point)) | 899 | (set-marker marker (point)) |
| 903 | (run-hooks 'local-find-tag-hook) | 900 | (run-hooks 'local-find-tag-hook) |
| 904 | (ring-insert tags-location-ring marker) | 901 | (ring-insert tags-location-ring marker) |
| @@ -1560,18 +1557,10 @@ that do nothing." | |||
| 1560 | 1557 | ||
| 1561 | ;; This might be a neat idea, but it's too hairy at the moment. | 1558 | ;; This might be a neat idea, but it's too hairy at the moment. |
| 1562 | ;;(defmacro tags-with-syntax (&rest body) | 1559 | ;;(defmacro tags-with-syntax (&rest body) |
| 1563 | ;; `(let ((current (current-buffer)) | 1560 | ;; `(with-syntax-table |
| 1564 | ;; (otable (syntax-table)) | 1561 | ;; (with-current-buffer (find-file-noselect (file-of-tag)) |
| 1565 | ;; (buffer (find-file-noselect (file-of-tag))) | 1562 | ;; (syntax-table)) |
| 1566 | ;; table) | 1563 | ;; ,@body)) |
| 1567 | ;; (unwind-protect | ||
| 1568 | ;; (progn | ||
| 1569 | ;; (set-buffer buffer) | ||
| 1570 | ;; (setq table (syntax-table)) | ||
| 1571 | ;; (set-buffer current) | ||
| 1572 | ;; (set-syntax-table table) | ||
| 1573 | ;; ,@body) | ||
| 1574 | ;; (set-syntax-table otable)))) | ||
| 1575 | ;;(put 'tags-with-syntax 'edebug-form-spec '(&rest form)) | 1564 | ;;(put 'tags-with-syntax 'edebug-form-spec '(&rest form)) |
| 1576 | 1565 | ||
| 1577 | ;; exact file name match, i.e. searched tag must match complete file | 1566 | ;; exact file name match, i.e. searched tag must match complete file |