Subject: bug#2807: Subject: 23.0.90; etags can't access .el.gz files

From: Stefan Monnier <[email-masked]>
Date: Thu, 12 Oct 2023 10:28:26 -0400

> +(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))

The patch looks pretty good, but other parts of the code use
check `auto-compression-mode` before using `tags-compression-info-list`,
so we should probably do the same here.

As other comments mention in the file, this arrangement is suboptimal
because the search for compressed filenames should probably be moved to
jka-compr's code (e.g. using `jka-compr-compression-info-list` rather
than `tags-compression-info-list`).

Historical side note: jka-compr used to have the ability to do what we
want here "transparently" (it changed things like `find-file-noselect`
to look for compressed versions of the file, among other things).
IIRC it was removed when it got integrated into Emacs (don't know why
but I assumed it was too hackish/ugly/costly/brittle).

We should arguably re-add this feature, tho maybe not transparent,
i.e. let packages who need that request that feature explicitly (like
here).

        Stefan