all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Ergus <spacibba@aol.com>
Cc: emacs-devel@gnu.org
Subject: Re: Completions and history
Date: Tue, 12 Apr 2022 20:12:02 +0300	[thread overview]
Message-ID: <86h76ytee5.fsf@mail.linkov.net> (raw)
In-Reply-To: <20220412165958.2jzxtqxvx7jxmndy@Ergus> (Ergus's message of "Tue,  12 Apr 2022 18:59:58 +0200")

>> One problem is that completions are sorted alphabetically that
>> makes no sense for history items which are sorted chronologically.
>> So the first thing to do would be to add sorting keys in Completions
>> that will allow switching the order between alphabetical and unsorted
>> (history items are in chronological order, so unsorted should keep it)
>> that will change the value of 'completions-sort'.
>
> A comment about this... completion-at-point-functions accept a list with
> a format (START END COLLECTION . PROPS)
>
> The PROPS can be any :completion-extra-properties plus predicate and
> exclusive.. maybe the way to do this is to add a property :sort or
> similar... Then on the other side we use that property to select the
> sorting method... Does it makes sense?

It already works fine with:

```
(defun minibuffer-complete-history ()
  "Complete the minibuffer history as far as possible.
Like `minibuffer-complete' but completes on the history items
instead of the default completion table."
  (interactive)
  (let ((completions-sort nil))
    (completion-in-region (minibuffer--completion-prompt-end) (point-max)
                          (symbol-value minibuffer-history-variable)
                          nil)))

(define-key minibuffer-local-map [C-tab] 'minibuffer-complete-history)
```

So the only question is whether this should have a new defcustom?
Maybe 'minibuffer-complete-history-sort'?

>> Another question: should duplicate history items be retained
>> in the Completions window when history-delete-duplicates is nil?
>
> In principle yes... unless you add another custom for that... But the
> first is the important part.. to have the history list in order...

Another defcustom?  Maybe 'minibuffer-complete-history-delete-duplicates'?



  reply	other threads:[~2022-04-12 17:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220411112901.kv3lsyvx6yxwjbph.ref@Ergus>
2022-04-11 11:29 ` Completions and history Ergus
2022-04-11 16:56   ` Juri Linkov
2022-04-11 17:40     ` Ergus
2022-04-12 16:20       ` Juri Linkov
2022-04-12 16:53         ` Ergus
2022-04-12 16:59         ` Ergus
2022-04-12 17:12           ` Juri Linkov [this message]
2022-04-12 17:35             ` Ergus
2022-04-12 18:10               ` Juri Linkov
2022-04-12 17:24       ` Augusto Stoffel
2022-04-12 17:50         ` [External] : " Drew Adams
2022-04-12 18:05           ` Juri Linkov
2022-04-12 19:49             ` Drew Adams
2022-04-13  7:50               ` Juri Linkov
2022-04-13 12:00                 ` Augusto Stoffel
2022-04-13 12:12                   ` Po Lu
2022-04-14  2:56                     ` Richard Stallman
2022-04-13 16:40                   ` Drew Adams
2022-04-13 17:58                     ` Juri Linkov
2022-04-13 17:57                   ` Juri Linkov
2022-04-13 15:49                 ` Drew Adams

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=86h76ytee5.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=spacibba@aol.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 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.