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

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

[nongnu] elpa/helm ece8a6042d 5/5: Remove helm-apropos-init-faces and us


From: ELPA Syncer
Subject: [nongnu] elpa/helm ece8a6042d 5/5: Remove helm-apropos-init-faces and use helm-apropos-init for all
Date: Wed, 15 Jun 2022 09:05:08 -0400 (EDT)

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

    Remove helm-apropos-init-faces and use helm-apropos-init for all
    
    helm-apropos-init takes now a new optional arg FN.
    
    Call helm-apropos-init with face-list as FN arg in face source.
---
 helm-elisp.el | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/helm-elisp.el b/helm-elisp.el
index 4216c92b26..e551fed1d0 100644
--- a/helm-elisp.el
+++ b/helm-elisp.el
@@ -497,34 +497,21 @@ double quote."
 ;;
 (defvar helm-apropos-history nil)
 
-(defun helm-apropos-init (test default)
-  "Init candidates buffer for `helm-apropos' sources."
+(defun helm-apropos-init (test default &optional fn)
+  "Setup `helm-candidate-buffer' for `helm-apropos' sources.
+A list of symbols fetched with FN is inserted in
+`helm-candidate-buffer', if FN is not provided symbols are fetched
+against obarray with predicate TEST. When FN is provided predicate TEST
+is only used to test DEFAULT."
   (require 'helm-help)
   (helm-init-candidates-in-buffer 'global
     (let ((default-symbol (and (stringp default)
                                (intern-soft default)))
-          (symbols (all-completions "" obarray test)))
+          (symbols (if fn (funcall fn) (all-completions "" obarray test))))
       (if (and default-symbol (funcall test default-symbol))
           (cons default-symbol symbols)
         symbols))))
 
-(defun helm-apropos-init-faces (default)
-  "Init candidates buffer for faces for `helm-apropos'."
-  (require 'helm-help)
-  (with-current-buffer (helm-candidate-buffer 'global)
-    (goto-char (point-min))
-    (let ((default-symbol (and (stringp default)
-                               (intern-soft default)))
-          (faces (face-list)))
-      (when (and default-symbol (facep default-symbol))
-        (insert (concat default "\n")))
-      (insert
-       (mapconcat #'prin1-to-string
-                  (if default
-                      (cl-remove-if (lambda (sym) (string= sym default)) faces)
-                    faces)
-                  "\n")))))
-
 (defun helm-apropos-default-sort-fn (candidates _source)
   (if (string= helm-pattern "")
       candidates
@@ -610,7 +597,7 @@ double quote."
   "Create `helm' source for faces to be displayed with
 `helm-apropos'."
   (helm-build-in-buffer-source "Faces"
-    :init (lambda () (helm-apropos-init-faces default))
+    :init (lambda () (helm-apropos-init 'facep default #'face-list))
     :fuzzy-match helm-apropos-fuzzy-match
     :filtered-candidate-transformer
     (append (and (null helm-apropos-fuzzy-match)



reply via email to

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