Subject: bug#19851: 25.0.50; package-install-{file,from-buffer} broken

From: [email-masked]
Date: Sat, 06 Aug 2016 16:34:31 -0400

Mark Oteiza <[email-masked]> writes:

> On 23/12/15 at 02:51am, Juri Linkov wrote:
>> > A bug remains:
>> >
>> > 1. mkdir /tmp/foo
>> > 2. Evaluate:
>> >
>> >   (save-place-mode)
>> >   (package-initialize)
>> 
>> Do you see the same bug without using save-place-mode?
>
> Oh, of course. Woops.
>
>> > 3. M-x package-install-file RET /tmp/foo RET
>> 
>> I wonder why are you trying yo install a package from the empty directory?
>
> Just trying to break things is all.

So we just need a better error message here?  Something like this:

>From dabd1cb2ffe3aed39f11d89f5ab1acab5b1d0426 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Sat, 25 Jun 2016 15:57:39 -0400
Subject: [PATCH v1] Improve error when installing non-package dirs

* lisp/emacs-lisp/package.el (package-dir-info): Throw meaningful error
when no file with package info is found (Bug #19851).
---
 lisp/emacs-lisp/package.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index e721b55..f669c31 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1081,6 +1081,8 @@ package-dir-info
               (setq files nil)
               ;; set the 'dir kind,
               (setf (package-desc-kind info) 'dir))))
+        (unless info
+          (error "No .el files with package headers in `%s'" default-directory))
         ;; and return the info.
         info))))
 
-- 
2.8.0