From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs 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 Message-ID: <87bkf4r2xd.fsf@gmx.de> References: <87r0o1r1io.fsf@gmx.de> <4b4a64de-846a-ed2a-f409-80ea75e9cb57@gmail.com> <87il9crgqh.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17828"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65356@debbugs.gnu.org, monnier@iro.umontreal.ca To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 18 13:47:52 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qWxxH-0004QM-Oo for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Aug 2023 13:47:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWxx2-0002IR-2D; Fri, 18 Aug 2023 07:47:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWxta-0000hT-Cr for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 07:44:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWxta-0001YU-4C for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 07:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWxta-0003In-Fx for bug-gnu-emacs@gnu.org; Fri, 18 Aug 2023 07:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Aug 2023 11:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65356 X-GNU-PR-Package: emacs Original-Received: via spool by 65356-submit@debbugs.gnu.org id=B65356.169235903712675 (code B ref 65356); Fri, 18 Aug 2023 11:44:02 +0000 Original-Received: (at 65356) by debbugs.gnu.org; 18 Aug 2023 11:43:57 +0000 Original-Received: from localhost ([127.0.0.1]:46204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWxtU-0003IM-JU for submit@debbugs.gnu.org; Fri, 18 Aug 2023 07:43:56 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:60915) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWxtS-0003I8-9F for 65356@debbugs.gnu.org; Fri, 18 Aug 2023 07:43:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1692359024; x=1692963824; i=michael.albinus@gmx.de; bh=2NdLQ81Bbf4+5Y8Fi0Oiso0m/pyiA3amb2jlarr5D34=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=f4Xqgf84K8z019xYW3brq1tpbkyaIFXz7lgcIve3Li8eyM3vZbRyqCwlY1ZYxyc9dkZNE8l 4b/8+t6jmQ/JfiapG1rX0BzBMt1wsljEvQt1EychZyP2ncee+xtBRDq+MSeHwJ2C7eKNE40yF 4v2EPbU64ArQxWMDLcxxgGHm2+imzAYfU+BNXNOb+IHM1k9i+ys6b9MXCWYH3C3uh5NffvnTS AX87fyW3Q+r4iRpaqCSt/WlI2snbzReIA5Lz6iMjUqdWyg71l9ON9/4cGDlnPuvGG1czMbKNB WFwJi80GK4Y/P4PPtBvcYGhvi2Z6qGz1NZUqkZ4LsNDNospA8hlA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.27]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MYeR1-1qItFE3nmd-00Vl4Y; Fri, 18 Aug 2023 13:43:44 +0200 In-Reply-To: <87il9crgqh.fsf@gmx.de> (Michael Albinus's message of "Fri, 18 Aug 2023 08:45:26 +0200") X-Provags-ID: V03:K1:94Fr7bzAqOQrM+9VxphANdwCy7q9VzHaC/eE7DeDLII/1qa8q/9 kj1LoqOZhw6OOsUEyiDT2Rs/rIE63TWmlPvtgXfJdFA0RXSF7WsvHwF7+I6TtE6QxdhtxC4 ILofjK/m1LdpQkPc0JDyWbCSB9BNzjyMUpfsLmkk+cPdQKlFLJ5DEURfq89vhbwtkRLZJpg Ki6edlxYx3HTJ4bDuAK7g== UI-OutboundReport: notjunk:1;M01:P0:tyo1g+Cah24=;ombeZNtq199yYQo64a2+RKJDLli at3jxKklGf9mEs0R1gVQnIrabpkRs414dnZQOH7ovFof1PsveahCxEEO88poUr7kHNTTKuQ7/ 3sWUxO3xymFx+j+JQIjNk5reRwJhbbPXvPdOpr/C2+q3OkOwHJmBjMCQkKRQ4OzQpfpnvvpc6 kFQiPu4NT+/Z8CJ+FJ/gewPCF2VZ17vcIjJkdcFcDRwdvoZMRYv5HRHttxKZS99Kn8sKZg4zo /qiVrNi/6Ns1TDlU1yv/NccPD6tEaMvVgu1OcgfVfWwdALNkqwLueB2oF/fNsB4hH/i7ufWql CeaiMYXIoSEJx8ybB+mXN5NbcgKQPJC15guOpDp5+ov4CWO5WrbHnx4nBZ0wRKuoSGKvQ2sEH mfOsnf2EMZ46ZFnJIfxVD2jmqSPlzi/MuOSEveaHVPsJObx5ibtxYzejBOCpTta+l/xvcI/T5 N/92lQl763L+kv47rGl1rC2uE6yraoOW5qNUTsUATOVsbSHMFh7FI9SXoiXcaOXx/3majBZvp 6qR2QYyqQU9hWgtEJ7QT61bm38ZnFGQ9UJHgpwIOYWR0BTbpSKh8VYZ50R9jNw/tNudMHR2C4 bju/8xsClS63SMrhJVYCzutAUQ/bFabWP6uEAWGHp14kh6OAxIHEZDq+lCZ1+cXTF0DxOudoI OGX6J5WwibFPoh2LEKClL3nX2Wj1wlKLuTc9sAPQ1CcLeTjg3diBAhqNSt5WHie3L+fm7G+1P wnByRpFA74idwAV78A6DPhul/QLxFmUmJEHPEGpzCAodE3NYruCpVVVmUmWuyLN/VCQZbwUm X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267745 Archived-At: Michael Albinus 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.