From: Stefan Kangas <stefan@marxist.se>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>,
35504@debbugs.gnu.org, Rudi Schlatte <rudi@constantly.at>
Subject: bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
Date: Sat, 02 Nov 2019 03:32:31 +0100 [thread overview]
Message-ID: <87lfszrosg.fsf@marxist.se> (raw)
In-Reply-To: <CADwFkm=Po9yRyTdGWFPLugHHHT8vk_jGB0Q6=GyNoqT+pTxH8Q@mail.gmail.com> (Stefan Kangas's message of "Fri, 4 Oct 2019 17:09:09 +0200")
[-- Attachment #1: Type: text/plain, Size: 958 bytes --]
Stefan Kangas <stefan@marxist.se> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>
>> >> Fine by me. I wonder, tho: why not set revert-buffer-function and then
>> >> redefine `package-menu-refresh` as an obsolete alias for `revert-buffer`?
>> > Sure, I've tried to do that in the attached patch. WDYT?
>> [...]
>> > + (setq revert-buffer-function 'package-menu-revert)
>> [...]
>> > +(define-obsolete-function-alias 'package-menu-refresh 'package-menu-revert "27.1")
>>
>> Could we make package-menu-refresh to be an (obsolete) alias of
>> `revert-buffer` instead (and make package-menu-revert an internal
>> non-interactive function)?
>
> Absolutely, thanks for the suggestion. Fixed in the attached patch
> together with the things Basil pointed out.
>
> Please let me know what you think.
I've attached an updated patch below. If there are no further
comments, I intend to commit it in a couple of days.
Best regards,
Stefan Kangas
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Make-g-refresh-package-data-in-package-menu.patch --]
[-- Type: text/x-diff, Size: 5364 bytes --]
From 71bda0bd328a901b2dc17e76f032efd0a10fcfec Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Fri, 26 Jul 2019 12:49:35 +0200
Subject: [PATCH] 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.
---
doc/emacs/package.texi | 9 +++++----
etc/NEWS | 8 ++++++++
lisp/emacs-lisp/package.el | 17 +++++++++++------
3 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 19efff7445..1c0f853427 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -149,12 +149,13 @@ Package Menu
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 e614197125..79410bbec3 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1131,6 +1131,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 8c8e86aead..3363b1bb52 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2690,7 +2690,7 @@ package-menu-mode-map
(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 @@ package-menu-mode-menu
["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 @@ package-menu-mode
(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
@@ -3161,12 +3162,15 @@ package-menu--print-info-simple
(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)
@@ -3174,6 +3178,7 @@ package-menu-refresh
(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.
@@ -3637,7 +3642,7 @@ list-packages
(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
--
2.20.1
next prev parent reply other threads:[~2019-11-02 2:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 14:52 bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer Rudi Schlatte
2019-04-30 15:47 ` Basil L. Contovounesios
2019-04-30 16:00 ` Rudi Schlatte
2019-04-30 16:59 ` Stefan Monnier
2019-09-14 19:21 ` Stefan Kangas
2019-09-16 18:12 ` Stefan Monnier
2019-10-02 23:59 ` Stefan Kangas
2019-10-03 1:47 ` Stefan Monnier
2019-10-04 15:09 ` Stefan Kangas
2019-11-02 2:32 ` Stefan Kangas [this message]
2019-11-06 0:00 ` Stefan Kangas
2019-10-03 1:53 ` Basil L. Contovounesios
2019-10-04 14:36 ` Stefan Kangas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lfszrosg.fsf@marxist.se \
--to=stefan@marxist.se \
--cc=35504@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=monnier@iro.umontreal.ca \
--cc=rudi@constantly.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.