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

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

[nongnu] elpa/helm 7f1c783898 3/5: Allow refreshing packages with C-c C-


From: ELPA Syncer
Subject: [nongnu] elpa/helm 7f1c783898 3/5: Allow refreshing packages with C-c C-u in helm-packages
Date: Tue, 5 Sep 2023 07:00:15 -0400 (EDT)

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

    Allow refreshing packages with C-c C-u in helm-packages
    
    Add a new fn helm-package-refresh-contents that use a flag to not
    repeat unneedlessly refresh across sources.
    Remove refreshing packages from actions now we have C-c C-u to update.
---
 helm-packages.el | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/helm-packages.el b/helm-packages.el
index b0a801187d..a38a0e163a 100644
--- a/helm-packages.el
+++ b/helm-packages.el
@@ -31,7 +31,8 @@
     :initform
     '(helm-packages-transformer
       (lambda (candidates _source)
-        (sort candidates #'helm-generic-sort-fn)))))
+        (sort candidates #'helm-generic-sort-fn))))
+   (update :initform #'helm-packages--refresh-contents))
   "A class to define `helm-packages' sources.")
 
 ;;; Actions
@@ -40,9 +41,6 @@
 (defun helm-packages-upgrade (_candidate)
   "Helm action for upgrading marked packages."
   (let ((mkd (helm-marked-candidates)))
-    (when (and helm-current-prefix-arg
-               (y-or-n-p "Refresh package contents?"))
-      (package-refresh-contents))
     (with-helm-display-marked-candidates
       helm-marked-buffer-name
       (mapcar #'symbol-name mkd)
@@ -68,9 +66,6 @@
 (defun helm-packages-package-reinstall (_candidate)
   "Helm action for reinstalling marked packages."
   (let ((mkd (helm-marked-candidates)))
-    (when (and helm-current-prefix-arg
-               (y-or-n-p "Refresh package contents?"))
-      (package-refresh-contents))
     (with-helm-display-marked-candidates
       helm-marked-buffer-name
       (mapcar #'symbol-name mkd)
@@ -118,9 +113,6 @@ as dependencies."
 (defun helm-packages-install (_candidate)
   "Helm action for installing marked packages."
   (let ((mkd (helm-marked-candidates)))
-    (when (and helm-current-prefix-arg
-               (y-or-n-p "Refresh package contents?"))
-      (package-refresh-contents))
     (with-helm-display-marked-candidates
       helm-marked-buffer-name
       (mapcar #'symbol-name mkd)
@@ -220,6 +212,12 @@ Arg PACKAGES is a list of strings."
   "Transformer function for `helm-packages' upgrade and delete sources."
   (cl-loop for c in candidates
            collect (cons (propertize c 'face 'font-lock-keyword-face) c)))
+
+(defvar helm-packages--updated nil)
+(defun helm-packages--refresh-contents ()
+  (unless helm-packages--updated (package-refresh-contents))
+  (helm-set-local-variable 'helm-packages--updated t))
+
 
 ;;;###autoload
 (defun helm-packages (&optional arg)
@@ -231,8 +229,7 @@ When installing or upgrading ensure to refresh the package 
list
 to avoid errors with outdated packages no more availables."
   (interactive "P")
   (package-initialize)
-  (when arg
-    (package-refresh-contents))
+  (when arg (helm-packages--refresh-contents))
   (let ((upgrades (package--upgradeable-packages))
         (removables (package--removable-packages)))
     (helm :sources (list



reply via email to

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