unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler <mail@daniel-mendler.de>
To: "Dmitry Gutov" <dmitry@gutov.dev>,
	"Rudolf Adamkovič" <salutis@me.com>,
	62776@debbugs.gnu.org
Subject: bug#62776: 30.0.50; 'project-find-file' ignoring 'file-name-history'
Date: Wed, 19 Apr 2023 14:05:27 +0200	[thread overview]
Message-ID: <fe05d551-12af-53cf-a372-2835caee4a14@daniel-mendler.de> (raw)
In-Reply-To: <1310e385-f151-2a96-d7b9-cd21c082adc3@gutov.dev>



On 4/19/23 12:47, Dmitry Gutov wrote:
> On 19/04/2023 08:54, Daniel Mendler wrote:
>> On 4/19/23 03:54, Dmitry Gutov wrote:
>>> It's possible that vertico--history-hash is confused by our manipulation
>>> of the history entries -- like how they are stored as absolute file
>>> names now (bug#58447).
>> Yes, that's right. A tweak to the hash manipulation would be needed. On
>> the other hand we cannot handle all special cases in
>> vertico--history-hash. For such cases one can set the
>> vertico-sort-function or vertico-sort-override-function variables per
>> command.
> Perhaps there is some straightforward way to determine whether the 
> current completion table stops at separators or not, to be used here.

Yes, one could for example check if the base string is empty, stored in
`vertico--base`. Then the suffix should not be removed. However we would
still strip the `default-directory` (or project directory) from all the
candidates stored in the history, since the project file names are
relative. Iirc this was introduced in a recent change in project.el,
which was a good change in principle, but unfortunately breaks the
assumptions of sorting by history.

All in all this makes `project-find-file` a special case which we could
handle specially in `vertico--history-hash`, but I try really hard to
avoid accumulating special cases in Vertico. Another alternative would
be to control the sorting directly in `project-find-file` by setting the
`display-sort-function` and `cycle-sort-function`, maybe via a
configuration variable. It is not really obvious where sorting is
handled best. For example in my Consult package, which offers "highly
tuned" completion commands, the commands usually try to control many
aspects of completion (including sorting), while for other simpler
commands it is better to let the completion UI do more of the work.

Daniel





  reply	other threads:[~2023-04-19 12:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-11 15:21 bug#62776: 30.0.50; 'project-find-file' ignoring 'file-name-history' Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-12  1:18 ` Dmitry Gutov
2023-04-18 21:38   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-19  1:54     ` Dmitry Gutov
2023-04-19  5:54       ` Daniel Mendler
2023-04-19 10:47         ` Dmitry Gutov
2023-04-19 12:05           ` Daniel Mendler [this message]
2023-04-19 15:28             ` Dmitry Gutov
2023-04-19 15:46               ` Daniel Mendler
2023-04-19 15:49                 ` Dmitry Gutov
2023-04-19 17:07                   ` Daniel Mendler
2023-04-19 22:24                     ` Dmitry Gutov
     [not found] ` <handler.62776.D62776.168194305529292.notifdone@debbugs.gnu.org>
2023-04-24  9:20   ` bug#62776: closed (Re: bug#62776: 30.0.50; 'project-find-file' ignoring 'file-name-history') Rudolf Adamkovič 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=fe05d551-12af-53cf-a372-2835caee4a14@daniel-mendler.de \
    --to=mail@daniel-mendler.de \
    --cc=62776@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=salutis@me.com \
    /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).