From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#11714: 24.1.50; find-file completion on a remote directory Date: Fri, 22 Jun 2012 23:49:46 -0400 Message-ID: References: <87d350syld.fsf@gmx.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1340423669 24536 80.91.229.3 (23 Jun 2012 03:54:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 23 Jun 2012 03:54:29 +0000 (UTC) Cc: Dani Moncayo , 11714-done@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 23 05:54:27 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SiHQZ-0000yB-Ao for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Jun 2012 05:54:27 +0200 Original-Received: from localhost ([::1]:48494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiHQZ-00083K-9V for geb-bug-gnu-emacs@m.gmane.org; Fri, 22 Jun 2012 23:54:27 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiHQV-00083D-Vi for bug-gnu-emacs@gnu.org; Fri, 22 Jun 2012 23:54:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiHQU-00067O-4R for bug-gnu-emacs@gnu.org; Fri, 22 Jun 2012 23:54:23 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiHQU-00067D-15 for bug-gnu-emacs@gnu.org; Fri, 22 Jun 2012 23:54:22 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SiHU2-0004fH-PQ for bug-gnu-emacs@gnu.org; Fri, 22 Jun 2012 23:58:02 -0400 Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Jun 2012 03:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 11714 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 11714@debbugs.gnu.org, monnier@iro.umontreal.ca Original-Received: via spool by 11714-done@debbugs.gnu.org id=D11714.134042384617888 (code D ref 11714); Sat, 23 Jun 2012 03:58:02 +0000 Original-Received: (at 11714-done) by debbugs.gnu.org; 23 Jun 2012 03:57:26 +0000 Original-Received: from localhost ([127.0.0.1]:53351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiHTR-0004eS-Tv for submit@debbugs.gnu.org; Fri, 22 Jun 2012 23:57:26 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:17478) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiHTP-0004eL-G6 for 11714-done@debbugs.gnu.org; Fri, 22 Jun 2012 23:57:23 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai0FAG6Zu09MCrYj/2dsb2JhbAA7CbBIg0mBCIIVAQEEAScvIxALMAQIChQYDSSIHAWrEo53ixiCEIMcA6MzgViDBQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="191967649" Original-Received: from 76-10-182-35.dsl.teksavvy.com (HELO ceviche.home) ([76.10.182.35]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Jun 2012 23:53:40 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 52A3A660DC; Fri, 22 Jun 2012 23:49:46 -0400 (EDT) In-Reply-To: <87d350syld.fsf@gmx.de> (Michael Albinus's message of "Fri, 15 Jun 2012 11:39:42 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:61199 Archived-At: >> Recipe from "emacs -Q": >> 1. Eval: (cd "/some-user@some-host:~") >> 2. Give the correct password. >> 3. Type: C-x C-f / h o m e / s o m e - u s e r / t TAB I just fixed this in the trunk with the patch below. Stefan === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2012-06-18 20:39:52 +0000 +++ lisp/minibuffer.el 2012-06-23 03:46:25 +0000 @@ -488,7 +488,7 @@ (defun completion--twq-try (string ustring completion point unquote requote) - ;; Basically two case: either the new result is + ;; Basically two cases: either the new result is ;; - commonprefix1 morecommonprefix suffix ;; - commonprefix newprefix suffix (pcase-let* @@ -505,8 +505,13 @@ ((> point (length prefix)) (+ qpos (length qstr1))) (t (car (funcall requote point string)))))) ;; Make sure `requote' worked. - (assert (equal (funcall unquote qstring) completion)) - (cons qstring qpoint))) + (if (equal (funcall unquote qstring) completion) + (cons qstring qpoint) + ;; If requote failed (e.g. because sifn-requote did not handle + ;; Tramp's "/foo:/bar//baz -> /foo:/baz" truncation), then at least + ;; try requote properly. + (let ((qstr (funcall qfun completion))) + (cons qstr (length qstr)))))) (defun completion--string-equal-p (s1 s2) (eq t (compare-strings s1 nil nil s2 nil nil 'ignore-case))) @@ -2130,6 +2135,12 @@ ;; find the position corresponding to UPOS in QSTR, but ;; substitute-in-file-name can do anything, depending on file-name-handlers. ;; Kind of like in rfn-eshadow-update-overlay, only worse. + ;; FIXME: example of thing we do not handle: Tramp's makes + ;; (substitute-in-file-name "/foo:~/bar//baz") -> "/scpc:foo:/baz". + ;; FIXME: One way to try and handle "all" cases is to require + ;; substitute-in-file-name to preserve text-properties, so we could + ;; apply text-properties to the input string and then look for them in + ;; the output to understand what comes from where. (let ((qpos 0)) ;; Handle substitute-in-file-name's truncation behavior. (let (tpos) @@ -2824,14 +2835,14 @@ (defun completion--sreverse (str) "Like `reverse' but for a string STR rather than a list." - (apply 'string (nreverse (mapcar 'identity str)))) + (apply #'string (nreverse (mapcar 'identity str)))) (defun completion--common-suffix (strs) "Return the common suffix of the strings STRS." (completion--sreverse (try-completion "" - (mapcar 'completion--sreverse strs)))) + (mapcar #'completion--sreverse strs)))) (defun completion-pcm--merge-completions (strs pattern) "Extract the commonality in STRS, with the help of PATTERN.