unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Gregory Heytings <gregory@heytings.org>
To: Julien Roy <julien@jroy.ca>
Cc: 60505@debbugs.gnu.org
Subject: bug#60505: 29.0.60; Fido Mode and Tramp Completion
Date: Thu, 05 Jan 2023 13:07:51 +0000	[thread overview]
Message-ID: <8dea9f3e0e411c315b04@heytings.org> (raw)
In-Reply-To: <87k024918k.fsf@jroy.ca>

[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]


>
> When I C-x C-f and start typing a TRAMP session to an SSH host, for 
> instance `/ssh:`, then hit <tab>, I see a list of known hosts proposed 
> for completion. This is the expected behavior. If I then enable 
> fido-mode and do the same, instead of having known hosts proposed when 
> hitting <tab>, I only get a list of TRAMP methods for completion, eg. 
> `ssh:`, `sshx:` and `sshfs:`. I would expect to also have known hosts on 
> fido-mode.
>
> To reproduce, open emacs -Q; then:
> C-x C-f /ssh: <tab>
> (This produces the expected behavior of proposing known hosts)
> M-x fido-mode
> C-x C-f /ssh: <tab>
> (Now, only TRAMP methods are proposed for completion)
>

There are two problems here:

1. fido-mode sets completion-styles to 'flex', and as indicated in the 
docstring of completion-styles "Tramp host name completion (e.g., 
"/ssh:ho<TAB>") currently doesn't work if this list doesn't contain at 
least one of `basic', `emacs22' or `emacs21'."  The workaround is to add 
this to your init file:

(advice-add #'icomplete--fido-mode-setup
 	    :after (lambda () (setq completion-styles '(flex basic))))

You could also ask for that change to be made in core.

2. Doing that is not enough, because of an incompatibility between Tramp 
and the 'flex' and 'substring' mechanisms.  The Tramp manual has a 
footnote which mentions that incompatibility: "Some completion styles, 
like `substring' or `flex', require to type at least one character after 
the trailing `:'."  A one-line patch to fix it was proposed, but rejected, 
a year and a half ago.  It is attached to this email, and you can use it 
locally.  As I said in the bug thread in which that patch was proposed: "I 
expect other bug reports from confused users".

[-- Attachment #2: Improve-handling-of-non-default-completion-styles-wi.patch --]
[-- Type: text/x-diff, Size: 1089 bytes --]

From 5f4b821bbf5123422d43895bee4c847cfadf31b0 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Mon, 6 Sep 2021 20:52:21 +0000
Subject: [PATCH] Improve handling of non-default completion styles with Tramp
 methods

* lisp/net/tramp.el (tramp-completion-handle-file-name-all-completions):
Do not return methods when the filename already contains a complete method.
Fixes bug#50387.
---
 lisp/net/tramp.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 4fd7a322d4..259fc1fcfc 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2839,8 +2839,9 @@ tramp-completion-handle-file-name-all-completions
 			       (delq nil all-user-hosts)))))
 
 	    ;; Possible methods.
-	    (setq result
-		  (append result (tramp-get-completion-methods m)))))))
+	    (unless (string-empty-p method)
+	      (setq result
+		    (append result (tramp-get-completion-methods m))))))))
 
     ;; Unify list, add hop, remove nil elements.
     (dolist (elt result)
-- 
2.33.0


  parent reply	other threads:[~2023-01-05 13:07 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-02 19:37 bug#60505: 29.0.60; Fido Mode and Tramp Completion Julien Roy
2023-01-03  8:56 ` Michael Albinus
2023-01-05 13:07 ` Gregory Heytings [this message]
2023-01-05 13:55   ` Michael Albinus
2023-01-05 14:14     ` Gregory Heytings
2023-01-06  9:51       ` Gregory Heytings
2023-01-14 21:37         ` Gregory Heytings
2023-01-15 19:23           ` Michael Albinus
2023-01-15 22:38             ` Gregory Heytings
2023-01-18 12:30               ` Michael Albinus
2023-02-01 18:12                 ` Gregory Heytings
2023-02-01 20:15                   ` Michael Albinus
2023-02-01 21:27                     ` Gregory Heytings
2023-02-02  6:37                       ` Eli Zaretskii
2023-02-02  8:25                         ` Michael Albinus
2023-02-02  9:15                           ` Eli Zaretskii
2023-02-02 15:39                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-03 15:40                             ` Michael Albinus
2023-02-03 18:43                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-03 19:23                                 ` Michael Albinus
2023-02-03 20:51                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-04 16:04                                     ` Michael Albinus
2023-02-04 16:48                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-03 22:33                               ` Gregory Heytings
2023-02-04  9:54                                 ` Michael Albinus
2023-02-06 17:26                               ` Michael Albinus
2023-02-06 17:41                                 ` Gregory Heytings
2023-02-07  0:35                                 ` Michael Heerdegen
2023-02-07  8:54                                   ` Michael Albinus
2023-02-07 18:20                                     ` Michael Heerdegen
2023-02-07 18:30                                       ` Michael Albinus
2023-02-07 20:39                                         ` Michael Heerdegen
     [not found]                                           ` <87357h19qj.fsf@dick>
2023-02-08  8:05                                             ` Michael Albinus
2023-02-08 11:27                                               ` dick
2023-02-08 13:08                                                 ` Michael Albinus
2023-02-08 13:20                                                   ` Eli Zaretskii
2023-02-08 14:13                                                     ` dick
2023-02-08 14:42                                                       ` Michael Albinus
2023-02-08 13:30                                                   ` dick
2023-02-08 15:04                                           ` Michael Albinus
2023-02-07 22:22                                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-08 15:11                                           ` Michael Albinus
2023-02-08 16:18                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-08 17:59                                               ` Michael Albinus
2023-02-08 19:03                                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-10 16:55                                                   ` Michael Albinus
2023-02-12 19:26                                                     ` Michael Albinus
2023-02-07 19:18                                     ` Michael Heerdegen
2023-02-08 15:09                                       ` Michael Albinus
2023-02-09  0:38                                         ` Michael Heerdegen
2023-02-03  0:23                         ` Gregory Heytings
2023-02-03  7:43                           ` Juri Linkov
2023-02-03  8:39                             ` Michael Albinus
2023-02-03 12:01                             ` Eli Zaretskii
2023-02-02 15:16                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-02 15:05     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-05 20:58   ` Julien Roy
     [not found] <874k4xblcy.fsf.ref@aol.com>
2022-02-17 14:47 ` bug#54042: 29.0.50; fido-mode and ssh not listing hosts Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-17 16:43   ` Michael Albinus
     [not found]   ` <handler.54042.D60505.167623003032452.notifdone@debbugs.gnu.org>
2023-02-15 18:31     ` bug#54042: closed (Re: bug#60505: 29.0.60; Fido Mode and Tramp Completion) Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-16  8:51       ` Michael Albinus
2023-02-18 17:25         ` Michael Albinus
2023-02-19  2:04           ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-19  9:53             ` Michael Albinus

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=8dea9f3e0e411c315b04@heytings.org \
    --to=gregory@heytings.org \
    --cc=60505@debbugs.gnu.org \
    --cc=julien@jroy.ca \
    /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).