Skip to content

Commit

Permalink
Use candidates unmodified when default sort fn is nil (#2689)
Browse files Browse the repository at this point in the history
Magit is disabling sorting in its
`magit-completing-read-multiple' by let binding
`helm-completion-in-region-default-sort-fn' to
nil to prevent modifying candidates order.
  • Loading branch information
thierryvolpiatto committed Nov 25, 2024
1 parent 1b6d181 commit ba38ab7
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions helm-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1633,8 +1633,12 @@ This handler uses dynamic matching which allows honouring `completion-styles'."
;; its candidates unmodified when sorting is already done.
(append (list (lambda (candidates source)
(helm-completion--decorate
(funcall helm-completion-in-region-default-sort-fn
candidates source)
;; When `helm-completion-in-region-default-sort-fn' is
;; nil use CANDIDATES unmodified (bug #2689).
(if helm-completion-in-region-default-sort-fn
(funcall helm-completion-in-region-default-sort-fn
candidates source)
candidates)
afun afix category)))
'(helm-cr-default-transformer))
:popup-info popup-info
Expand Down Expand Up @@ -2736,8 +2740,14 @@ Can be used for `completion-in-region-function' by advicing it with an
;; its candidates unmodified when sorting is already done.
(append (list (lambda (candidates source)
(helm-completion--decorate
(funcall helm-completion-in-region-default-sort-fn
candidates source)
;; Magit is disabling sorting in its
;; `magit-completing-read-multiple' by let binding
;; `helm-completion-in-region-default-sort-fn' to
;; nil to prevent modifying candidates order (bug #2689).
(if helm-completion-in-region-default-sort-fn
(funcall helm-completion-in-region-default-sort-fn
candidates source)
candidates)
afun afix category)))
'(helm-cr-default-transformer))
:popup-info docsig
Expand Down

0 comments on commit ba38ab7

Please sign in to comment.