emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/install-package-from-directory 26f6d43 3/5: (packa


From: Artur Malabarba
Subject: [Emacs-diffs] scratch/install-package-from-directory 26f6d43 3/5: (package-install-from-buffer): Install packages from dired buffer.
Date: Tue, 13 Jan 2015 17:57:53 +0000

branch: scratch/install-package-from-directory
commit 26f6d4368dba0d2ca4ba3c0353b98018f042d4a2
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    (package-install-from-buffer): Install packages from dired buffer.
---
 lisp/ChangeLog             |    1 +
 lisp/emacs-lisp/package.el |   29 ++++++++++++++++++++++++-----
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ca2d425..4bc4082 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -5,6 +5,7 @@
        the pkg-desc, with desc-kind set to KIND.
        (package-dir-info): New function. Find package information for a
        directory. The return result is a `package-desc'.
+       (package-install-from-buffer): Install packages from dired buffer.
 
 2015-01-11  Michael Albinus  <address@hidden>
 
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index af292fc..1ae6217 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -784,6 +784,14 @@ untar into a directory named DIR; otherwise, signal an 
error."
          (dirname (package-desc-full-name pkg-desc))
         (pkg-dir (expand-file-name dirname package-user-dir)))
     (pcase (package-desc-kind pkg-desc)
+      (`dir
+       (make-directory pkg-dir t)
+       (dolist (source-file
+                (directory-files
+                 default-directory 'full "\\`[^.].*\\.el\\'" 'nosort))
+         (let ((target-el-file
+                (expand-file-name (file-name-nondirectory source-file) 
pkg-dir)))
+           (copy-file source-file target-el-file t))))
       (`tar
        (make-directory package-user-dir t)
        ;; FIXME: should we delete PKG-DIR if it exists?
@@ -1293,13 +1301,24 @@ Return the pkg-desc, with desc-kind set to KIND."
 ;;;###autoload
 (defun package-install-from-buffer ()
   "Install a package from the current buffer.
-The current buffer is assumed to be a single .el or .tar file that follows the
-packaging guidelines; see info node `(elisp)Packaging'.
+The current buffer is assumed to be a single .el or .tar file or
+a directory.  These must follow the packaging guidelines (see
+info node `(elisp)Packaging').
+
+Specially, if current buffer is a directory, the -pkg.el
+description file is not mandatory, in which case the information
+is derived from the main .el file in the directory.
+
 Downloads and installs required packages as needed."
   (interactive)
-  (let ((pkg-desc (if (derived-mode-p 'tar-mode)
-                      (package-tar-file-info)
-                    (package-buffer-info))))
+  (let ((pkg-desc
+         (cond
+          ((derived-mode-p 'dired-mode)
+           (package-dir-info))
+          ((derived-mode-p 'tar-mode)
+           (package-tar-file-info))
+          (t
+           (package-buffer-info)))))
     ;; Download and install the dependencies.
     (let* ((requires (package-desc-reqs pkg-desc))
            (transaction (package-compute-transaction nil requires)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]