unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36707: [PATCH] Signal user-error on duplicate package refresh
@ 2019-07-17 18:02 Stefan Kangas
  2019-07-17 18:10 ` Stefan Kangas
  2019-07-18 21:14 ` Basil L. Contovounesios
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Kangas @ 2019-07-17 18:02 UTC (permalink / raw)
  To: 36707

In the "*Packages*" buffer (M-x package-list-packages), if I hit "r" many times
it will try to initiate more refreshes even if the first one has not finished
yet.  This is unnecessary and potentially confusing.

This patch makes it check if there is already an refresh in progress and signal
a user-error if there is one.

(I'll send the patch in a separate message once this is assigned a bug
number.)

Thanks,
Stefan Kangas





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

* bug#36707: [PATCH] Signal user-error on duplicate package refresh
  2019-07-17 18:02 bug#36707: [PATCH] Signal user-error on duplicate package refresh Stefan Kangas
@ 2019-07-17 18:10 ` Stefan Kangas
  2019-07-18 21:14 ` Basil L. Contovounesios
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2019-07-17 18:10 UTC (permalink / raw)
  To: 36707

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

Stefan Kangas <stefan@marxist.se> writes:
> (I'll send the patch in a separate message once this is assigned a bug
> number.)

Patch attached.

Thanks,
Stefan Kangas

