summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2019-11-06 00:58:57 +0100
committerStefan Kangas <stefankangas@gmail.com>2019-11-06 00:58:57 +0100
commit0c293f1520dd73203c03d7934ac21b2bae6eaf37 (patch)
treea17bcb047fd4091c7f4bde04f075d2a213fc1109
parentc91c145d61cb53cb9f88686cbde4aaf6d9c42794 (diff)
downloademacs-0c293f1520dd73203c03d7934ac21b2bae6eaf37.tar.gz
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
dependencies; also, delete all packages marked with @kbd{d}
(@code{package-menu-execute}). This also removes the marks.
+@item g
@item r
+@kindex g @r{(Package Menu)}
@kindex r @r{(Package Menu)}
-@findex package-menu-refresh
-Refresh the package list (@code{package-menu-refresh}). This fetches
-the list of available packages from the package archive again, and
-recomputes the package list.
+Refresh the package list (@code{revert-buffer}). This fetches the
+list of available packages from the package archive again, and
+redisplays the package list.
@item / k
@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.
---
*** The package list can now be sorted by version or description.
++++
+*** In Package Menu, 'g' now updates package data from archives.
+Previously, 'g' invoked 'tabulated-list-revert' which did not update
+the cached archive data. It is now bound to 'revert-buffer', which
+will now update the data.
+
+'package-menu-refresh' is an obsolete alias for 'revert-buffer'.
+
** Info
+++
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."
(define-key map "d" 'package-menu-mark-delete)
(define-key map "i" 'package-menu-mark-install)
(define-key map "U" 'package-menu-mark-upgrades)
- (define-key map "r" 'package-menu-refresh)
+ (define-key map "r" 'revert-buffer)
(define-key map (kbd "/ k") 'package-menu-filter-by-keyword)
(define-key map (kbd "/ n") 'package-menu-filter-by-name)
(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."
["Describe Package" package-menu-describe-package :help "Display information about this package"]
["Help" package-menu-quick-help :help "Show short key binding help for package-menu-mode"]
"--"
- ["Refresh Package List" package-menu-refresh
+ ["Refresh Package List" revert-buffer
:help "Redownload the ELPA archive"
:active (not package--downloads-in-progress)]
["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.
(setq tabulated-list-sort-key (cons "Status" nil))
(add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t)
(tabulated-list-init-header)
+ (setq revert-buffer-function 'package-menu--refresh)
(setf imenu-prev-index-position-function
#'package--imenu-prev-index-position-function)
(setf imenu-extract-index-name-function
@@ -3162,12 +3163,15 @@ Return (PKG-DESC [NAME VERSION STATUS DOC])."
(defvar package-menu--old-archive-contents nil
"`package-archive-contents' before the latest refresh.")
-(defun package-menu-refresh ()
+(defun package-menu--refresh (&optional _arg _noconfirm)
"In Package Menu, download the Emacs Lisp package archive.
Fetch the contents of each archive specified in
`package-archives', and then refresh the package menu. Signal a
-user-error if there is already a refresh running asynchronously."
- (interactive)
+user-error if there is already a refresh running asynchronously.
+
+`package-menu-mode' sets `revert-buffer-function' to this
+function. The args ARG and NOCONFIRM, passed from
+`revert-buffer', are ignored."
(unless (derived-mode-p 'package-menu-mode)
(user-error "The current buffer is not a Package Menu"))
(when (and package-menu-async package--downloads-in-progress)
@@ -3175,6 +3179,7 @@ user-error if there is already a refresh running asynchronously."
(setq package-menu--old-archive-contents package-archive-contents)
(setq package-menu--new-package-list nil)
(package-refresh-contents package-menu-async))
+(define-obsolete-function-alias 'package-menu-refresh 'revert-buffer "27.1")
(defun package-menu-hide-package ()
"Hide a package under point in Package Menu.
@@ -3638,7 +3643,7 @@ short description."
(package-menu-mode)
;; Fetch the remote list of packages.
- (unless no-fetch (package-menu-refresh))
+ (unless no-fetch (package-menu--refresh))
;; If we're not async, this would be redundant.
(when package-menu-async