You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
I appreciate that ivy-expand-file-if-directory may need fixing, and thank you for reporting it and getting feedback from Michael.
Before that, I'm not clear on something: the bug description makes it sound like continuing file name completion within an archive as if it were a directory is a bad thing, but is it always so?
I can imagine at least some users finding this a useful feature, so it would be a shame to lose it if that is what you are suggesting.
I just tried a couple of file name completions: I couldn't get counsel-find-file to enter .odt files, but I could get it into a .zip archive by using C-j (ivy-alt-done). By contrast, C-m (ivy-done) selects the .zip in the same way that vanilla Emacs completion does.
Given that I can choose between entering (C-j) or not entering (C-m) the .zip archive during counsel-find-file completion OOTB, I'm not sure exactly what you are suggesting Ivy should do here (except for making ivy-expand-file-if-directory better behaved if possible).
On a current Emacs, with default settings, when
counsel-find-file
meets an archive file type (tar, rar, zip, OpenDocument, etc., any extension contained intramp-archive-suffixes
) it is automatically mounted and treated as a directory. As far as I can tell, this happens becauseivy-expand-file-if-directory
, which is indirectly used by thecounsel-find-file
machinery, wraps the file name infile-name-as-directory
(thus appending a slash to it) and then testing iffile-directory-p
. But, withtramp-archive
active, which it is by default, this predicate will not only mount the file, but also returnt
, meaningcounsel-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:
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 fromivy-expand-file-if-directory
.The text was updated successfully, but these errors were encountered: