unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
@ 2019-04-30 14:52 Rudi Schlatte
  2019-04-30 15:47 ` Basil L. Contovounesios
  2019-09-14 19:21 ` Stefan Kangas
  0 siblings, 2 replies; 13+ messages in thread
From: Rudi Schlatte @ 2019-04-30 14:52 UTC (permalink / raw)
  To: 35504


The ‘g’ key seems to be the standard way to refresh a list of things.
For example, ‘g’ runs ‘gnus-group-get-new-news’ in the gnus *Group*
buffer and ‘revert-buffer’ in vc-dir-mode.  In the package list,
‘package-menu-refresh’ is run by the ‘r’ key instead.

Since ‘g’ is unbound in ‘package-menu-mode’, could a binding be added to
run ‘package-menu-refresh’ for that key?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  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-09-14 19:21 ` Stefan Kangas
  1 sibling, 1 reply; 13+ messages in thread
From: Basil L. Contovounesios @ 2019-04-30 15:47 UTC (permalink / raw)
  To: Rudi Schlatte; +Cc: 35504, Stefan Monnier

severity 35504 wishlist
quit

Rudi Schlatte <rudi@constantly.at> writes:

> The ‘g’ key seems to be the standard way to refresh a list of things.
> For example, ‘g’ runs ‘gnus-group-get-new-news’ in the gnus *Group*
> buffer and ‘revert-buffer’ in vc-dir-mode.  In the package list,
> ‘package-menu-refresh’ is run by the ‘r’ key instead.
>
> Since ‘g’ is unbound in ‘package-menu-mode’, could a binding be added to
> run ‘package-menu-refresh’ for that key?

It is not unbound; it is bound to the standard command revert-buffer,
which in this case calls tabulated-list-revert, which in turn runs
tabulated-list-revert-hook, which in turn calls package-menu--refresh.

[The command revert-buffer is bound to 'g' by default in modes derived
 from special-mode; see (info "(elisp) Basic Major Modes").]

Having said that, I know neither what the intention is behind having two
keys bound to different commands, nor why the 'g' key is not documented
under (info "(emacs) Package Menu").  Hopefully someone else can shed
some light upon this.

At least two other people, including Stefan (CCed), share your
preference:

https://lists.gnu.org/archive/html/emacs-devel/2010-10/msg01092.html
https://lists.gnu.org/archive/html/emacs-devel/2010-10/msg01097.html

FWIW, as someone who doesn't understand the purpose of the
package-menu--refresh binding, I am also in favour of merging
the 'r' and 'g' bindings.

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-04-30 15:47 ` Basil L. Contovounesios
@ 2019-04-30 16:00   ` Rudi Schlatte
  2019-04-30 16:59     ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Rudi Schlatte @ 2019-04-30 16:00 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 35504, Stefan Monnier



> On 30 Apr 2019, at 17:47, Basil L. Contovounesios <contovob@tcd.ie> wrote:
> 
> Rudi Schlatte <rudi@constantly.at> writes:
> 
>> The ‘g’ key seems to be the standard way to refresh a list of things.
>> For example, ‘g’ runs ‘gnus-group-get-new-news’ in the gnus *Group*
>> buffer and ‘revert-buffer’ in vc-dir-mode.  In the package list,
>> ‘package-menu-refresh’ is run by the ‘r’ key instead.
>> 
>> Since ‘g’ is unbound in ‘package-menu-mode’, could a binding be added to
>> run ‘package-menu-refresh’ for that key?
> 
> It is not unbound; it is bound to the standard command revert-buffer,
> which in this case calls tabulated-list-revert, which in turn runs
> tabulated-list-revert-hook, which in turn calls package-menu--refresh.

Thanks for having a look!  I could swear I checked whether `g' was bound or not, but apparently I didn't.  Anyway, allow me to rephrase my bug report from a more end-user-y perspective.

Pressing `g' in a gnus group buffer connects to the network, fetches new data from various servers, and updates the buffer accordingly.  The key `r' achieves the same effect in a package list buffer: I can see Emacs contacting the servers set up in `package-archives', get a message how many packages can be updated, etc.  The `g' key, on the other hand, does not do that in a package list buffer.

I find my fingers still wanting to press `g' to achieve the effect of `r' after some months of retraining, hence the bug report.

FWIW, I completely agree with the "Wishlist" severity you set for the bug.

Thanks again,

Rudi




