aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2021-04-12 19:23:45 -0400
committerStefan Monnier2021-04-12 19:23:57 -0400
commitfc3caa45ef2dcbd5a1c8339f14696589b99888ce (patch)
tree8cd6c7d314d7d825dc81473c123719b3de3c49ae
parent3cb0229d75b1380d7a144e24ad24172497fb931c (diff)
downloademacs-fc3caa45ef2dcbd5a1c8339f14696589b99888ce.tar.gz
emacs-fc3caa45ef2dcbd5a1c8339f14696589b99888ce.zip
* lisp/minibuffer.el (completion-table-with-quoting): Fix bug#47678
-rw-r--r--lisp/minibuffer.el13
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 5f594679ca3..c900b0d7ce6 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -488,8 +488,17 @@ for use at QPOS."
488 (qsuffix (cdr action)) 488 (qsuffix (cdr action))
489 (ufull (if (zerop (length qsuffix)) ustring 489 (ufull (if (zerop (length qsuffix)) ustring
490 (funcall unquote (concat string qsuffix)))) 490 (funcall unquote (concat string qsuffix))))
491 (_ (cl-assert (string-prefix-p ustring ufull))) 491 ;; If (not (string-prefix-p ustring ufull)) we have a problem:
492 (usuffix (substring ufull (length ustring))) 492 ;; the unquoting the qfull gives something "unrelated" to ustring.
493 ;; E.g. "~/" and "/" where "~//" gets unquoted to just "/" (see
494 ;; bug#47678).
495 ;; In that case we can't even tell if we're right before the
496 ;; "/" or right after it (aka if this "/" is from qstring or
497 ;; from qsuffix), which which usuffix to use is very unclear.
498 (usuffix (if (string-prefix-p ustring ufull)
499 (substring ufull (length ustring))
500 ;; FIXME: Maybe "" is preferable/safer?
501 qsuffix))
493 (boundaries (completion-boundaries ustring table pred usuffix)) 502 (boundaries (completion-boundaries ustring table pred usuffix))
494 (qlboundary (car (funcall requote (car boundaries) string))) 503 (qlboundary (car (funcall requote (car boundaries) string)))
495 (qrboundary (if (zerop (cdr boundaries)) 0 ;Common case. 504 (qrboundary (if (zerop (cdr boundaries)) 0 ;Common case.