GNU bug report logs - #7756
24.0.50; enhancements to package.el

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: emacs18@HIDDEN; dated Wed, 29 Dec 2010 18:38:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 7756 <at> debbugs.gnu.org:


Received: (at 7756) by debbugs.gnu.org; 31 Dec 2010 16:39:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 31 11:39:16 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PYi0Z-0003Q9-2C
	for submit <at> debbugs.gnu.org; Fri, 31 Dec 2010 11:39:15 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.183]
	helo=ironport2-out.pppoe.ca)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <monnier@HIDDEN>) id 1PYi0X-0003Pv-D7
	for 7756 <at> debbugs.gnu.org; Fri, 31 Dec 2010 11:39:14 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AmkFAB+XHU3O+Lc+/2dsb2JhbACWII4cdL5vhUoEhGWOGw
X-IronPort-AV: E=Sophos;i="4.60,255,1291611600"; d="scan'208";a="86841610"
Received: from 206-248-183-62.dsl.teksavvy.com (HELO pastel.home)
	([206.248.183.62])
	by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA;
	31 Dec 2010 11:46:11 -0500
Received: by pastel.home (Postfix, from userid 20848)
	id 86D6758A74; Fri, 31 Dec 2010 11:46:11 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: emacs18@HIDDEN
Subject: Re: bug#7756: 24.0.50; enhancements to package.el
Message-ID: <jwvfwtdhoyc.fsf-monnier+emacs@HIDDEN>
References: <qtmvd2cl8w7.fsf@HIDDEN>
	<jwvei8zi8hy.fsf-monnier+emacs@HIDDEN> <qtmfwtfkw77.fsf@HIDDEN>
Date: Fri, 31 Dec 2010 11:46:11 -0500
In-Reply-To: <qtmfwtfkw77.fsf@HIDDEN> (Richard Kim's message of "Thu, 30
	Dec 2010 09:27:24 -0800")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 7756
Cc: 7756 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.1 (--)

>>> @@ -338,9 +338,14 @@
>>> (pkg-file (expand-file-name
>>> (concat (package-strip-version package) "-pkg")
>>> pkg-dir)))
>>> -    (when (and (file-directory-p pkg-dir)
>>> -	       (file-exists-p (concat pkg-file ".el")))
>>> -      (load pkg-file nil t))))
>>> +    ;; When one is creating a package and testing it out, it is easy
>>> +    ;; to forget to add the -pkg.el file.  When that happens, it would
>>> +    ;; be useful to provide feedback to the user rather than silently
>>> +    ;; failing.  That is what (error ...) below is for.
>>> +    (when (file-directory-p pkg-dir)
>>> +      (if (file-exists-p (concat pkg-file ".el"))
>>> +          (load pkg-file nil t)
>>> +        (error "'%s' file is missing!")))))
>> 
>> I agree with the intention, but I wonder: why do we pass the `noerror'
>> parameter to `load' in the first place?

> Thanks for looking into this.
> I was focused in adding the error message and neglected to re-examine
> the arguments to `load', i.e., I just kept the existing code.  I suppose
> it was used before my proposed change to prevent signalling error if the
> file was not found.  With the proposed change, since we check for the
> existence of the file prior to calling `load', I suppose it is
> appropriate to no longer pass `noerror'.  Good catch.  Also I'm sure you
> have noticed that I forgot to add `pkg-file' argument to (error ...)
> expression above.

