Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

counsel-find-file with archive file types #2998

Open
gusbrs opened this issue Oct 8, 2022 · 0 comments
Open

counsel-find-file with archive file types #2998

gusbrs opened this issue Oct 8, 2022 · 0 comments

Comments

@gusbrs
Copy link
Contributor

gusbrs commented Oct 8, 2022

On a current Emacs, with default settings, when counsel-find-file meets an archive file type (tar, rar, zip, OpenDocument, etc., any extension contained in tramp-archive-suffixes) it is automatically mounted and treated as a directory. As far as I can tell, this happens because ivy-expand-file-if-directory, which is indirectly used by the counsel-find-file machinery, wraps the file name in file-name-as-directory (thus appending a slash to it) and then testing if file-directory-p. But, with tramp-archive active, which it is by default, this predicate will not only mount the file, but also return t, meaning counsel-find-file will navigate inside the archive file, instead of selecting it.

I initially reported this to Emacs itself, in the following bug report: https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-10/msg00758.html

The stance of Tramp's maintainer, Michael Albinus, on the matter is the following:

There is no need for packages like counsel to check

(file-directory-p (expand-file-name "~/file.odt/"))

It is a misuse to add a slash to an existing regular file and pray that
it works. There has been a similar error in ange-ftp, see bug#56078. It
has fixed. I recommend to contact the counsel author for a fix.

I'd say he's got a point and, either way, that's the upstream position. So, it'd probably be a good idea if file-name-as-directory was dropped from ivy-expand-file-if-directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant