all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: 36707@debbugs.gnu.org
Subject: bug#36707: [PATCH] Signal user-error on duplicate package refresh
Date: Wed, 17 Jul 2019 20:10:12 +0200	[thread overview]
Message-ID: <CADwFkmmKsbz9COtp8AWAsCUDQsM2RkLTWmpbM6S2bwqPqWsHRg@mail.gmail.com> (raw)
In-Reply-To: <CADwFkm=O-=zUm5FkbmapQ54_1KyuyiNJd_-2EPocBvU0BqMeQw@mail.gmail.com>

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


  reply	other threads:[~2019-07-17 18:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17 18:02 bug#36707: [PATCH] Signal user-error on duplicate package refresh Stefan Kangas
2019-07-17 18:10 ` Stefan Kangas [this message]
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

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=CADwFkmmKsbz9COtp8AWAsCUDQsM2RkLTWmpbM6S2bwqPqWsHRg@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=36707@debbugs.gnu.org \
    /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.