unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Daniel Mendler <mail@daniel-mendler.de>
Cc: 47678@debbugs.gnu.org
Subject: bug#47678: 27.1; `completion-boundaries` assertion failure for file
Date: Mon, 12 Apr 2021 19:28:00 -0400	[thread overview]
Message-ID: <jwvpmyz9knm.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8d537117-d036-ad84-e013-d98efb3ae0c4@daniel-mendler.de> (Daniel Mendler's message of "Fri, 9 Apr 2021 22:35:28 +0200")

> 2. Press "C-x C-f"
> 3. Enter the path "~//"
> 4. Move the point between the slashes, "~/|/"
> 5. Press "C-."

Thanks!
[ It would have helped to say what happens for you there.  ]

> The function `test-boundaries' should determine the completion
> boundaries correctly. I assume that the function `completion-boundaries'
> should never fail with an error.

[ From this I can guess that you maybe got some kind of error?
  Including a backtrace or the text of the error or some
  description of the error would have been helpful.  ]

I installed the patch below, which seems to fix the immediate problem
I managed to reproduce, but it might lead to further problems down
the road.


        Stefan


diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 5f594679ca..c900b0d7ce 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -488,8 +488,17 @@ completion-table-with-quoting
              (qsuffix (cdr action))
              (ufull (if (zerop (length qsuffix)) ustring
                       (funcall unquote (concat string qsuffix))))
-             (_ (cl-assert (string-prefix-p ustring ufull)))
-             (usuffix (substring ufull (length ustring)))
+             ;; If (not (string-prefix-p ustring ufull)) we have a problem:
+             ;; the unquoting the qfull gives something "unrelated" to ustring.
+             ;; E.g. "~/" and "/" where "~//" gets unquoted to just "/" (see
+             ;; bug#47678).
+             ;; In that case we can't even tell if we're right before the
+             ;; "/" or right after it (aka if this "/" is from qstring or
+             ;; from qsuffix), which which usuffix to use is very unclear.
+             (usuffix (if (string-prefix-p ustring ufull)
+                          (substring ufull (length ustring))
+                        ;; FIXME: Maybe "" is preferable/safer?
+                        qsuffix))
              (boundaries (completion-boundaries ustring table pred usuffix))
              (qlboundary (car (funcall requote (car boundaries) string)))
              (qrboundary (if (zerop (cdr boundaries)) 0 ;Common case.






  reply	other threads:[~2021-04-12 23:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 20:35 bug#47678: 27.1; `completion-boundaries` assertion failure for file Daniel Mendler
2021-04-12 23:28 ` Stefan Monnier [this message]
2021-04-13  4:04   ` Daniel Mendler
2021-04-13 12:46     ` Stefan Monnier
2021-04-13 14:44       ` Daniel Mendler
2021-04-13 22:34         ` Stefan Monnier
2021-05-06 10:01           ` Lars Ingebrigtsen
2021-05-06 11:07             ` Daniel Mendler
2021-05-07 11:14               ` Lars Ingebrigtsen
2021-05-08 23:41               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-09  8:34                 ` Daniel Mendler
2021-05-09 13:37                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvpmyz9knm.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=47678@debbugs.gnu.org \
    --cc=mail@daniel-mendler.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).