GNU bug report logs - #21625
[PATCH] lisp/emacs-lisp/package.el (package-install): Fix error.

Previous Next

Package: emacs;

Reported by: Aaron Ecay <aaronecay <at> gmail.com>

Date: Mon, 5 Oct 2015 19:57:02 UTC

Severity: normal

Tags: patch

Done: Artur Malabarba <bruce.connor.am <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21625 in the body.
You can then email your comments to 21625 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21625; Package emacs. (Mon, 05 Oct 2015 19:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Aaron Ecay <aaronecay <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 05 Oct 2015 19:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Aaron Ecay <aaronecay <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] lisp/emacs-lisp/package.el (package-install): Fix error.
Date: Mon,  5 Oct 2015 20:55:58 +0100
* lisp/emacs-lisp/package.el (package-install): Fix error when ‘pkg’ is
  not a ‘package-desc’.  Also clarify documentation.

Through trial and error, I discovered that for non-interactive use the
‘pkg’ argument of the package-install function should be a symbol, not a
string.  This can also be discerned by inspecting the (interactive)
spec, specifically the call to ‘intern’.  However, even when proceeding
with a symbol an error is raised if the package is already installed.
This patch reuses the name computed earlier in the function to avoid
this.
---
 lisp/emacs-lisp/package.el | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index eb66e8f..89f2a1a 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1887,7 +1887,7 @@ add a call to it along with some explanatory comments."
 ;;;###autoload
 (defun package-install (pkg &optional dont-select)
   "Install the package PKG.
-PKG can be a package-desc or the package name of one the available packages
+PKG can be a package-desc or a symbol naming one of the available packages
 in an archive in `package-archives'.  Interactively, prompt for its name.
 
 If called interactively or if DONT-SELECT nil, add PKG to
@@ -1918,15 +1918,15 @@ to install it but still mark it as selected."
                 pkg)))
     (unless (or dont-select (package--user-selected-p name))
       (package--save-selected-packages
-       (cons name package-selected-packages))))
-  (if-let ((transaction
-            (if (package-desc-p pkg)
-                (unless (package-installed-p pkg)
-                  (package-compute-transaction (list pkg)
-                                               (package-desc-reqs pkg)))
-              (package-compute-transaction () (list (list pkg))))))
-      (package-download-transaction transaction)
-    (message "`%s' is already installed" (package-desc-full-name pkg))))
+       (cons name package-selected-packages)))
+    (if-let ((transaction
+              (if (package-desc-p pkg)
+                  (unless (package-installed-p pkg)
+                    (package-compute-transaction (list pkg)
+                                                 (package-desc-reqs pkg)))
+                (package-compute-transaction () (list (list pkg))))))
+        (package-download-transaction transaction)
+      (message "`%s' is already installed" name))))
 
 (defun package-strip-rcs-id (str)
   "Strip RCS version ID from the version string STR.
-- 
2.6.0





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21625; Package emacs. (Tue, 06 Oct 2015 10:40:01 GMT) Full text and rfc822 format available.

Message #8 received at 21625 <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Aaron Ecay <aaronecay <at> gmail.com>
Cc: 21625 <at> debbugs.gnu.org
Subject: Re: bug#21625: [PATCH] lisp/emacs-lisp/package.el (package-install):
 Fix error.
Date: Tue, 6 Oct 2015 11:39:41 +0100
Looks good to me.
Thanks for the patch Aaron. Have you done the copyright paperwork?

2015-10-05 20:55 GMT+01:00 Aaron Ecay <aaronecay <at> gmail.com>:
> * lisp/emacs-lisp/package.el (package-install): Fix error when ‘pkg’ is
>   not a ‘package-desc’.  Also clarify documentation.
>
> Through trial and error, I discovered that for non-interactive use the
> ‘pkg’ argument of the package-install function should be a symbol, not a
> string.  This can also be discerned by inspecting the (interactive)
> spec, specifically the call to ‘intern’.  However, even when proceeding
> with a symbol an error is raised if the package is already installed.
> This patch reuses the name computed earlier in the function to avoid
> this.
> ---
>  lisp/emacs-lisp/package.el | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index eb66e8f..89f2a1a 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -1887,7 +1887,7 @@ add a call to it along with some explanatory comments."
>  ;;;###autoload
>  (defun package-install (pkg &optional dont-select)
>    "Install the package PKG.
> -PKG can be a package-desc or the package name of one the available packages
> +PKG can be a package-desc or a symbol naming one of the available packages
>  in an archive in `package-archives'.  Interactively, prompt for its name.
>
>  If called interactively or if DONT-SELECT nil, add PKG to
> @@ -1918,15 +1918,15 @@ to install it but still mark it as selected."
>                  pkg)))
>      (unless (or dont-select (package--user-selected-p name))
>        (package--save-selected-packages
> -       (cons name package-selected-packages))))
> -  (if-let ((transaction
> -            (if (package-desc-p pkg)
> -                (unless (package-installed-p pkg)
> -                  (package-compute-transaction (list pkg)
> -                                               (package-desc-reqs pkg)))
> -              (package-compute-transaction () (list (list pkg))))))
> -      (package-download-transaction transaction)
> -    (message "`%s' is already installed" (package-desc-full-name pkg))))
> +       (cons name package-selected-packages)))
> +    (if-let ((transaction
> +              (if (package-desc-p pkg)
> +                  (unless (package-installed-p pkg)
> +                    (package-compute-transaction (list pkg)
> +                                                 (package-desc-reqs pkg)))
> +                (package-compute-transaction () (list (list pkg))))))
> +        (package-download-transaction transaction)
> +      (message "`%s' is already installed" name))))
>
>  (defun package-strip-rcs-id (str)
>    "Strip RCS version ID from the version string STR.
> --
> 2.6.0
>
>
>
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21625; Package emacs. (Tue, 06 Oct 2015 12:02:01 GMT) Full text and rfc822 format available.

Message #11 received at 21625 <at> debbugs.gnu.org (full text, mbox):

From: Aaron Ecay <aaronecay <at> gmail.com>
To: bruce.connor.am <at> gmail.com
Cc: 21625 <at> debbugs.gnu.org
Subject: Re: bug#21625: [PATCH] lisp/emacs-lisp/package.el (package-install):
 Fix error.
Date: Tue, 06 Oct 2015 13:01:44 +0100
Hi Artur,

Thanks for taking a look at the patch.  My copyright papers are done and
on file.

-- 
Aaron Ecay




Reply sent to bruce.connor.am <at> gmail.com:
You have taken responsibility. (Tue, 06 Oct 2015 18:44:02 GMT) Full text and rfc822 format available.

Notification sent to Aaron Ecay <aaronecay <at> gmail.com>:
bug acknowledged by developer. (Tue, 06 Oct 2015 18:44:02 GMT) Full text and rfc822 format available.

Message #16 received at 21625-done <at> debbugs.gnu.org (full text, mbox):

From: Artur Malabarba <bruce.connor.am <at> gmail.com>
To: Aaron Ecay <aaronecay <at> gmail.com>
Cc: 21625-done <at> debbugs.gnu.org
Subject: Re: bug#21625: [PATCH] lisp/emacs-lisp/package.el (package-install):
 Fix error.
Date: Tue, 6 Oct 2015 19:43:01 +0100
Patch applied. Thanks again Aaron

2015-10-06 13:01 GMT+01:00 Aaron Ecay <aaronecay <at> gmail.com>:
> Hi Artur,
>
> Thanks for taking a look at the patch.  My copyright papers are done and
> on file.
>
> --
> Aaron Ecay




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21625; Package emacs. (Mon, 12 Oct 2015 10:54:01 GMT) Full text and rfc822 format available.

Message #19 received at 21625 <at> debbugs.gnu.org (full text, mbox):

From: immerrr again <immerrr <at> gmail.com>
To: 21625 <at> debbugs.gnu.org
Subject: Re: bug#21625: [PATCH] lisp/emacs-lisp/package.el (package-install):
 Fix error.
Date: Mon, 12 Oct 2015 13:53:57 +0300
This patch should fix 20863, too.

On Tue, Oct 6, 2015 at 9:43 PM, Artur Malabarba
<bruce.connor.am <at> gmail.com> wrote:
> Patch applied. Thanks again Aaron
>




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 09 Nov 2015 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 225 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.