[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10085: 24.0.91; completion-pcm--find-all-completions returns wrong r
bug#10085: 24.0.91; completion-pcm--find-all-completions returns wrong remote file names
Wed, 23 Nov 2011 09:04:19 -0500
Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)
>>> `expand-file-name' seems to access the remote host. This can be
>>> suppressed by let-binding of `non-essential' to t.
>> I think adding non-essential to rfn-eshadow.el would be even more
>> correct (but it doesn't fix the underlying problem).
> Shall I submit such a patch towards rfn-eshadow.el, for the sake of the
> upcoming release?
You can even install it now.
> Honestly, I do not understand in detail the "underlying problem".
Simple completion tables have (all-completions STRING TABLE) return
a list whose elements all have STRING as a prefix.
More complex completion tables such as file-name completion instead
return a list whose elements have only a suffix of STRING as a prefix.
Until Emacs-23, completion tables could do this without telling anyone,
which restricted the kind of completion styles that could be implemented
(e.g. partial-completion-mode provided partial-completion for files in
an ad-hoc way, whereas Emacs-23 provides partial-completion for files
without using file-specific knowledge).
Emacs-23 solved this issue by adding a new method to completion tables,
called completion-boundaries which lets the completion table announce
which part of STRING will be the prefix of the all-completions result.
So, completion of "/foo/bar" is divided into fields "foo" and "bar" with
"/" as separators, and (completion-boundaries "/foo/bar") returns 5 to
indicate that "/foo/" will be stripped from all-completions's output,
leaving only "bar" as a prefix of all returned elements.
As I have shown with the trace, Tramp treats "/sud:" and "/sudo:"
differently, making the ":" a boundary separator in the first case but
not in the second. It's not strictly incorrect, but it is inconsistent
and makes it harder for the minibuffer.el code to behave well.
> I guess we need to find out, what are separators in Tramp wrt
> completion tables, and how to handle them.
The user finds out, the implementer decides.
bug#10085: 24.0.91; completion-pcm--find-all-completions returns wrong remote file names, Stefan Monnier, 2011/11/22