[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a3fd382f3fe: Fix searching for tags in compressed files
From: |
Stefan Monnier |
Subject: |
master a3fd382f3fe: Fix searching for tags in compressed files |
Date: |
Sun, 15 Oct 2023 00:10:06 -0400 (EDT) |
branch: master
commit a3fd382f3fe803e0b61c5353e9b5bdaf4d1e564e
Author: Mauro Aranda <maurooaranda@gmail.com>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Fix searching for tags in compressed files
* lisp/progmodes/etags.el (etags--ensure-file): New function.
(etags--all-files): Make sure files in TAGS can be visited, even if
the files are compressed. (Bug#2807)
(etags--xref-find-definitions): Report to xref a file that we are sure
it exists. (Bug#44494)
---
lisp/progmodes/etags.el | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index cb95f29b5fe..d48dcc6659d 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1729,6 +1729,21 @@ if the file was newly read in, the value is the
filename."
(fileloop-next-file novisit)
(switch-to-buffer (current-buffer)))
+(defun etags--ensure-file (file)
+ "Ensure FILE can be visited.
+
+FILE should be an expanded file name.
+This function tries to locate FILE, possibly adding it a suffix
+present in `tags-compression-info-list'. If the file can't be found,
+signals an error.
+Else, returns the filename that can be visited for sure."
+ (let ((f (locate-file file nil (if auto-compression-mode
+ tags-compression-info-list
+ '("")))))
+ (unless f
+ (signal 'file-missing (list "Cannot locate file in TAGS" file)))
+ f))
+
(defun tags--all-files ()
(save-excursion
(let ((cbuf (current-buffer))
@@ -1750,7 +1765,7 @@ if the file was newly read in, the value is the filename."
;; list later returned by (tags-table-files).
(setf (if tail (cdr tail) files)
(mapcar #'expand-file-name (tags-table-files)))))
- files)))
+ (mapcar #'etags--ensure-file files))))
(make-obsolete-variable 'tags-loop-operate 'fileloop-initialize "27.1")
(defvar tags-loop-operate nil
@@ -2137,7 +2152,7 @@ file name, add `tag-partial-file-name-match-p' to the
list value.")
(beginning-of-line)
(pcase-let* ((tag-info (etags-snarf-tag))
(`(,hint ,line . _) tag-info))
- (let* ((file (file-of-tag))
+ (let* ((file (etags--ensure-file (file-of-tag)))
(mark-key (cons file line)))
(unless (gethash mark-key marks)
(let ((loc (xref-make-etags-location
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a3fd382f3fe: Fix searching for tags in compressed files,
Stefan Monnier <=