unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: emacs-devel@gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: master 82c76e3: * lisp/eshell/em-cmpl.el: Try and fix bug#41423
Date: Wed, 26 May 2021 18:34:37 +0100	[thread overview]
Message-ID: <87k0nlpff6.fsf@tcd.ie> (raw)
In-Reply-To: <20210201002717.273E120DF3@vcs0.savannah.gnu.org> (Stefan Monnier's message of "Sun, 31 Jan 2021 19:27:16 -0500 (EST)")

monnier@iro.umontreal.ca (Stefan Monnier) writes:

> branch: master
> commit 82c76e3aeb2465d1d1e66eae5db13ba53e38ed84
> Author: Stefan Monnier <monnier@iro.umontreal.ca>
> Commit: Stefan Monnier <monnier@iro.umontreal.ca>
>
>     * lisp/eshell/em-cmpl.el: Try and fix bug#41423
>     
>     (eshell--complete-commands-list): Rename from `eshell-complete-commands-list`.
>     Return a (dynamic) completion table rather than a list of completions.
>     Use `dolist` and `push`.

Ivy's (admittedly quite limited and buggy) completion hasn't worked
properly since this commit.  I've narrowed it down to the following
change in behaviour.

0. emacs -Q
1. Evaluate:

(let* (dir (clean (lambda () (when dir (delete-directory dir t)))))
  ;; Clean up temporary directory on exit.
  (add-hook 'kill-emacs-hook clean)
  ;; Create temporary parent directory.
  (setq dir (make-temp-file "ivy-" t))
  ;; Create executable file bin/foo under parent directory.
  (let ((exe (expand-file-name "bin/foo" dir)))
    (make-empty-file exe t)
    (set-file-modes exe (file-modes-symbolic-to-number
                         "u+x" (file-modes exe))))
  ;; Start `eshell' in parent directory.
  (let ((default-directory dir))
    (eshell))
  ;; Debug in-buffer completion.
  (setq-local completion-in-region-function
              (lambda (beg end table &optional pred)
                (let* ((str (buffer-substring beg end))
                       (md (completion-metadata str table pred))
                       (all (completion-all-completions
                             str table pred (- end beg) md))
                       (standard-output (messages-buffer))
                       (inhibit-read-only t))
                  (terpri nil t)
                  (pp md)
                  (pp all)))))

2. C-h e
3. ./bi TAB

Before the commit in question, this gave:

  (metadata
   (cycle-sort-function . #[...])
   (category . file)
   (completion--unquote-requote . t))
  (#("bin/"
     0 1 (face completions-common-part)
     1 2 (face completions-common-part arg-end t rear-nonsticky
               (arg-end arg-begin))
     2 3 (face (completions-first-difference)))
   . 2)

And after:

  (metadata (completion--unquote-requote . t))
  (#("bin/" 0 4 (face (completions-common-part))) . 0)

Is this expected, or should some of the old information have been
preserved?

The relevant bug in Ivy[1] is due to its completion-in-region-function
unfortunately relying on the completions-first-difference face to know
how much of the existing buffer text to replace[2].  Do you have any
recommendations for what to use instead?

[1]: https://github.com/abo-abo/swiper/issues/2879
[2]: https://github.com/abo-abo/swiper/issues/1361

Thanks,

-- 
Basil



       reply	other threads:[~2021-05-26 17:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210201002715.13331.49843@vcs0.savannah.gnu.org>
     [not found] ` <20210201002717.273E120DF3@vcs0.savannah.gnu.org>
2021-05-26 17:34   ` Basil L. Contovounesios [this message]
2021-06-05 15:52     ` master 82c76e3: * lisp/eshell/em-cmpl.el: Try and fix bug#41423 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

  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=87k0nlpff6.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).