aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2019-11-06 00:58:57 +0100
committerStefan Kangas2019-11-06 00:58:57 +0100
commit0c293f1520dd73203c03d7934ac21b2bae6eaf37 (patch)
treea17bcb047fd4091c7f4bde04f075d2a213fc1109
parentc91c145d61cb53cb9f88686cbde4aaf6d9c42794 (diff)
downloademacs-0c293f1520dd73203c03d7934ac21b2bae6eaf37.tar.gz
emacs-0c293f1520dd73203c03d7934ac21b2bae6eaf37.zip
Make 'g' refresh package data in package menu
* lisp/emacs-lisp/package.el (package-menu--refresh): Rename from 'package-menu-refresh', make internal and non-interactive. (package-menu-mode-map, package-menu-mode-menu, package-menu-mode) (list-packages): Use the above. (Bug#35504) (package-menu-refresh): Redefine as obsolete fuction alias for 'revert-buffer'. * doc/emacs/package.texi (Package Menu): Document it. * etc/NEWS: Announce it.
-rw-r--r--doc/emacs/package.texi9
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/emacs-lisp/package.el17
3 files changed, 24 insertions, 10 deletions
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 19efff74450..1c0f8534275 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -149,12 +149,13 @@ Download and install all packages marked with @kbd{i}, and their
149dependencies; also, delete all packages marked with @kbd{d} 149dependencies; also, delete all packages marked with @kbd{d}
150(@code{package-menu-execute}). This also removes the marks. 150(@code{package-menu-execute}). This also removes the marks.
151 151
152@item g
152@item r 153@item r
154@kindex g @r{(Package Menu)}
153@kindex r @r{(Package Menu)} 155@kindex r @r{(Package Menu)}
154@findex package-menu-refresh 156Refresh the package list (@code{revert-buffer}). This fetches the
155Refresh the package list (@code{package-menu-refresh}). This fetches 157list of available packages from the package archive again, and
156the list of available packages from the package archive again, and 158redisplays the package list.
157recomputes the package list.
158 159
159@item / k 160@item / k
160@kindex / k @r{(Package Menu)} 161@kindex / k @r{(Package Menu)}
diff --git a/etc/NEWS b/etc/NEWS
index 87aa5b5505f..737053a099a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1152,6 +1152,14 @@ the 'package-menu-clear-filter' function, bound to '/ /' by default.
1152--- 1152---
1153*** The package list can now be sorted by version or description. 1153*** The package list can now be sorted by version or description.
1154 1154
1155+++
1156*** In Package Menu, 'g' now updates package data from archives.
1157Previously, 'g' invoked 'tabulated-list-revert' which did not update
1158the cached archive data. It is now bound to 'revert-buffer', which
1159will now update the data.
1160
1161'package-menu-refresh' is an obsolete alias for 'revert-buffer'.
1162
1155** Info 1163** Info
1156 1164
1157+++ 1165+++
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 80ffdc30195..3c14b50f3ed 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2690,7 +2690,7 @@ either a full name or nil, and EMAIL is a valid email address."
2690 (define-key map "d" 'package-menu-mark-delete) 2690 (define-key map "d" 'package-menu-mark-delete)
2691 (define-key map "i" 'package-menu-mark-install) 2691 (define-key map "i" 'package-menu-mark-install)
2692 (define-key map "U" 'package-menu-mark-upgrades) 2692 (define-key map "U" 'package-menu-mark-upgrades)
2693 (define-key map "r" 'package-menu-refresh) 2693 (define-key map "r" 'revert-buffer)
2694 (define-key map (kbd "/ k") 'package-menu-filter-by-keyword) 2694 (define-key map (kbd "/ k") 'package-menu-filter-by-keyword)
2695 (define-key map (kbd "/ n") 'package-menu-filter-by-name) 2695 (define-key map (kbd "/ n") 'package-menu-filter-by-name)
2696 (define-key map (kbd "/ /") 'package-menu-clear-filter) 2696 (define-key map (kbd "/ /") 'package-menu-clear-filter)
@@ -2709,7 +2709,7 @@ either a full name or nil, and EMAIL is a valid email address."
2709 ["Describe Package" package-menu-describe-package :help "Display information about this package"] 2709 ["Describe Package" package-menu-describe-package :help "Display information about this package"]
2710 ["Help" package-menu-quick-help :help "Show short key binding help for package-menu-mode"] 2710 ["Help" package-menu-quick-help :help "Show short key binding help for package-menu-mode"]
2711 "--" 2711 "--"
2712 ["Refresh Package List" package-menu-refresh 2712 ["Refresh Package List" revert-buffer
2713 :help "Redownload the ELPA archive" 2713 :help "Redownload the ELPA archive"
2714 :active (not package--downloads-in-progress)] 2714 :active (not package--downloads-in-progress)]
2715 ["Redisplay buffer" revert-buffer :help "Update the buffer with current list of packages"] 2715 ["Redisplay buffer" revert-buffer :help "Update the buffer with current list of packages"]
@@ -2764,6 +2764,7 @@ Letters do not insert themselves; instead, they are commands.
2764 (setq tabulated-list-sort-key (cons "Status" nil)) 2764 (setq tabulated-list-sort-key (cons "Status" nil))
2765 (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t) 2765 (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t)
2766 (tabulated-list-init-header) 2766 (tabulated-list-init-header)
2767 (setq revert-buffer-function 'package-menu--refresh)
2767 (setf imenu-prev-index-position-function 2768 (setf imenu-prev-index-position-function
2768 #'package--imenu-prev-index-position-function) 2769 #'package--imenu-prev-index-position-function)
2769 (setf imenu-extract-index-name-function 2770 (setf imenu-extract-index-name-function
@@ -3162,12 +3163,15 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])."
3162(defvar package-menu--old-archive-contents nil 3163(defvar package-menu--old-archive-contents nil
3163 "`package-archive-contents' before the latest refresh.") 3164 "`package-archive-contents' before the latest refresh.")
3164 3165
3165(defun package-menu-refresh () 3166(defun package-menu--refresh (&optional _arg _noconfirm)
3166 "In Package Menu, download the Emacs Lisp package archive. 3167 "In Package Menu, download the Emacs Lisp package archive.
3167Fetch the contents of each archive specified in 3168Fetch the contents of each archive specified in
3168`package-archives', and then refresh the package menu. Signal a 3169`package-archives', and then refresh the package menu. Signal a
3169user-error if there is already a refresh running asynchronously." 3170user-error if there is already a refresh running asynchronously.
3170 (interactive) 3171
3172`package-menu-mode' sets `revert-buffer-function' to this
3173function. The args ARG and NOCONFIRM, passed from
3174`revert-buffer', are ignored."
3171 (unless (derived-mode-p 'package-menu-mode) 3175 (unless (derived-mode-p 'package-menu-mode)
3172 (user-error "The current buffer is not a Package Menu")) 3176 (user-error "The current buffer is not a Package Menu"))
3173 (when (and package-menu-async package--downloads-in-progress) 3177 (when (and package-menu-async package--downloads-in-progress)
@@ -3175,6 +3179,7 @@ user-error if there is already a refresh running asynchronously."
3175 (setq package-menu--old-archive-contents package-archive-contents) 3179 (setq package-menu--old-archive-contents package-archive-contents)
3176 (setq package-menu--new-package-list nil) 3180 (setq package-menu--new-package-list nil)
3177 (package-refresh-contents package-menu-async)) 3181 (package-refresh-contents package-menu-async))
3182(define-obsolete-function-alias 'package-menu-refresh 'revert-buffer "27.1")
3178 3183
3179(defun package-menu-hide-package () 3184(defun package-menu-hide-package ()
3180 "Hide a package under point in Package Menu. 3185 "Hide a package under point in Package Menu.
@@ -3638,7 +3643,7 @@ short description."
3638 (package-menu-mode) 3643 (package-menu-mode)
3639 3644
3640 ;; Fetch the remote list of packages. 3645 ;; Fetch the remote list of packages.
3641 (unless no-fetch (package-menu-refresh)) 3646 (unless no-fetch (package-menu--refresh))
3642 3647
3643 ;; If we're not async, this would be redundant. 3648 ;; If we're not async, this would be redundant.
3644 (when package-menu-async 3649 (when package-menu-async