path: root/dh-elpa.el
diff options
authorDavid Bremner <>2015-12-19 14:12:51 -0400
committerDavid Bremner <>2015-12-19 14:12:51 -0400
commitf0d844d13bf4890089237785da499e8e7707cbb4 (patch)
tree342973f65d4156b9133542a48178ac9fe7230f41 /dh-elpa.el
parent97993eabb761c12dbe3448c17bce28a8f6c84e8b (diff)
allow a string for epoch time
This makes it easier to take command line arguments
Diffstat (limited to 'dh-elpa.el')
1 files changed, 8 insertions, 3 deletions
diff --git a/dh-elpa.el b/dh-elpa.el
index 5ffa6f5..cd28770 100644
--- a/dh-elpa.el
+++ b/dh-elpa.el
@@ -29,12 +29,17 @@
;; Originally package-unpack from package.el in Emacs 24.5
(defun dhelpa-unpack (pkg-desc destdir &optional epoch-time)
"Install the contents of the current buffer into DESTDIR as a package.
-Optional argument EPOCH-TIME specifies time to use in autoload
-files; if unspecifed or nil the current time is used."
+Optional argument EPOCH-TIME specifies time (as a string or
+number) to use in autoload files; if unspecifed or nil the
+current time is used."
(let* ((name (package-desc-name pkg-desc))
(dirname (package-desc-full-name pkg-desc))
(pkg-dir (expand-file-name dirname destdir))
- (pkg-time (if epoch-time (seconds-to-time epoch-time) (current-time)))
+ (pkg-time (if epoch-time (seconds-to-time
+ (if (stringp epoch-time)
+ (string-to-number epoch-time)
+ epoch-time))
+ (current-time)))
(backup-inhibited t))
(make-directory pkg-dir t)
(pcase (package-desc-kind pkg-desc)