[-- Attachment #2: 0001-Signal-a-user-error-on-duplicate-package-refresh.patch --]
[-- Type: application/octet-stream, Size: 1641 bytes --]

From a7ba44b7eb78067a84e09800edda75e955e626db Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 17 Jul 2019 19:55:08 +0200
Subject: [PATCH] Signal a user-error on duplicate package refresh

* lisp/emacs-lisp/package.el (package-menu-refresh): Signal a
user-error if there is already a refresh running in the background.
Doc fix.  (Bug#36707)
---
 lisp/emacs-lisp/package.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 9a350aadac..d46207a328 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -3042,12 +3042,15 @@ package-menu--old-archive-contents
   "`package-archive-contents' before the latest refresh.")
 
 (defun package-menu-refresh ()
-  "Download the Emacs Lisp package archive.
-This fetches the contents of each archive specified in
-`package-archives', and then refreshes the package menu."
+  "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)
   (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)
+    (user-error "Package refresh is already in progress, please wait..."))
   (setq package-menu--old-archive-contents package-archive-contents)
   (setq package-menu--new-package-list nil)
   (package-refresh-contents package-menu-async))
-- 
2.22.0


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

* bug#36707: [PATCH] Signal user-error on duplicate package refresh
  2019-07-17 18:02 bug#36707: [PATCH] Signal user-error on duplicate package refresh Stefan Kangas
  2019-07-17 18:10 ` Stefan Kangas
@ 2019-07-18 21:14 ` Basil L. Contovounesios
  2019-08-09  0:16   ` Noam Postavsky
  1 sibling, 1 reply; 7+ messages in thread
From: Basil L. Contovounesios @ 2019-07-18 21:14 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 36707

Stefan Kangas <stefan@marxist.se> writes:

> In the "*Packages*" buffer (M-x package-list-packages), if I hit "r" many times
> it will try to initiate more refreshes even if the first one has not finished
> yet.  This is unnecessary and potentially confusing.
>
> This patch makes it check if there is already an refresh in progress and signal
> a user-error if there is one.

Would it not be possible/better to discard the existing refresh and
start a new one, instead of signalling an error?  This would help
e.g. when a refresh hangs for whatever reason.

Thanks,

-- 
Basil





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

* bug#36707: [PATCH] Signal user-error on duplicate package refresh
  2019-07-18 21:14 ` Basil L. Contovounesios
@ 2019-08-09  0:16   ` Noam Postavsky
  2019-08-12  0:35     ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2019-08-09  0:16 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: 36707, Stefan Kangas

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

> Stefan Kangas <stefan@marxist.se> writes:
>
>> In the "*Packages*" buffer (M-x package-list-packages), if I hit "r" many times
>> it will try to initiate more refreshes even if the first one has not finished
>> yet.  This is unnecessary and potentially confusing.
>>
>> This patch makes it check if there is already an refresh in progress and signal
>> a user-error if there is one.
>
> Would it not be possible/better to discard the existing refresh and
> start a new one, instead of signalling an error?  This would help
> e.g. when a refresh hangs for whatever reason.

Not sure if it's better, supposing the user is hitting "r" repeatedly,
that just interrupts the pending refreshes, preventing any progress.  I
would expect hanging to be cancelled by a timeout anyway.





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

* bug#36707: [PATCH] Signal user-error on duplicate package refresh
  2019-08-09  0:16   ` Noam Postavsky
@ 2019-08-12  0:35     ` Stefan Kangas
  2019-08-18 18:18       ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2019-08-12  0:35 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Basil L. Contovounesios, 36707

Noam Postavsky <npostavs@gmail.com> writes:

> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
> > Stefan Kangas <stefan@marxist.se> writes:
> >
> >> In the "*Packages*" buffer (M-x package-list-packages), if I hit "r" many times
> >> it will try to initiate more refreshes even if the first one has not finished
> >> yet.  This is unnecessary and potentially confusing.
> >>
> >> This patch makes it check if there is already an refresh in progress and signal
> >> a user-error if there is one.
> >
> > Would it not be possible/better to discard the existing refresh and
> > start a new one, instead of signalling an error?  This would help
> > e.g. when a refresh hangs for whatever reason.
>
> Not sure if it's better, supposing the user is hitting "r" repeatedly,
> that just interrupts the pending refreshes, preventing any progress.  I
> would expect hanging to be cancelled by a timeout anyway.

I agree with Noam that a timeout would make more sense.  Not sure if
it already exists or if that's a separate issue.

Thanks,
Stefan Kangas





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

* bug#36707: [PATCH] Signal user-error on duplicate package refresh
  2019-08-12  0:35     ` Stefan Kangas
@ 2019-08-18 18:18       ` Stefan Kangas
  2019-08-22 17:04         ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Kangas @ 2019-08-18 18:18 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Basil L. Contovounesios, 36707

Stefan Kangas <stefan@marxist.se> writes:

> Noam Postavsky <npostavs@gmail.com> writes:
>
> > "Basil L. Contovounesios" <contovob@tcd.ie> writes:
> >
> > > Stefan Kangas <stefan@marxist.se> writes:
> > >
> > >> In the "*Packages*" buffer (M-x package-list-packages), if I hit "r" many times
> > >> it will try to initiate more refreshes even if the first one has not finished
> > >> yet.  This is unnecessary and potentially confusing.
> > >>
> > >> This patch makes it check if there is already an refresh in progress and signal
> > >> a user-error if there is one.
> > >
> > > Would it not be possible/better to discard the existing refresh and
> > > start a new one, instead of signalling an error?  This would help
> > > e.g. when a refresh hangs for whatever reason.
> >
> > Not sure if it's better, supposing the user is hitting "r" repeatedly,
> > that just interrupts the pending refreshes, preventing any progress.  I
> > would expect hanging to be cancelled by a timeout anyway.
>
> I agree with Noam that a timeout would make more sense.  Not sure if
> it already exists or if that's a separate issue.

Are there any other objections to the patch?  Otherwise, I'll go ahead
and push it in a few days.

Thanks,
Stefan Kangas





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

* bug#36707: [PATCH] Signal user-error on duplicate package refresh
  2019-08-18 18:18       ` Stefan Kangas
@ 2019-08-22 17:04         ` Stefan Kangas
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2019-08-22 17:04 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Basil L. Contovounesios, 36707

close 36707 27.1
quit

Stefan Kangas <stefan@marxist.se> writes:

> Are there any other objections to the patch?  Otherwise, I'll go ahead
> and push it in a few days.

I've now pushed this as commit a6d87ea045.  Closing the report.

Thanks,
Stefan Kangas





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

end of thread, other threads:[~2019-08-22 17:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-17 18:02 bug#36707: [PATCH] Signal user-error on duplicate package refresh Stefan Kangas
2019-07-17 18:10 ` Stefan Kangas
2019-07-18 21:14 ` Basil L. Contovounesios
2019-08-09  0:16   ` Noam Postavsky
2019-08-12  0:35     ` Stefan Kangas
2019-08-18 18:18       ` Stefan Kangas
2019-08-22 17:04         ` 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).