branch: elpa/helm
commit 5aec5f45e496049f7264d17d7cb3b9f5c2b81f12
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    Add a new source for new packages
    
    Wrap :data values in lambdas.
---
 helm-packages.el | 60 +++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 24 deletions(-)

diff --git a/helm-packages.el b/helm-packages.el
index 7f032c861a8..646fc2e17e0 100644
--- a/helm-packages.el
+++ b/helm-packages.el
@@ -520,7 +520,11 @@ to avoid errors with outdated packages no more availables."
   (when arg (helm-packages--refresh-contents))
   (let ((upgrades (helm-package--upgradeable-packages
                    helm-package-install-upgrade-built-in))
-        (removables (package--removable-packages)))
+        (removables (package--removable-packages))
+        (standard-actions '(("Describe package" . helm-packages-describe)
+                            ("Visit homepage" . helm-packages-visit-homepage)
+                            ("Install packages(s)" . helm-packages-install)
+                            ("Clone package" . helm-packages-clone-package))))
     (helm :sources (list
                     (helm-make-source "Availables for upgrade" 
'helm-packages-class
                       :init (lambda ()
@@ -545,31 +549,39 @@ to avoid errors with outdated packages no more 
availables."
                                 ("Uninstall package(s)" . 
helm-packages-uninstall)
                                 ("Isolate package(s)" . helm-packages-isolate)
                                 ("Clone package" . 
helm-packages-clone-package)))
+                    (helm-make-source "New packages" 'helm-packages-class
+                      :data (lambda ()
+                              (cl-loop for p in package-archive-contents
+                                       for sym = (car p)
+                                       for id = (package-get-descriptor sym)
+                                       for status = (and id 
(package-desc-status id))
+                                       when (equal status "new")
+                                       nconc (list (car p))))
+                      :action standard-actions)
                     (helm-make-source "Available external packages" 
'helm-packages-class
-                      :data (cl-loop for p in package-archive-contents
-                                     for sym = (car p)
-                                     for id = (package-get-descriptor sym)
-                                     for status = (package-desc-status id)
-                                     unless (or (and id (member
-                                                         status
-                                                         '("installed" 
"dependency" "source")))
-                                                (and id (assoc sym 
package--builtins)))
-                                     nconc (list (car p)))
-                      :action '(("Describe package" . helm-packages-describe)
-                                ("Visit homepage" . 
helm-packages-visit-homepage)
-                                ("Install packages(s)" . helm-packages-install)
-                                ("Clone package" . 
helm-packages-clone-package)))
+                      :data (lambda ()
+                              (cl-loop for p in package-archive-contents
+                                       for sym = (car p)
+                                       for id = (package-get-descriptor sym)
+                                       for status = (package-desc-status id)
+                                       unless (or (and id (member
+                                                           status
+                                                           '("new" "installed"
+                                                             "dependency" 
"source")))
+                                                  (and id (assoc sym 
package--builtins)))
+                                       nconc (list (car p))))
+                      :action standard-actions)
                     (helm-make-source "Available built-in packages" 
'helm-packages-class
-                      :data (cl-loop for p in package--builtins
-                                     ;; Show only builtins that are available 
as
-                                     ;; well on (m)elpa. Other builtins don't
-                                     ;; have a package-descriptor, the format 
is
-                                     ;; (sym . [version reqs summary]).
-                                     when (package-desc-p 
(package-get-descriptor (car p)))
-                                     collect (car p))
-                      :action '(("Describe package" . helm-packages-describe)
-                                ("Visit homepage" . 
helm-packages-visit-homepage)
-                                ("Install packages(s)" . 
helm-packages-install))))
+                      :data (lambda ()
+                              (cl-loop for p in package--builtins
+                                       ;; Show only builtins that are 
available as
+                                       ;; well on (m)elpa. Other builtins don't
+                                       ;; have a package-descriptor, the 
format is
+                                       ;; (sym . [version reqs summary]).
+                                       when (package-desc-p 
(package-get-descriptor (car p)))
+                                       collect (car p)))
+                      :action (remove (assoc "Clone package" standard-actions)
+                                      standard-actions)))
           :buffer "*helm packages*")))
 
 ;;;###autoload

Reply via email to