^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-04-30 16:00   ` Rudi Schlatte
@ 2019-04-30 16:59     ` Stefan Monnier
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2019-04-30 16:59 UTC (permalink / raw)
  To: Rudi Schlatte; +Cc: Basil L. Contovounesios, 35504

> I find my fingers still wanting to press `g' to achieve the effect of `r'
> after some months of retraining, hence the bug report.

Agreed (IOW my opinion hasn't changed since
https://lists.gnu.org/archive/html/emacs-devel/2010-10/msg01097.html).


        Stefan





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  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-09-14 19:21 ` Stefan Kangas
  2019-09-16 18:12   ` Stefan Monnier
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Kangas @ 2019-09-14 19:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, 35504, Rudi Schlatte

[-- Attachment #1: Type: text/plain, Size: 382 bytes --]

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> I find my fingers still wanting to press `g' to achieve the effect of `r'
>> after some months of retraining, hence the bug report.
>
> Agreed (IOW my opinion hasn't changed since
> https://lists.gnu.org/archive/html/emacs-devel/2010-10/msg01097.html).

I also agree.  How about the attached patch?

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Bind-g-to-package-menu-refresh-in-package-menu.patch --]
[-- Type: application/octet-stream, Size: 4355 bytes --]

From 79bc7d39f2d6df8a5d252e02e785e9af57d4ae5d Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Fri, 26 Jul 2019 12:49:35 +0200
Subject: [PATCH] Bind 'g' to 'package-menu-refresh' in package menu

* lisp/emacs-lisp/package.el (package-menu-mode-map): Bind 'g' to
'package-menu-refresh' instead of 'revert-buffer'.  (Bug#35504)
* doc/emacs/package.texi (Package Menu): Document it.
* etc/NEWS: Announce it.
---
 doc/emacs/package.texi     | 12 ++++++++++++
 etc/NEWS                   |  5 +++++
 lisp/emacs-lisp/package.el |  1 +
 3 files changed, 18 insertions(+)

diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 4b33f250c4..35fa1f86d2 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -85,16 +85,19 @@ Package Menu
 
 @table @kbd
 @item h
+@findex package-menu-quick-help
 Print a short message summarizing how to use the package menu
 (@code{package-menu-quick-help}).
 
 @item ?
 @itemx @key{RET}
+@findex package-menu-describe-package
 Display a help buffer for the package on the current line
 (@code{package-menu-describe-package}), similar to the help window
 displayed by the @kbd{C-h P} command (@pxref{Packages}).
 
 @item i
+@findex package-menu-mark-install
 Mark the package on the current line for installation
 (@code{package-menu-mark-install}).  If the package status is
 @samp{available}, this adds an @samp{I} character to the start of the
@@ -102,6 +105,7 @@ Package Menu
 package.
 
 @item d
+@findex package-menu-mark-delete
 Mark the package on the current line for deletion
 (@code{package-menu-mark-delete}).  If the package status is
 @samp{installed}, this adds a @samp{D} character to the start of the
@@ -110,6 +114,7 @@ Package Menu
 entails.
 
 @item ~
+@findex package-menu-mark-obsolete-for-deletion
 Mark all obsolete packages for deletion
 (@code{package-menu-mark-obsolete-for-deletion}).  This marks for
 deletion all the packages whose status is @samp{obsolete}.
@@ -120,6 +125,7 @@ Package Menu
 current line by an @kbd{i} or @kbd{d} command.
 
 @item U
+@findex package-menu-mark-upgrades
 Mark all package with a newer available version for upgrading
 (@code{package-menu-mark-upgrades}).  This places an installation mark
 on the new available versions, and a deletion mark on the old
@@ -127,26 +133,32 @@ Package Menu
 
 @item x
 @vindex package-menu-async
+@findex package-menu-execute
 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
+@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.
 
 @item f
+@findex package-menu-filter
 Filter the package list (@code{package-menu-filter}).  This prompts
 for a keyword (e.g., @samp{games}), then shows only the packages
 that relate to that keyword.  To restore the full package list,
 type @kbd{q}.
 
 @item H
+@findex package-menu-hide-package
 Permanently hide packages that match a regexp
 (@code{package-menu-hide-package}).
 
 @item (
+@findex package-menu-toggle-hiding
 Toggle visibility of old versions of packages and also of versions
 from lower-priority archives (@code{package-menu-toggle-hiding}).
 @end table
diff --git a/etc/NEWS b/etc/NEWS
index 252c6bf9b9..29b9c6c354 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -971,6 +971,11 @@ early init file.
 ---
 *** Imenu support has been added to 'package-menu-mode'.
 
++++
+*** 'g' is now bound to 'package-menu-refresh'.
+'g' used to be bound to 'revert-buffer', which now requires you to
+type 'M-x revert-buffer' instead.
+
 ** Info
 
 +++
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ef0c5171de..a79759c976 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2619,6 +2619,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 "g" 'package-menu-refresh)
     (define-key map "r" 'package-menu-refresh)
     (define-key map "f" 'package-menu-filter)
     (define-key map "~" 'package-menu-mark-obsolete-for-deletion)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-09-14 19:21 ` Stefan Kangas
@ 2019-09-16 18:12   ` Stefan Monnier
  2019-10-02 23:59     ` Stefan Kangas
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2019-09-16 18:12 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Basil L. Contovounesios, 35504, Rudi Schlatte

> I also agree.  How about the attached patch?

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`?


        Stefan






^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-09-16 18:12   ` Stefan Monnier
@ 2019-10-02 23:59     ` Stefan Kangas
  2019-10-03  1:47       ` Stefan Monnier
  2019-10-03  1:53       ` Basil L. Contovounesios
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Kangas @ 2019-10-02 23:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, 35504, Rudi Schlatte

[-- Attachment #1: Type: text/plain, Size: 340 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > I also agree.  How about the attached patch?
>
> 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?

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Make-g-refresh-package-data-in-package-menu.patch --]
[-- Type: text/x-patch, Size: 6386 bytes --]

From e5bd2232220a25c8c977ab2009ad0f96fca29cac 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-revert): Rename from
'package-menu-refresh'.
(package-menu-refresh): Define obsolete fuction alias for the above.
(package-menu-mode): Set 'package-menu-refresh' to use the new name.
(package-menu-mode-map): Update binding to use the new
name.  (Bug#35504)

* doc/emacs/package.texi (Package Menu): Document it.
* etc/NEWS: Announce it.
---
 doc/emacs/package.texi     | 14 +++++++++++++-
 etc/NEWS                   |  8 ++++++++
 lisp/emacs-lisp/package.el | 12 +++++++++---
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 2c09ca8902..8a2dca9193 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -85,16 +85,19 @@ Package Menu
 
 @table @kbd
 @item h
+@findex package-menu-quick-help
 Print a short message summarizing how to use the package menu
 (@code{package-menu-quick-help}).
 
 @item ?
 @itemx @key{RET}
+@findex package-menu-describe-package
 Display a help buffer for the package on the current line
 (@code{package-menu-describe-package}), similar to the help window
 displayed by the @kbd{C-h P} command (@pxref{Packages}).
 
 @item i
+@findex package-menu-mark-install
 Mark the package on the current line for installation
 (@code{package-menu-mark-install}).  If the package status is
 @samp{available}, this adds an @samp{I} character to the start of the
@@ -102,6 +105,7 @@ Package Menu
 package.
 
 @item d
+@findex package-menu-mark-delete
 Mark the package on the current line for deletion
 (@code{package-menu-mark-delete}).  If the package status is
 @samp{installed}, this adds a @samp{D} character to the start of the
@@ -110,6 +114,7 @@ Package Menu
 entails.
 
 @item ~
+@findex package-menu-mark-obsolete-for-deletion
 Mark all obsolete packages for deletion
 (@code{package-menu-mark-obsolete-for-deletion}).  This marks for
 deletion all the packages whose status is @samp{obsolete}.
@@ -120,6 +125,7 @@ Package Menu
 current line by an @kbd{i} or @kbd{d} command.
 
 @item U
+@findex package-menu-mark-upgrades
 Mark all package with a newer available version for upgrading
 (@code{package-menu-mark-upgrades}).  This places an installation mark
 on the new available versions, and a deletion mark on the old
@@ -127,26 +133,32 @@ Package Menu
 
 @item x
 @vindex package-menu-async
+@findex package-menu-execute
 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
-Refresh the package list (@code{package-menu-refresh}).  This fetches
+@findex package-menu-revert
+Refresh the package list (@code{package-menu-revert}).  This fetches
 the list of available packages from the package archive again, and
 recomputes the package list.
 
 @item f
+@findex package-menu-filter
 Filter the package list (@code{package-menu-filter}).  This prompts
 for a keyword (e.g., @samp{games}), then shows only the packages
 that relate to that keyword.  To restore the full package list,
 type @kbd{q}.
 
 @item H
+@findex package-menu-hide-package
 Permanently hide packages that match a regexp
 (@code{package-menu-hide-package}).
 
 @item (
+@findex package-menu-toggle-hiding
 Toggle visibility of old versions of packages and also of versions
 from lower-priority archives (@code{package-menu-toggle-hiding}).
 @end table
diff --git a/etc/NEWS b/etc/NEWS
index cb8b6fcac1..2dc22ba89f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -989,6 +989,14 @@ early init file.
 ---
 *** The package list can now be sorted by version or description.
 
++++
+*** 'package-menu-refresh' is an obsolete alias for 'package-menu-revert'.
+
++++
+*** 'g' will now update packages from archives in Package Menu.
+Previously, 'g' invoked 'tabulated-list-revert' which did not refresh
+the cached archive data.
+
 ** Info
 
 +++
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index ab1fb8b90f..d72e983c39 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2666,7 +2666,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" 'package-menu-revert)
     (define-key map "f" 'package-menu-filter)
     (define-key map "~" 'package-menu-mark-obsolete-for-deletion)
     (define-key map "x" 'package-menu-execute)
@@ -2734,6 +2734,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-revert)
   (setf imenu-prev-index-position-function
         #'package--imenu-prev-index-position-function)
   (setf imenu-extract-index-name-function
@@ -3132,11 +3133,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-revert (&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."
+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."
   (interactive)
   (unless (derived-mode-p 'package-menu-mode)
     (user-error "The current buffer is not a Package Menu"))
@@ -3145,6 +3150,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 'package-menu-revert "27.1")
 
 (defun package-menu-hide-package ()
   "Hide a package under point in Package Menu.
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-10-02 23:59     ` Stefan Kangas
@ 2019-10-03  1:47       ` Stefan Monnier
  2019-10-04 15:09         ` Stefan Kangas
  2019-10-03  1:53       ` Basil L. Contovounesios
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2019-10-03  1:47 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Basil L. Contovounesios, 35504, Rudi Schlatte

>> 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)?


        Stefan






^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-10-02 23:59     ` Stefan Kangas
  2019-10-03  1:47       ` Stefan Monnier
@ 2019-10-03  1:53       ` Basil L. Contovounesios
  2019-10-04 14:36         ` Stefan Kangas
  1 sibling, 1 reply; 13+ messages in thread
From: Basil L. Contovounesios @ 2019-10-03  1:53 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 35504, Stefan Monnier, Rudi Schlatte

Stefan Kangas <stefan@marxist.se> writes:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> > I also agree.  How about the attached patch?
>>
>> 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?

In addition to Stefan M.'s comments, I just noticed a couple of nits:

> -(defun package-menu-refresh ()
> +(defun package-menu-revert (&optional arg noconfirm)

If the arguments aren't used, they should be prefixed with underscores.

>    "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."
> +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."

revert-buffer-function and revert-buffer are quoted with curly single
quotes instead of the usual grave+apostrophe.

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-10-03  1:53       ` Basil L. Contovounesios
@ 2019-10-04 14:36         ` Stefan Kangas
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Kangas @ 2019-10-04 14:36 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 35504, Stefan Monnier, Rudi Schlatte

Basil L. Contovounesios <contovob@tcd.ie> writes:

> > -(defun package-menu-refresh ()
> > +(defun package-menu-revert (&optional arg noconfirm)
>
> If the arguments aren't used, they should be prefixed with underscores.

Indeed, fixed.

> >    "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."
> > +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."
>
> revert-buffer-function and revert-buffer are quoted with curly single
> quotes instead of the usual grave+apostrophe.

Well spotted, fixed.  Thanks for the review.

Best regards,
Stefan Kangas





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-10-03  1:47       ` Stefan Monnier
@ 2019-10-04 15:09         ` Stefan Kangas
  2019-11-02  2:32           ` Stefan Kangas
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Kangas @ 2019-10-04 15:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, 35504, Rudi Schlatte

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

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.

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Make-g-refresh-package-data-in-package-menu.patch --]
[-- Type: text/x-patch, Size: 7424 bytes --]

From e4e4507685e8df07f0d624eb754fe94cd28f2a45 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     | 17 ++++++++++++++---
 etc/NEWS                   |  9 +++++++++
 lisp/emacs-lisp/package.el | 17 +++++++++++------
 3 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 2c09ca8902..7b6dcc041d 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -85,16 +85,19 @@ Package Menu
 
 @table @kbd
 @item h
+@findex package-menu-quick-help
 Print a short message summarizing how to use the package menu
 (@code{package-menu-quick-help}).
 
 @item ?
 @itemx @key{RET}
+@findex package-menu-describe-package
 Display a help buffer for the package on the current line
 (@code{package-menu-describe-package}), similar to the help window
 displayed by the @kbd{C-h P} command (@pxref{Packages}).
 
 @item i
+@findex package-menu-mark-install
 Mark the package on the current line for installation
 (@code{package-menu-mark-install}).  If the package status is
 @samp{available}, this adds an @samp{I} character to the start of the
@@ -102,6 +105,7 @@ Package Menu
 package.
 
 @item d
+@findex package-menu-mark-delete
 Mark the package on the current line for deletion
 (@code{package-menu-mark-delete}).  If the package status is
 @samp{installed}, this adds a @samp{D} character to the start of the
@@ -110,6 +114,7 @@ Package Menu
 entails.
 
 @item ~
+@findex package-menu-mark-obsolete-for-deletion
 Mark all obsolete packages for deletion
 (@code{package-menu-mark-obsolete-for-deletion}).  This marks for
 deletion all the packages whose status is @samp{obsolete}.
@@ -120,6 +125,7 @@ Package Menu
 current line by an @kbd{i} or @kbd{d} command.
 
 @item U
+@findex package-menu-mark-upgrades
 Mark all package with a newer available version for upgrading
 (@code{package-menu-mark-upgrades}).  This places an installation mark
 on the new available versions, and a deletion mark on the old
@@ -127,26 +133,31 @@ Package Menu
 
 @item x
 @vindex package-menu-async
+@findex package-menu-execute
 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
-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 f
+@findex package-menu-filter
 Filter the package list (@code{package-menu-filter}).  This prompts
 for a keyword (e.g., @samp{games}), then shows only the packages
 that relate to that keyword.  To restore the full package list,
 type @kbd{q}.
 
 @item H
+@findex package-menu-hide-package
 Permanently hide packages that match a regexp
 (@code{package-menu-hide-package}).
 
 @item (
+@findex package-menu-toggle-hiding
 Toggle visibility of old versions of packages and also of versions
 from lower-priority archives (@code{package-menu-toggle-hiding}).
 @end table
diff --git a/etc/NEWS b/etc/NEWS
index c8cc7537b0..9bb77b0863 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1000,6 +1000,15 @@ early init file.
 ---
 *** The package list can now be sorted by version or description.
 
++++
+*** 'package-menu-refresh' is an obsolete alias for 'revert-buffer'.
+
++++
+*** 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.
+
 ** Info
 
 +++
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 188f398a56..3e67ca9ee5 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 "f" 'package-menu-filter)
     (define-key map "~" 'package-menu-mark-obsolete-for-deletion)
     (define-key map "x" 'package-menu-execute)
@@ -2707,7 +2707,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"]
@@ -2758,6 +2758,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
@@ -3158,12 +3159,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)
@@ -3171,6 +3175,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.
@@ -3634,7 +3639,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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-10-04 15:09         ` Stefan Kangas
@ 2019-11-02  2:32           ` Stefan Kangas
  2019-11-06  0:00             ` Stefan Kangas
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Kangas @ 2019-11-02  2:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, 35504, Rudi Schlatte

[-- 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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#35504: 26.2; Key `g' should run `package-menu-refresh' in the *Packages* buffer
  2019-11-02  2:32           ` Stefan Kangas
@ 2019-11-06  0:00             ` Stefan Kangas
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Kangas @ 2019-11-06  0:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Basil L. Contovounesios, 35504, Rudi Schlatte

close 35504 27.1
thanks

Stefan Kangas <stefan@marxist.se> writes:

> I've attached an updated patch below.  If there are no further
> comments, I intend to commit it in a couple of days.

Now pushed to master as commit 0c293f1520.  Closing.

Best regards,
Stefan Kangas






^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-11-06  0:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-11-06  0:00             ` Stefan Kangas
2019-10-03  1:53       ` Basil L. Contovounesios
2019-10-04 14:36         ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).