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#60505: 29.0.60; Fido Mode and Tramp Completion Date: Wed, 18 Jan 2023 13:30:38 +0100 Message-ID: <87o7qwm3dd.fsf@gmx.de> References: <87k024918k.fsf@jroy.ca> <8dea9f3e0e411c315b04@heytings.org> <87tu15m6g7.fsf@gmx.de> <8dea9f3e0eb47ac9e4ab@heytings.org> <371ba1d0be1f14c7c798@heytings.org> <8aadf0ddd54d67a3213d@heytings.org> <87a62jmwj6.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8866"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 60505@debbugs.gnu.org, Julien Roy To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 18 13:31:35 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 1pI7bI-00029Y-QK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Jan 2023 13:31:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pI7av-0000Rh-6k; Wed, 18 Jan 2023 07:31:09 -0500 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 1pI7ap-0000O6-1a for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 07:31:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pI7ao-0004fc-Nk for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 07:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pI7ao-0001Cm-9p for bug-gnu-emacs@gnu.org; Wed, 18 Jan 2023 07:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Jan 2023 12:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60505 X-GNU-PR-Package: emacs Original-Received: via spool by 60505-submit@debbugs.gnu.org id=B60505.16740450522994 (code B ref 60505); Wed, 18 Jan 2023 12:31:02 +0000 Original-Received: (at 60505) by debbugs.gnu.org; 18 Jan 2023 12:30:52 +0000 Original-Received: from localhost ([127.0.0.1]:39693 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pI7ad-0000kf-AR for submit@debbugs.gnu.org; Wed, 18 Jan 2023 07:30:52 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:49269) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pI7aa-0000P5-N4 for 60505@debbugs.gnu.org; Wed, 18 Jan 2023 07:30:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1674045039; bh=FZGd9URRWmmZhJETEVhJJis7sqOpiH0fWZ5bnzmK9J0=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=MgGOXkhXP7mDZVTrlcvn8UsX9GVCExQ6VFQD7Ym1EO1UGcTG4pjFcw86cR7XSgxdt ZVnjEwLguO7dbLbeiB21YzhHbgiBQFnroI3co+ydPtNUELGxZS9es0f8MjOCMx90LB VYRvqYeXoShr96gO/r/+KBj3XxEU+kvG53XLut5OfE8jKGfeuVHicowkw/lizNunzE mHYJGeF7Lahz9y4U0GC8Yf/ZGeirmI2rHgvFe7I27z02ztj30lJToKfBxCsZL7ofWk kuPfsduBSwnnxvIDB3o16Bz4GbuTEdBkxiJB1uv07FJ6VqYCDf53/mGI5fybLt+wSW vhJrpu+uQMO/g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.37.45]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MN5eR-1oz4jS1Z37-00J10A; Wed, 18 Jan 2023 13:30:39 +0100 In-Reply-To: (Gregory Heytings's message of "Sun, 15 Jan 2023 22:38:57 +0000") X-Provags-ID: V03:K1:GtUd8H+oU+/rGHVmSrSb1lFn3Vzv6jBrj+5Jn+C8X3mVoNylnf0 HUB0buocKXfBQxiqiUXLqjD5ORED1qDZacv6KAd/L+TGkvfw5dyl8sF/9bDW9AKZwVcicHw Qp4bzDYji0GOVD4r+WKQ7BcF3/OxAhFsA7dY07fJkpbZdbXpR4IcG4BQsK2OHNxXMgnhPje v5+oLwYXTfn65DyFf/4Uw== UI-OutboundReport: notjunk:1;M01:P0:4JrRCJESVpM=;PNVHASQ0Gb7KW7Fiy5kLHWGmuzw nXOrfV6rowTyYHuYygfQxkQ5gYJTK7g+AHukKZSIRvXFHNVGqvxWFRfMpp/l4UeMHd64RjfeX Hkzy+Yd3d5nBOV/N+TKIwHIEzNUBE32tip0HGwZB6+YRHY/wDJd2tYBRvViJZ3fI7paR/h0Jb pkzttGyzjmlVmeh/hE/gjJkbtcky/rhMnuqb8Zk4yM3TQELdxhkVCGaWGrQzQ15WEIynnbsbY ei2aKA6i5VjgzpWp9kz+NghAJzLAmImhfbpZ1MVC5ydwUYfG5s4S5U3JPz3m6RDIYcU1UNME2 Sr7fvhMz7I74T3XvIzuVKnsDLDZQ3XOpeR+tbNsnBHPa9ZfnY41RwG5KkgHZt3GkD1ib/zZVy kDkZZqkMw6UdnMi1Q1M/gouzDgp1j5rkkmCUkSXRM63Lg8tsHwikC3TgGyDjM4HzUkwc4mZcM 97z3G5PHhL1cylIPqCbpDbJhDrraXBZBF7vNFXTEYWGT4ZQbxy73bklZgDFAyaasGWDMhwHqC aEDzjVKL2z+nYKptuzs3+UJiT1yxXGRbmTeaioGcfLs8RxqPKFp62cKygnnTM3C/8lNS2pjYl paxpk1PKJgZQA0WQlinxlcv0mzwT1RKMY2OJPP80qZSNSIbhowxhRlZUoog+hFLLWgTy8jmEv kWLVuSJmY+uIAqCZfiJL20JFDNEBzNx0wrdeE+ApnNY31gBhdlJnx+RmwZPrbGmMdVN6Yl/wj AyN40sfiVsHxIB43DA28meeZ+Ml1zmSoOEQguhidyqkH7fb9X9rpoI1BPYNjm7CKXrcqH61a 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:253624 Archived-At: --=-=-= Content-Type: text/plain Gregory Heytings writes: > Hi Michael, Hi Gregory, >>> what do you think of that patch? It would be regrettable to leave >>> that bug unfixed in Emacs 29. >> >> Yes, it would be desirable to fix this. But it isn't the end of the >> world if this doesn't happen, the problem is already evident in >> Emacs 28, so we don't have a regression. >> > > It's correct that the same problem is present in Emacs 28, but it is > not in Emacs 27, so it's a regression. As I tried to explain in > bug#50387, the problem is that once Tramp is loaded, Tramp methods are > returned when completions are requested for a root directory ("/"). > This problem is even worse since commit d5c6bf9625: prior to that > commit only the 'scp' and 'scpx' methods were returned (in emacs -Q), > now all methods are returned. And this confuses the flex and > substring completion mechanisms. Yes. But this is not a Tramp fault. Completion styles like flex (and substring, didn't test) do ignore Tramp file name syntax. They simply think in terms of file name parts, separated by "/". This is not appropriate for remote file names. Tramp knows only file-name-completion and file-name-all-completions. This is what it is called with; Tramp doesn't know anything about completion styles. It would be an error to bring this into Tramp, based on these two functions which are not designed to give the file name handler more information about completion styles. This is our disagreement. >>>> By the way, to limit the scope of the potential collateral >>>> damages, it is also possible to use that condition only when >>>> completion-styles contain 'substring' or 'flex'. >>>> >>>> What do you think of the attached patch? >> >> And what do we want to do if there are more completion-styles like >> this? Extend Tramp then? > > Not extend Tramp, but add them, if necessary, to the list of > completion-styles that are handled specially by Tramp at that > place. Unless of course a better fix has been implemented in the > meantime. And this is exactly my fear: Tramp would depend on unrelated features, and Tramp must follow. And you can't even guarantee that Tramp knows all completion styles in question. Any user in the wild can specify her own completion style. > Well, that looks like a separate problem, with a non-default syntax, > which (given the number of hits of "tramp-change-syntax" on Google or > on Github) is apparently hardly ever used. Then write a bug report, requesting to remove this Tramp syntax :-) Seriously, this is the Tramp syntax used by XEmacs years ago. We've promised the XEmacs converts to keep this syntax, in order to make their life in GNU Emeacs less alienated. > Nonetheless, I tried your recipe with the patch applied, and the good > news is that with it, under Fido, Tramp behaves the same way it > behaves under the default completions: the available methods are > displayed after "/ [ s TAB", the same nonsense is displayed after "/ [ > ssh/ TAB", and the possible host names are displayed after typing a > letter followed by TAB. So yes, we shall at least hunt the bug displaying nonsense. >> Instead, Tramp shall apply a patch which is not related there, which >> adds further dependencies, which is not working for all use cases, >> and which is good for making more trouble in the future. My opinion. > > I don't understand what you mean here, sorry. Simply that it isn't Tramp's duty to fix the bug we're discussing. It must be fixed by the flex (and possibly also substring) completion styles. I spent another couple of hours debugging completion in minibuffer.el. The appended patch shows a possible fix for the flex completion style. I don't claim this shall go into master; it is just a rawhammer approach due to my limited knowledge about completion styles. But it might give you an idea how a solution could look like. Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 21d4607e7cf..a002143108f 100644 =2D-- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3013,8 +3013,11 @@ completion-file-name-table (substring string 1) pred action)) ((eq (car-safe action) 'boundaries) - (let ((start (length (file-name-directory string))) - (end (string-search "/" (cdr action)))) + (let ((start (length + (if (string-match-p "\\`/[-[:alnum:]]+:[^:]*\\'" st= ring) + string + (file-name-directory string)))) + (end (string-search "/\\:" (cdr action)))) `(boundaries ;; if `string' is "C:" in w32, (file-name-directory string) ;; returns "C:/", so `start' is 3 rather than 2. @@ -4205,6 +4208,9 @@ completion-flex--make-flex-pattern (defun completion-flex-try-completion (string table pred point) "Try to flex-complete STRING in TABLE given PRED and POINT." (unless (and completion-flex-nospace (string-search " " string)) + (if (and (string-match-p "\\`/[-[:alnum:]]+:[^:]*\\'" string) + (eq table 'completion-file-name-table)) + (completion-basic-try-completion string table pred point) (pcase-let ((`(,all ,pattern ,prefix ,suffix ,_carbounds) (completion-substring--all-completions string table pred point @@ -4217,7 +4223,7 @@ completion-flex-try-completion ;; contain the substring "config". FIXME: this still won't ;; augment "foo" to "froo" when matching "frodo" and ;; "farfromsober". - (completion-pcm--merge-try pattern all prefix suffix)))) + (completion-pcm--merge-try pattern all prefix suffix))))) (defun completion-flex-all-completions (string table pred point) "Get flex-completions of STRING in TABLE, given PRED and POINT." --=-=-=--