From: Mauro Aranda <maurooaranda@gmail.com>
To: 2807@debbugs.gnu.org, 44494@debbugs.gnu.org
Cc: pot@gnu.org, MON KEY <monkey@sandpframing.com>,
prouleau001@gmail.com, Stefan Monnier <monnier@iro.umontreal.ca>,
dgutov@yandex.ru, Lars Ingebrigtsen <larsi@gnus.org>,
Eli Zaretskii <eliz@gnu.org>
Subject: bug#44494: bug#2807: Subject: 23.0.90; etags can't access .el.gz files
Date: Thu, 12 Oct 2023 09:46:52 -0300 [thread overview]
Message-ID: <28afd2a3-1adc-42cf-ac2f-9bded2d0c22c@gmail.com> (raw)
In-Reply-To: <49c2c28b-291c-4436-8443-77bf6949751c@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
tags 2807 patch
quit
I did some debugging, and while internally etags.el knows how to handle
compressed files, it doesn't pass good enough information to external
tools like fileloop (Bug#2807) and xref (Bug#44494).
I attach a patch to fix both bugs, Bug#2807 and Bug#44494. It reuses
tags-compression-info-list to pass the correct filename to the tools
mentioned.
[-- Attachment #2: 0001-Fix-searching-for-tags-in-compressed-files.patch --]
[-- Type: text/x-patch, Size: 2279 bytes --]
From 8b7ca63475f4bffe98a962ff8c1f899fb1581aa8 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Thu, 12 Oct 2023 09:41:58 -0300
Subject: [PATCH] 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 | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index cb95f29b5fe..6f9bdae81d3 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1729,6 +1729,19 @@ tags-next-file
(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 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 +1763,7 @@ tags--all-files
;; 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 +2150,7 @@ etags--xref-find-definitions
(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
--
2.34.1
next prev parent reply other threads:[~2023-10-12 12:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-28 3:39 bug#2807: Subject: 23.0.90; etags can't access .el.gz files MON KEY
2011-09-11 22:14 ` Lars Magne Ingebrigtsen
2011-09-13 11:51 ` Francesco Potortì
2011-09-13 18:09 ` Stefan Monnier
2011-10-06 22:05 ` Lars Magne Ingebrigtsen
2011-10-07 1:52 ` Stefan Monnier
2011-10-07 10:25 ` Lars Magne Ingebrigtsen
2011-10-07 13:29 ` Stefan Monnier
2011-10-07 14:38 ` Lars Magne Ingebrigtsen
2011-09-13 18:24 ` Lars Magne Ingebrigtsen
2023-10-12 12:39 ` Mauro Aranda
2023-10-12 12:44 ` bug#44494: " Dmitry Gutov
2023-10-12 12:51 ` Mauro Aranda
2023-10-12 15:47 ` Dmitry Gutov
2023-10-12 12:46 ` Mauro Aranda [this message]
2023-10-12 14:28 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-10-12 15:04 ` Mauro Aranda
2023-10-15 4:12 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28afd2a3-1adc-42cf-ac2f-9bded2d0c22c@gmail.com \
--to=maurooaranda@gmail.com \
--cc=2807@debbugs.gnu.org \
--cc=44494@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=larsi@gnus.org \
--cc=monkey@sandpframing.com \
--cc=monnier@iro.umontreal.ca \
--cc=pot@gnu.org \
--cc=prouleau001@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).