Hi Michael,
If the 'tramp-archive already be loaded, follow command lines will get expected path:
$ emacs --batch --eval "(require 'tramp-archive)" --eval "(message \"%s %s\" (catch 'input
(let ((throw-on-input 'input)) (expand-file-name \"a.iso/b\" \"/\"))) last-input-event)"
Contrasting with previous command lines, the behavior is hard to understand.
The line `(let ((throw-on-input 'input))…` cause `read-event` throw a ‘input’ event,
and according the document of `throw-on-input`:
> throw-on-input is a variable defined in ‘keyboard.c’.
> Documentation:
> If non-nil, any keyboard input throws to this symbol.
> The value of that variable is passed to ‘quit-flag’ and later causes a
> peculiar kind of quitting.
It seems only “keyboard” input should trigger a ‘input event, so dbus event should be silence for this case.
From: Michael Albinus
Sent: Wednesday, March 17, 2021 19:51
To: LinSun via Bug reports for GNU Emacs, the Swiss army knife of text editors
Cc: 47205@debbugs.gnu.org; LinSun
Subject: Re: bug#47205: 27.1.91; [bug] unexpected input event interrupted expand-file
LinSun via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:
Hi,
> There is a bug that `helm-projectile-find-file' is interrupted by an
> unexpected input event. After inspecting emacs code, I found it can
> simply reproduce by follow code, and the expected out is a path,
> while actually result is t:
>
> emacs --batch --eval "(message \"%s\" (catch 'input
> (let ((throw-on-input 'input)) (expand-file-name \"a.iso/b\"
> \"/\"))))"
>
> From the backtrace, it seems caused by `tramp-archive-file-name-handler’.
>
> How to avoid input event in this situation? Thanks
This input event is expected. You expand the file name "a.iso/b", which
is recognized as archive due to the ".iso/" extension. This triggers the
Tramp archive file name handler, which is implemented using D-Bus. The
input event is a D-Bus event, as you can see:
--8<---------------cut here---------------start------------->8---
# emacs --batch --eval "(message \"%s %s\" (catch 'input (let ((throw-on-input 'input)) (expand-file-name \"a.iso/b\" \"/\"))) last-input-event)"
=> t (dbus-event :system 2 2 org.freedesktop.DBus :1.527417 nil nil nil dbus-call-method-handler)
--8<---------------cut here---------------end--------------->8---
Which problem do you have with D-Bus events?
Best regards, Michael.