unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler <mail@daniel-mendler.de>
To: 68214@debbugs.gnu.org
Subject: bug#68214: Completion sorting customization by category
Date: Wed, 3 Jan 2024 08:20:37 +0100	[thread overview]
Message-ID: <ab10a89f-4223-415b-8949-57b1b7a0b444@daniel-mendler.de> (raw)
In-Reply-To: <86a5pnzst1.fsf@mail.linkov.net>

Hi Juri,

thank you for this patch. Would it make sense to define a general
`completion-metadata-override-get` function instead of
`completion--display-sort-function`? This function could be used to look
up the other meta data functions too, `display-sort-function`,
`annotation-function`, `affixation-function`, `group-function`, etc.

(defun completion-metadata-override-get (metadata prop)
  (if-let ((cat (completion-metadata-get metadata 'category))
           (over (completion--category-override cat prop)))
      (cdr over)
    (completion-metadata-get metadata prop)))

I suggest to use `if-let` instead of `let*`, such that an override is
not retrieved if the category is nil.

Besides that, in the `completion-category-overrides`, you use
`completion--sorting-type` for the `display-sort-function`, while it
should just be `function`.

Daniel





  reply	other threads:[~2024-01-03  7:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 17:07 bug#68214: Completion sorting customization by category Juri Linkov
2024-01-03  7:20 ` Daniel Mendler [this message]
2024-01-03 16:07   ` Juri Linkov
2024-01-03 17:12     ` Daniel Mendler
2024-01-04 17:21       ` Juri Linkov
2024-01-05  7:59         ` Juri Linkov
2024-01-05  8:33           ` Daniel Mendler
2024-01-06 17:33             ` Juri Linkov
2024-01-06 17:59               ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-07 18:05                 ` Juri Linkov
2024-01-07 18:37                   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 17:59                     ` Juri Linkov
2024-01-09 18:14                       ` Juri Linkov
2024-01-09 18:31                         ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-10  7:35                           ` Juri Linkov
2024-01-10  8:53                             ` Daniel Mendler 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=ab10a89f-4223-415b-8949-57b1b7a0b444@daniel-mendler.de \
    --to=mail@daniel-mendler.de \
    --cc=68214@debbugs.gnu.org \
    /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).