From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: Dani Moncayo <dmoncayo@gmail.com>, 11714-done@debbugs.gnu.org
Subject: bug#11714: 24.1.50; find-file completion on a remote directory
Date: Fri, 22 Jun 2012 23:49:46 -0400 [thread overview]
Message-ID: <jwvmx3ur8pf.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87d350syld.fsf@gmx.de> (Michael Albinus's message of "Fri, 15 Jun 2012 11:39:42 +0200")
>> 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 <point> morecommonprefix <qpos> suffix
;; - commonprefix <qpos> newprefix <point> 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.
next prev parent reply other threads:[~2012-06-23 3:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-15 7:51 bug#11714: 24.1.50; find-file completion on a remote directory Dani Moncayo
2012-06-15 9:39 ` Michael Albinus
2012-06-23 3:49 ` Stefan Monnier [this message]
2012-06-23 10:25 ` Michael Albinus
2012-06-23 13:58 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvmx3ur8pf.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=11714-done@debbugs.gnu.org \
--cc=dmoncayo@gmail.com \
--cc=michael.albinus@gmx.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.