From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Kim Newsgroups: gmane.emacs.bugs Subject: bug#7756: 24.0.50; enhancements to package.el Date: Thu, 30 Dec 2010 09:27:24 -0800 Message-ID: References: Reply-To: emacs18@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1293731632 13379 80.91.229.12 (30 Dec 2010 17:53:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 30 Dec 2010 17:53:52 +0000 (UTC) Cc: 7756@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 30 18:53:46 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PYMgx-000207-4Y for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Dec 2010 18:53:35 +0100 Original-Received: from localhost ([127.0.0.1]:50013 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PYMgw-0007Tu-MK for geb-bug-gnu-emacs@m.gmane.org; Thu, 30 Dec 2010 12:53:34 -0500 Original-Received: from [140.186.70.92] (port=47703 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PYMgs-0007Tk-Bt for bug-gnu-emacs@gnu.org; Thu, 30 Dec 2010 12:53:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PYMgr-0005cI-2W for bug-gnu-emacs@gnu.org; Thu, 30 Dec 2010 12:53:30 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PYMgq-0005c7-VO for bug-gnu-emacs@gnu.org; Thu, 30 Dec 2010 12:53:29 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PYMBR-0004z6-Lp; Thu, 30 Dec 2010 12:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Richard Kim Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Dec 2010 17:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7756 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7756-submit@debbugs.gnu.org id=B7756.129372963519128 (code B ref 7756); Thu, 30 Dec 2010 17:21:01 +0000 Original-Received: (at 7756) by debbugs.gnu.org; 30 Dec 2010 17:20:35 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PYMB1-0004yT-1u for submit@debbugs.gnu.org; Thu, 30 Dec 2010 12:20:35 -0500 Original-Received: from mail-iy0-f172.google.com ([209.85.210.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PYMAy-0004yH-Gx for 7756@debbugs.gnu.org; Thu, 30 Dec 2010 12:20:33 -0500 Original-Received: by iyi42 with SMTP id 42so9996226iyi.3 for <7756@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= Original-Received: by 10.42.178.73 with SMTP id bl9mr16715752icb.448.1293730048420; Thu, 30 Dec 2010 09:27:28 -0800 (PST) Original-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) In-Reply-To: (Stefan Monnier's message of "Thu, 30 Dec 2010 10:32:27 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 30 Dec 2010 12:21:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:42937 Archived-At: Stefan Monnier 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.