From: Michael Albinus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Thierry Volpiatto <thievol@posteo.net>
Cc: 74191@debbugs.gnu.org
Subject: bug#74191: 31.0.50; file-directory-p broken when minibuffer-completing-file-name is non nil
Date: Mon, 04 Nov 2024 08:54:41 +0100 [thread overview]
Message-ID: <87r07r4eny.fsf@gmx.de> (raw)
In-Reply-To: <874j4ortl6.fsf@posteo.net> (Thierry Volpiatto's message of "Sun, 03 Nov 2024 19:43:49 +0000")
Thierry Volpiatto <thievol@posteo.net> writes:
> Hi Michael,
Hi Thierry,
>>> In Emacs-30+:
>>>
>>> (let ((minibuffer-completing-file-name t)) (file-directory-p "/ssh"))
>>> => t
>>>
>>> which is wrong obviously.
>>
>> No, it isn't. It is intended.
>
> Hmm, It is perhaps intended and I believe it fixes some problem, but it is
> wrong anyway, "/ssh" is NOT a directory.
Nobody says so. Remember, we're in file name completion, and Tramp must
trigger some action from the completion machinery. A non-nil return of
file-directory-p is such a trigger.
> Can I use file-attributes instead or it is affected as well?
Should work. Check tramp-completion-file-name-handler-alist. It cares
only about
--8<---------------cut here---------------start------------->8---
((expand-file-name . tramp-completion-handle-expand-file-name)
(file-directory-p . tramp-completion-handle-file-directory-p)
(file-exists-p . tramp-completion-handle-file-exists-p)
(file-name-all-completions . tramp-completion-handle-file-name-all-completions)
(file-name-completion . tramp-completion-handle-file-name-completion)
(file-name-directory . tramp-completion-handle-file-name-directory)
(file-name-nondirectory . tramp-completion-handle-file-name-nondirectory))
--8<---------------cut here---------------end--------------->8---
Alternatively, you could bind temporarily tramp-mode to nil. See
tramp-completion-file-name-handler:
--8<---------------cut here---------------start------------->8---
(if-let*
((fn (and tramp-mode minibuffer-completing-file-name
(assoc operation tramp-completion-file-name-handler-alist))))
(save-match-data (apply (cdr fn) args))
(tramp-run-real-handler operation args)))
--8<---------------cut here---------------end--------------->8---
> Thanks.
Best regards, Michael.
next prev parent reply other threads:[~2024-11-04 7:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-03 15:42 bug#74191: 31.0.50; file-directory-p broken when minibuffer-completing-file-name is non nil Thierry Volpiatto
2024-11-03 16:28 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-03 19:43 ` Thierry Volpiatto
2024-11-04 7:54 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-04 10:06 ` Thierry Volpiatto
2024-11-04 13:04 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-03 16:30 ` Eli Zaretskii
2024-11-03 19:46 ` Thierry Volpiatto
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=87r07r4eny.fsf@gmx.de \
--to=bug-gnu-emacs@gnu.org \
--cc=74191@debbugs.gnu.org \
--cc=michael.albinus@gmx.de \
--cc=thievol@posteo.net \
/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).