From: Eshel Yaron Date: Thu, 12 Dec 2024 16:00:26 +0000 (+0100) Subject: Drop completion--adjust-metadata style property X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8b108048a78453cdb3e5da7f3a6d995bba54b293;p=emacs.git Drop completion--adjust-metadata style property --- diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index d60fb9af40b..5400c57804c 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1391,11 +1391,8 @@ in a slash." (or (funcall func defp) (setq completions--only-exceptional-candidates (funcall func pred)))) - (t (funcall func pred)))) - (adjust-fn (get (cdr result-and-style) 'completion--adjust-metadata))) + (t (funcall func pred))))) (setq completion--matching-style (cdr result-and-style)) - (when (and adjust-fn metadata) - (setcdr metadata (cdr (funcall adjust-fn metadata)))) (if requote (funcall requote (car result-and-style) n) (car result-and-style)))) @@ -5322,40 +5319,6 @@ that is non-nil." :version "27.1" :type 'boolean) -(put 'flex 'completion--adjust-metadata 'completion--flex-adjust-metadata) - -(defun completion--flex-adjust-metadata (metadata) - "If `flex' is actually doing filtering, adjust sorting." - (let ((flex-is-filtering-p completion-pcm--regexp) - (existing-sf (completion-metadata-get metadata 'sort-function))) - (cl-flet - ((compose-flex-sort-fn (existing-sort-fn) - (lambda (completions) - (let* ((sorted (sort - (mapcar - (lambda (str) - (cons - (- (completion--flex-score - (or (get-text-property - 0 'completion--unquoted str) - str) - completion-pcm--regexp)) - str)) - (if existing-sort-fn - (funcall existing-sort-fn completions) - completions)) - #'car-less-than-car)) - (cell sorted)) - ;; Reuse the list - (while cell - (setcar cell (cdar cell)) - (pop cell)) - sorted)))) - `(metadata - ,@(and flex-is-filtering-p - `((sort-function . ,(compose-flex-sort-fn existing-sf)))) - ,@(cdr metadata))))) - (defun completion-flex--make-flex-pattern (pattern) "Convert PCM-style PATTERN into PCM-style flex pattern.