[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host
From: |
Michael Albinus |
Subject: |
bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell |
Date: |
Fri, 18 Aug 2023 13:43:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Michael Albinus <michael.albinus@gmx.de> writes:
Hi Jim,
>> 2) I'm not sure 'pcomplete-try-first-hook' is the right way to enable
>> this. Pcomplete has quite a few ways of performing completions, and it
>> already knows when it should specifically complete file names (as
>> opposed to "--options" for example). Maybe we should enhance Pcomplete
>> itself so that you can opt into completion of remote file names too?
>> Then when you tab-complete in Eshell, it would just work in all the
>> contexts where you can normally complete a file name. I Cc'ed Stefan
>> since he might have some thoughts on the Pcomplete machinery here.
>
> When I've started to implement this, I was a n00b wrt pcomplete. Well,
> I'm still a n00b, all what I have done is stealing code from somewhere
> else, shamelessly.
>
> It would be great if this completion function applies only to possible
> *Lisp* file names. Roughly said, to arguments of commands not being
> external, and not in a pipe. If this could be arranged I'd appreciate
> it. So I count on you and Stefan :-)
I've digged further. Perhaps, we don't need to plug into eshell. It
could be sufficient to teach pcomplete.
First, we need a completion table for Tramp prefixes. Like
--8<---------------cut here---------------start------------->8---
(defun pcomplete-tramp ()
"Completion table for partial Tramp file names."
(completion-table-dynamic
(lambda (string)
(when (string-match-p tramp-completion-file-name-regexp string)
(mapcar
(lambda (x) (concat tramp-prefix-format x))
(let ((non-essential t)
(minibuffer-completing-file-name t))
(file-name-all-completions string tramp-prefix-format)))))))
--8<---------------cut here---------------end--------------->8---
We could use this table to pimp up (existing) pcomplete functions for
builtin commands, like
--8<---------------cut here---------------start------------->8---
(defun pcomplete/cd ()
"Completion for `cd'."
(while (pcomplete-here (completion-table-in-turn
(pcomplete-tramp)
(pcomplete-dirs)))))
--8<---------------cut here---------------end--------------->8---
WDYT?
Best regards, Michael.
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Michael Albinus, 2023/08/17
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Jim Porter, 2023/08/17
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Michael Albinus, 2023/08/18
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell,
Michael Albinus <=
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Stefan Monnier, 2023/08/18
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Michael Albinus, 2023/08/18
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Stefan Monnier, 2023/08/18
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Jim Porter, 2023/08/18
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Michael Albinus, 2023/08/19
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Stefan Monnier, 2023/08/19
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Michael Albinus, 2023/08/19
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Stefan Monnier, 2023/08/19
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Michael Albinus, 2023/08/20
- bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell, Jim Porter, 2023/08/20