emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Completions and history


From: Juri Linkov
Subject: Re: Completions and history
Date: Tue, 12 Apr 2022 20:12:02 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]