tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange behavior of `file-exists-p` on latest Tramp version


From: Michael Albinus
Subject: Re: Strange behavior of `file-exists-p` on latest Tramp version
Date: Mon, 06 Mar 2023 18:27:13 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Ruiyang Wu <ywwry66@gmail.com> writes:

> Hi Michael,

Hi Ruiyang,

> If you are willing to test out ivy-mode, here is the recipe:

Yep. I've tested with Emacs 28.3 and ivy 0.13.4 + Tramp 2.6.0.2 from GNU
ELPA.

> With ivy-mode turned on, type "C-x d” (dired), then in the mini
> buffer, input "//ssh:” followed by “C-j” (ivy-alt-done). With Tramp
> 2.5.3.28.2, it will give possible completions (which is not as good as
> Tramp’s builtin completion). With Tramp 2.6.0.2, this gives the error
> “Reading directory: No such file or directory, /ssh:”.

Thanks for the recipe. I could reproduce the problem.

> The reason for the error is in the function "ivy--directory-done”.
> The new behavior of (file-exists-p file) returning t causes the
> function to enter the wrong condition clause. (ivy thinks “/ssh:” is a
> file and tries to open it).

Indeed. The following patch fixes this for me:

*** /home/albinus/.emacs.d/elpa/ivy-0.13.4/ivy.el~      2021-03-23 
15:42:21.107225608 +0100
--- /home/albinus/.emacs.d/elpa/ivy-0.13.4/ivy.el       2023-03-06 
18:06:49.507257395 +0100
***************
*** 1029,1034 ****
--- 1029,1036 ----
               (defvar tramp-completion-mode)
               (with-no-warnings
                 (let* ((tramp-completion-mode t)
+                       (non-essential t)
+                       minibuffer-completing-file-name
                        (file (expand-file-name
                               (if (> ivy--length 0) (ivy-state-current 
ivy-last) ivy-text)
                               ivy--directory)))
I've added (non-essential t), because this setting shall be used instead
of (tramp-completion-mode t) in newer Tramp versions. And I've added
minibuffer-completing-file-name (being nil), because it changes Tramp
completion (when non-nil) since Tramp 2.6.0.2. That Tramp change is
already on GNU ELPA, and it will appear with Emacs 29.2.

Could you please confirm, that this works for you? I'll be in contact
with the ivy-mode maintainer (added to Cc) then for a final solution.

> Best,
> Ruiyang

Best regards, Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]