Right, so a simpler way to make the change is to not add an explicit
check but instead just remove the `noerror' argument.  So your patch is
apparently changing a consciously made decision to ignore errors.
I tend to agree with the change, but I'd first understand why someone
decided to ignore those error.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7756; Package emacs. Full text available.

Message received at 7756 <at> debbugs.gnu.org:


Received: (at 7756) by debbugs.gnu.org; 30 Dec 2010 17:20:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 30 12:20:35 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PYMB1-0004yT-1u
	for submit <at> debbugs.gnu.org; Thu, 30 Dec 2010 12:20:35 -0500
Received: from mail-iy0-f172.google.com ([209.85.210.172])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <emacs18@HIDDEN>) id 1PYMAy-0004yH-Gx
	for 7756 <at> debbugs.gnu.org; Thu, 30 Dec 2010 12:20:33 -0500
Received: by iyi42 with SMTP id 42so9996226iyi.3
	for <7756 <at> debbugs.gnu.org>; Thu, 30 Dec 2010 09:27:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:from:to:cc:subject:references
	:reply-to:date:in-reply-to:message-id:user-agent:mime-version
	:content-type; bh=gVKKu8RlXVzquyiEFuFMhPk9qeSkxErumZXmfOKvIL4=;
	b=IVVIL4bYn0ERVmlyJlODetGpG0pp1ftOJTUv9cVDg5aQqWQrsCH02CrAtFQjorQoPp
	xdLaIThancgurWyGEiQyu0alxVOvrinTFBJKSZbesA021CORmR5/if+652zalRy5TrHQ
	5SDogSzOJD8AIjviwgxFPS1+gs3FmnnO74rxQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=from:to:cc:subject:references:reply-to:date:in-reply-to:message-id
	:user-agent:mime-version:content-type;
	b=mpp12CapNW0J7uxRjdvXKOnGtnicoit+XfaebFR4FUmYUKqQYjKL3w9yYpU2utPRnW
	QxiOWKQ19FHvkW6KnN+GgfxAtC13zOi3Nj6rWbeoig9Yl07aoRvKcnnB4oqZ7jj7A/CP
	OAJYMEj3+04jeUMsD7px5dNwceTf/VtHGhCVE=
Received: by 10.42.178.73 with SMTP id bl9mr16715752icb.448.1293730048420;
	Thu, 30 Dec 2010 09:27:28 -0800 (PST)
Received: from dad-laptop (pool-96-225-218-44.ptldor.fios.verizon.net
	[96.225.218.44])
	by mx.google.com with ESMTPS id z4sm14481063ibg.1.2010.12.30.09.27.26
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Thu, 30 Dec 2010 09:27:27 -0800 (PST)
From: Richard Kim <emacs18@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#7756: 24.0.50; enhancements to package.el
References: <qtmvd2cl8w7.fsf@HIDDEN> <jwvei8zi8hy.fsf-monnier+emacs@HIDDEN>
Date: Thu, 30 Dec 2010 09:27:24 -0800
In-Reply-To: <jwvei8zi8hy.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
	of "Thu, 30 Dec 2010 10:32:27 -0500")
Message-ID: <qtmfwtfkw77.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -4.3 (----)
X-Debbugs-Envelope-To: 7756
Cc: 7756 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: emacs18@HIDDEN
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.9 (---)

Stefan Monnier <monnier@HIDDEN> writes:

>> @@ -338,9 +338,14 @@
>>  	 (pkg-file (expand-file-name
>>  		    (concat (package-strip-version package) "-pkg")
>>  		    pkg-dir)))
>> -    (when (and (file-directory-p pkg-dir)
>> -	       (file-exists-p (concat pkg-file ".el")))
>> -      (load pkg-file nil t))))
>> +    ;; When one is creating a package and testing it out, it is easy
>> +    ;; to forget to add the -pkg.el file.  When that happens, it would
>> +    ;; be useful to provide feedback to the user rather than silently
>> +    ;; failing.  That is what (error ...) below is for.
>> +    (when (file-directory-p pkg-dir)
>> +      (if (file-exists-p (concat pkg-file ".el"))
>> +          (load pkg-file nil t)
>> +        (error "'%s' file is missing!")))))
>
> I agree with the intention, but I wonder: why do we pass the `noerror'
> parameter to `load' in the first place?

Hi Stefan,

Thanks for looking into this.
I was focused in adding the error message and neglected to re-examine
the arguments to `load', i.e., I just kept the existing code.  I suppose
it was used before my proposed change to prevent signalling error if the
file was not found.  With the proposed change, since we check for the
existence of the file prior to calling `load', I suppose it is
appropriate to no longer pass `noerror'.  Good catch.  Also I'm sure you
have noticed that I forgot to add `pkg-file' argument to (error ...)
expression above.

>> @@ -569,8 +574,16 @@
>>  (defun package-unpack (name version)
>>    (let ((pkg-dir (expand-file-name (concat (symbol-name name) "-" version)
>>  				   package-user-dir)))
>> +    ;; Delete the package directory if it exists already.  This may
>> +    ;; not be useful to the end users.  However this is extremely
>> +    ;; important for package developers as they experiment with which
>> +    ;; files to include in a package.  If a file is removed from one
>> +    ;; iteration to the next, then the presence of the unwanted elisp
>> +    ;; file could cause problems by polluting the generated autoload
>> +    ;; file.
>> +    (if (file-directory-p pkg-dir)
>> +        (delete-directory pkg-dir 'recursive))
>
> Here, I also agree with the intention, but I'm a little uneasy blindly
> removing a whole subdirectory without warning: I'd add a confirmation prompt.

I agree with your concern.  A confirmation prompt seems to be a good
idea. 




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7756; Package emacs. Full text available.

Message received at 7756 <at> debbugs.gnu.org:


Received: (at 7756) by debbugs.gnu.org; 30 Dec 2010 15:25:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 30 10:25:46 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PYKNu-0002XO-Bb
	for submit <at> debbugs.gnu.org; Thu, 30 Dec 2010 10:25:46 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]
	helo=ironport2-out.pppoe.ca)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <monnier@HIDDEN>) id 1PYKNs-0002X9-3x
	for 7756 <at> debbugs.gnu.org; Thu, 30 Dec 2010 10:25:44 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AoAFADc1HE1FpZcL/2dsb2JhbACWH44bdL53hUoEhGWOGw
X-IronPort-AV: E=Sophos;i="4.60,249,1291611600"; d="scan'208";a="86791929"
Received: from 69-165-151-11.dsl.teksavvy.com (HELO pastel.home)
	([69.165.151.11])
	by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA;
	30 Dec 2010 10:32:28 -0500
Received: by pastel.home (Postfix, from userid 20848)
	id 88FDE5934F; Thu, 30 Dec 2010 10:32:27 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: emacs18@HIDDEN
Subject: Re: bug#7756: 24.0.50; enhancements to package.el
Message-ID: <jwvei8zi8hy.fsf-monnier+emacs@HIDDEN>
References: <qtmvd2cl8w7.fsf@HIDDEN>
Date: Thu, 30 Dec 2010 10:32:27 -0500
In-Reply-To: <qtmvd2cl8w7.fsf@HIDDEN> (emacs's message of "Wed, 29 Dec 2010
	10:40:56 -0800")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 7756
Cc: 7756 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.1 (--)

> @@ -338,9 +338,14 @@
>  	 (pkg-file (expand-file-name
>  		    (concat (package-strip-version package) "-pkg")
>  		    pkg-dir)))
> -    (when (and (file-directory-p pkg-dir)
> -	       (file-exists-p (concat pkg-file ".el")))
> -      (load pkg-file nil t))))
> +    ;; When one is creating a package and testing it out, it is easy
> +    ;; to forget to add the -pkg.el file.  When that happens, it would
> +    ;; be useful to provide feedback to the user rather than silently
> +    ;; failing.  That is what (error ...) below is for.
> +    (when (file-directory-p pkg-dir)
> +      (if (file-exists-p (concat pkg-file ".el"))
> +          (load pkg-file nil t)
> +        (error "'%s' file is missing!")))))

I agree with the intention, but I wonder: why do we pass the `noerror'
parameter to `load' in the first place?

> @@ -569,8 +574,16 @@
>  (defun package-unpack (name version)
>    (let ((pkg-dir (expand-file-name (concat (symbol-name name) "-" version)
>  				   package-user-dir)))
> +    ;; Delete the package directory if it exists already.  This may
> +    ;; not be useful to the end users.  However this is extremely
> +    ;; important for package developers as they experiment with which
> +    ;; files to include in a package.  If a file is removed from one
> +    ;; iteration to the next, then the presence of the unwanted elisp
> +    ;; file could cause problems by polluting the generated autoload
> +    ;; file.
> +    (if (file-directory-p pkg-dir)
> +        (delete-directory pkg-dir 'recursive))

Here, I also agree with the intention, but I'm a little uneasy blindly
removing a whole subdirectory without warning: I'd add a confirmation prompt.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7756; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 29 Dec 2010 18:37:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 29 13:37:45 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PY0u9-00008e-FB
	for submit <at> debbugs.gnu.org; Wed, 29 Dec 2010 13:37:45 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <emacs18@HIDDEN>) id 1PY0u7-00008T-A6
	for submit <at> debbugs.gnu.org; Wed, 29 Dec 2010 13:37:43 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <emacs18@HIDDEN>) id 1PY10i-0007qy-D2
	for submit <at> debbugs.gnu.org; Wed, 29 Dec 2010 13:44:37 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,
	FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,
	RFC_ABUSE_POST, 
	T_DKIM_INVALID,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:57224)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs18@HIDDEN>) id 1PY10i-0007qu-7s
	for submit <at> debbugs.gnu.org; Wed, 29 Dec 2010 13:44:32 -0500
Received: from [140.186.70.92] (port=47335 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PY0zG-0001kI-3Q
	for bug-gnu-emacs@HIDDEN; Wed, 29 Dec 2010 13:44:32 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <emacs18@HIDDEN>) id 1PY0xN-0007N8-EC
	for bug-gnu-emacs@HIDDEN; Wed, 29 Dec 2010 13:41:06 -0500
Received: from mail-pz0-f41.google.com ([209.85.210.41]:43757)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <emacs18@HIDDEN>) id 1PY0xN-0007Mr-3y
	for bug-gnu-emacs@HIDDEN; Wed, 29 Dec 2010 13:41:05 -0500
Received: by pzk27 with SMTP id 27so2515805pzk.0
	for <bug-gnu-emacs@HIDDEN>; Wed, 29 Dec 2010 10:41:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:from:from:to:subject:reply-to
	:date:message-id:mime-version:content-type;
	bh=9zGKKIv5nkOxS/8vU+GI46PFaxYPDn9SgfMuCe0g13w=;
	b=u1q09ZxJmwB/2IdHypqZWw2dqCIiB5fE87IN2XsELBDl2rZdQIgLagtN1ekzU0Dw6M
	XTMrJ1s2ieX6D+teMB+byqRHZVPhkF/MVfCQsElHHfQqIu6PQYnU0Jq0TJzVsqFIsM6P
	zeeSJxx/izdtW0TgtWRq8LzG4LtF2bFx7gqoo=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=from:to:subject:reply-to:date:message-id:mime-version:content-type;
	b=jFuDMOTg3d8s0o+RcxWr9DAvYzXHN5BKm//PN2ZfUB+b3weeP3/b6qRQvrv5/O+sTz
	kBDGO6FkjVKHo/qZv5PZ5TMdjTJw6i5BLOk1MeJ8EE+VMUX06+LUVrslVmxN3xPhFPS4
	cbgc6P4c/IV9ixM26bLVwRWk8ebH7RIp8dIYk=
Received: by 10.142.217.10 with SMTP id p10mr12256702wfg.181.1293648063460;
	Wed, 29 Dec 2010 10:41:03 -0800 (PST)
Received: from dad-laptop (pool-96-225-218-44.ptldor.fios.verizon.net
	[96.225.218.44])
	by mx.google.com with ESMTPS id v19sm21219636wfh.12.2010.12.29.10.41.01
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Wed, 29 Dec 2010 10:41:02 -0800 (PST)
From: emacs18@HIDDEN
From: Richard Kim <emacs18@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.0.50; enhancements to package.el
Date: Wed, 29 Dec 2010 10:40:56 -0800
Message-ID: <qtmvd2cl8w7.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -5.9 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: emacs18@HIDDEN
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.9 (-----)

I would like to suggest the following two sets of changes.
The reason for the changes are explained in the diffs.

=== modified file 'lisp/emacs-lisp/package.el'
--- lisp/emacs-lisp/package.el	2010-11-10 21:35:06 +0000
+++ lisp/emacs-lisp/package.el	2010-12-29 18:38:08 +0000
@@ -338,9 +338,14 @@
 	 (pkg-file (expand-file-name
 		    (concat (package-strip-version package) "-pkg")
 		    pkg-dir)))
-    (when (and (file-directory-p pkg-dir)
-	       (file-exists-p (concat pkg-file ".el")))
-      (load pkg-file nil t))))
+    ;; When one is creating a package and testing it out, it is easy
+    ;; to forget to add the -pkg.el file.  When that happens, it would
+    ;; be useful to provide feedback to the user rather than silently
+    ;; failing.  That is what (error ...) below is for.
+    (when (file-directory-p pkg-dir)
+      (if (file-exists-p (concat pkg-file ".el"))
+          (load pkg-file nil t)
+        (error "'%s' file is missing!")))))
 
 (defun package-load-all-descriptors ()
   "Load descriptors for installed Emacs Lisp packages.
@@ -569,8 +574,16 @@
 (defun package-unpack (name version)
   (let ((pkg-dir (expand-file-name (concat (symbol-name name) "-" version)
 				   package-user-dir)))
+    ;; Delete the package directory if it exists already.  This may
+    ;; not be useful to the end users.  However this is extremely
+    ;; important for package developers as they experiment with which
+    ;; files to include in a package.  If a file is removed from one
+    ;; iteration to the next, then the presence of the unwanted elisp
+    ;; file could cause problems by polluting the generated autoload
+    ;; file.
+    (if (file-directory-p pkg-dir)
+        (delete-directory pkg-dir 'recursive))
     (make-directory package-user-dir t)
-    ;; FIXME: should we delete PKG-DIR if it exists?
     (let* ((default-directory (file-name-as-directory package-user-dir)))
       (package-untar-buffer)
       (package-generate-autoloads (symbol-name name) pkg-dir)





Acknowledgement sent to emacs18@HIDDEN:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#7756; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

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