]> git.eshelyaron.com Git - emacs.git/commitdiff
* emacs-lisp/package.el (package--read-pkg-desc): New function.
authorArtur Malabarba <bruce.connor.am@gmail.com>
Tue, 13 Jan 2015 01:24:22 +0000 (23:24 -0200)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Sat, 17 Jan 2015 00:19:17 +0000 (22:19 -0200)
Read a `define-package' form in current buffer. Return the pkg-desc,
with desc-kind set to KIND.

lisp/ChangeLog
lisp/emacs-lisp/package.el

index c80f8f7bad48307a80d3cff801f570c280f1e217..93796e67a3d99750341d08914315dadc43e5fb16 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-16  Artur Malabarba  <bruce.connor.am@gmail.com>
+
+       * 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.
+
 2015-01-16  Jorgen Schaefer  <contact@jorgenschaefer.de>
 
        * emacs-lisp/package.el: Provide repository priorities.
index 5336271b65be9ee89d477a49df61c1cac055faeb..d5906675596c0f92249706c31afa90b8f19a440d 100644 (file)
@@ -1277,19 +1277,25 @@ The return result is a `package-desc'."
     (unless tar-desc
       (error "No package descriptor file found"))
     (with-current-buffer (tar--extract tar-desc)
-      (goto-char (point-min))
       (unwind-protect
-          (let* ((pkg-def-parsed (read (current-buffer)))
-                 (pkg-desc
-                  (if (not (eq (car pkg-def-parsed) 'define-package))
-                      (error "Can't find define-package in %s"
-                             (tar-header-name tar-desc))
-                    (apply #'package-desc-from-define
-                           (append (cdr pkg-def-parsed))))))
-            (setf (package-desc-kind pkg-desc) 'tar)
-            pkg-desc)
+          (package--read-pkg-desc 'tar)
         (kill-buffer (current-buffer))))))
 
+(defun package--read-pkg-desc (kind)
+  "Read a `define-package' form in current buffer.
+Return the pkg-desc, with desc-kind set to KIND."
+  (goto-char (point-min))
+  (unwind-protect
+      (let* ((pkg-def-parsed (read (current-buffer)))
+             (pkg-desc
+              (if (not (eq (car pkg-def-parsed) 'define-package))
+                  (error "Can't find define-package in %s"
+                         (tar-header-name tar-desc))
+                (apply #'package-desc-from-define
+                  (append (cdr pkg-def-parsed))))))
+        (setf (package-desc-kind pkg-desc) kind)
+        pkg-desc)))
+
 
 ;;;###autoload
 (defun package-install-from-buffer ()