From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.bugs Subject: bug#21625: [PATCH] lisp/emacs-lisp/package.el (package-install): Fix error. Date: Tue, 6 Oct 2015 11:39:41 +0100 Message-ID: References: <1444074958-32600-1-git-send-email-aaronecay@gmail.com> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1444128027 28102 80.91.229.3 (6 Oct 2015 10:40:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 6 Oct 2015 10:40:27 +0000 (UTC) Cc: 21625@debbugs.gnu.org To: Aaron Ecay Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 06 12:40:19 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZjPfN-00085Q-Gr for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Oct 2015 12:40:17 +0200 Original-Received: from localhost ([::1]:50100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjPfM-0000IA-Ri for geb-bug-gnu-emacs@m.gmane.org; Tue, 06 Oct 2015 06:40:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjPfI-0000Hc-E3 for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2015 06:40:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjPf8-0004ET-Uv for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2015 06:40:12 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:38803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjPf8-0004DN-O9 for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2015 06:40:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZjPf8-0007eR-7c for bug-gnu-emacs@gnu.org; Tue, 06 Oct 2015 06:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Oct 2015 10:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21625 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 21625-submit@debbugs.gnu.org id=B21625.144412798629386 (code B ref 21625); Tue, 06 Oct 2015 10:40:01 +0000 Original-Received: (at 21625) by debbugs.gnu.org; 6 Oct 2015 10:39:46 +0000 Original-Received: from localhost ([127.0.0.1]:56007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZjPer-0007dt-6a for submit@debbugs.gnu.org; Tue, 06 Oct 2015 06:39:45 -0400 Original-Received: from mail-la0-f42.google.com ([209.85.215.42]:33650) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZjPeo-0007dl-RC for 21625@debbugs.gnu.org; Tue, 06 Oct 2015 06:39:43 -0400 Original-Received: by lafb9 with SMTP id b9so52977956laf.0 for <21625@debbugs.gnu.org>; Tue, 06 Oct 2015 03:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=/mD4/6ucY8FX1ECcyFIdeD8KFPyfhxikmcHt55wtoqU=; b=AquJgGMZlScLIxioY99497MGTbitry+8Om0FuORlX7BRvDkJY5aAwl4LutygQfMqfs fvg/muRdlHp8PFF2aHIVMZGGLXMvTA9k/5l5blBIrZX/T0npEuuuQNxlo2L+5aRT0y7J utS1Cr3GCr3oE+5TJ2kK24KU/pztSFlAOs4t6w9FvWl5xa98fxfmvveXuHvR3oYRKFic f7RNflRDeMHYidx3+FX2dj4RdAB9yMmuGv931QVm5frmtoS1xz+sot6tZufd5fQX9CC5 nY1v7VUZMAB6RXx9S0W6mcx4z0Lsi9owhv9emqu3gQQxq5bj7m+SbxNnFKnenv+Jxtg9 5krA== X-Received: by 10.112.146.104 with SMTP id tb8mr14494877lbb.35.1444127981912; Tue, 06 Oct 2015 03:39:41 -0700 (PDT) Original-Received: by 10.25.27.78 with HTTP; Tue, 6 Oct 2015 03:39:41 -0700 (PDT) In-Reply-To: <1444074958-32600-1-git-send-email-aaronecay@gmail.com> X-Google-Sender-Auth: MWbF66j1TKc3Epb1YWWxvOH2NGk X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:107364 Archived-At: 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 : > * lisp/emacs-lisp/package.el (package-install): Fix error when =E2=80=98p= kg=E2=80=99 is > not a =E2=80=98package-desc=E2=80=99. Also clarify documentation. > > Through trial and error, I discovered that for non-interactive use the > =E2=80=98pkg=E2=80=99 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 =E2=80=98intern=E2=80=99. However, even w= hen 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 commen= ts." > ;;;###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 packa= ges > +PKG can be a package-desc or a symbol naming one of the available packag= es > 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 > > > >