summaryrefslogtreecommitdiff
path: root/helm-adaptive.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-02-21 12:16:29 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-02-21 12:16:29 +0100
commit2d7b7e52edb7522552f4fe8a53d28ae6d9508e77 (patch)
tree7e7c8beab11e796e579cb341b2057420dd731d0f /helm-adaptive.el
parente991087781e17de415ead3dec0d3e67897b637f7 (diff)
Fix adaptive sorting with candidate having no empty pattern entry.
* helm-adaptive.el (helm-adaptive-sort): Do it and rewrite loop.
Diffstat (limited to 'helm-adaptive.el')
-rw-r--r--helm-adaptive.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/helm-adaptive.el b/helm-adaptive.el
index 60c13229..c8313b1b 100644
--- a/helm-adaptive.el
+++ b/helm-adaptive.el
@@ -170,19 +170,18 @@ This is a filtered candidate transformer you can use with the
(if source-info
(let ((usage
;; Assemble a list containing the (CANDIDATE . USAGE-COUNT) pairs.
- (cl-loop with count = 0
- for (sn . infos) in (cdr source-info)
+ (cl-loop for (src-cand . infos) in (cdr source-info)
+ for count = 0
do (cl-loop for (pattern . score) in infos
- if (not (equal pattern helm-pattern))
- do (cl-incf count score)
- else return
;; If current pattern is equal to the previously
;; used one then this candidate has priority
;; (that's why its count is boosted by 10000) and
;; it only has to compete with other candidates
;; which were also selected with the same pattern.
- (setq count (+ 10000 score)))
- and collect (cons sn count) into results
+ if (equal pattern helm-pattern)
+ return (setq count (+ 10000 score))
+ else do (cl-incf count score))
+ and collect (cons src-cand count) into results
;; Sort the list in descending order, so candidates with highest
;; priority come first.
finally return (sort results (lambda (first second)