Commit 2fe6110d authored by Artur Malabarba's avatar Artur Malabarba

* emacs-lisp/package.el (package-dir-info): New function.

Find package information for a directory. The return result is a
`package-desc'.
parent be6dbd4b
......@@ -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-16 Jorgen Schaefer <contact@jorgenschaefer.de>
......
......@@ -1281,6 +1281,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)
(setf (package-desc-kind info) 'dir))))))))
(defun package--read-pkg-desc (kind)
"Read a `define-package' form in current buffer.
Return the pkg-desc, with desc-kind set to KIND."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment