[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/install-package-from-directory 7ce7b57 2/5: * emac
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] scratch/install-package-from-directory 7ce7b57 2/5: * emacs-lisp/package.el (package-dir-info): New function. |
Date: |
Tue, 13 Jan 2015 17:57:52 +0000 |
branch: scratch/install-package-from-directory
commit 7ce7b575a7a399f436b7264fa5c2f165494ed75c
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* emacs-lisp/package.el (package-dir-info): New function.
Find package information for a directory. The return result is a
`package-desc'.
---
lisp/ChangeLog | 2 ++
lisp/emacs-lisp/package.el | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8c73087..ca2d425 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -3,6 +3,8 @@
* emacs-lisp/package.el (package--read-pkg-desc): New
function. Read a `define-package' form in current buffer. Return
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'.
2015-01-11 Michael Albinus <address@hidden>
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index f0af233..af292fc 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1256,6 +1256,24 @@ The return result is a `package-desc'."
(package--read-pkg-desc 'tar)
(kill-buffer (current-buffer))))))
+(defun package-dir-info ()
+ "Find package information for a directory.
+The return result is a `package-desc'."
+ (cl-assert (derived-mode-p 'dired-mode))
+ (let* ((desc-file (package--description-file default-directory)))
+ (if (file-readable-p desc-file)
+ (with-temp-buffer
+ (insert-file-contents desc-file)
+ (package--read-pkg-desc 'dir))
+ (let ((files (directory-files default-directory t "\\.el\\'" t))
+ info)
+ (while files
+ (with-temp-buffer
+ (insert-file-contents (pop files))
+ (if (setq info (ignore-errors (package-buffer-info)))
+ (setq files nil)
+ info)))))))
+
(defun package--read-pkg-desc (kind)
"Read a `define-package' form in current buffer.
Return the pkg-desc, with desc-kind set to KIND."