emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/helm 43bbf97ee4: Handle annotations in CR's


From: ELPA Syncer
Subject: [nongnu] elpa/helm 43bbf97ee4: Handle annotations in CR's
Date: Mon, 14 Nov 2022 13:59:01 -0500 (EST)

branch: elpa/helm
commit 43bbf97ee4a3e76ce32d582223a1dd4ae7ca6685
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Handle annotations in CR's
---
 helm-mode.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/helm-mode.el b/helm-mode.el
index 6fc914d6c4..a78bf18c10 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -498,8 +498,19 @@ If COLLECTION is an `obarray', a TEST should be needed. 
See `obarray'."
 
 (defun helm-cr-default-transformer (candidates source)
   "Default filter candidate function for `helm-comp-read'."
-  (let ((must-match (helm-get-attr 'must-match source)))
-    (cl-loop for c in candidates
+  (let ((must-match (helm-get-attr 'must-match source))
+        (annotation (plist-get completion-extra-properties
+                               :annotation-function)))
+    ;; Annotation is already handled in completion-in-region and in
+    ;; helm-completing-read-default-2 when emacs style is in use.
+    (cl-loop for c in (if (and annotation
+                               (not helm--completing-region)
+                               (memq helm-completion-style '(helm helm-fuzzy)))
+                          (helm-completion-in-region--initial-filter
+                           ;; Ensure we use the display part of candidates.
+                           (all-completions "" candidates)
+                           annotation nil nil)
+                        candidates)
              for cand = (let ((elm (if (stringp c)
                                        (replace-regexp-in-string "\\s\\" "" c)
                                      c)))
@@ -1912,6 +1923,9 @@ is non-nil."
 
 ;; Completion-in-region-function
 
+(defvar helm--completing-region nil
+  "[INTERNAL] flag let-bounded to nil when completing in region.")
+
 (defun helm--completion-in-region (origfun start end collection &optional 
predicate)
   "Helm replacement of `completion--in-region'.
 
@@ -1942,6 +1956,7 @@ Can be used for `completion-in-region-function' by 
advicing it with an
       (unwind-protect
           (let* ((enable-recursive-minibuffers t)
                  (completion-flex-nospace t)
+                 (helm--completing-region t)
                  (completion-styles (helm--prepare-completion-styles))
                  (input (buffer-substring-no-properties start end))
                  (prefix (and (eq helm-completion-style 'emacs) initial-input))



reply via email to

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