Thanks Michael, I finally use a new variable helm--minibuffer-completing-file-name which doesn't affect file-directory-p. Michael Albinus writes: > Thierry Volpiatto 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. -- Thierry