path: root/dh-elpa.el
diff options
authorDavid Bremner <>2015-12-19 12:52:20 -0400
committerDavid Bremner <>2015-12-19 12:52:20 -0400
commit5dc6e1ab317985839dfe57b97b59650d415a02a7 (patch)
treebb587568ae6dd45831cfa1915dd865fb6dbfbfe8 /dh-elpa.el
parent40bdbce030371efad1a2afd169c754db6488c29d (diff)
add optional epoch-time argument to dhelpa-unpack
The use of advice here is ugly, but seems less so than post-processing the autoloads file.
Diffstat (limited to 'dh-elpa.el')
1 files changed, 8 insertions, 1 deletions
diff --git a/dh-elpa.el b/dh-elpa.el
index a0385c9..0d31a99 100644
--- a/dh-elpa.el
+++ b/dh-elpa.el
@@ -27,11 +27,12 @@
(require 'package)
;; Originally package-unpack from package.el in Emacs 24.5
-(defun dhelpa-unpack (pkg-desc destdir)
+(defun dhelpa-unpack (pkg-desc destdir &optional epoch-time)
"Install the contents of the current buffer as a package."
(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)))
(backup-inhibited t))
(make-directory pkg-dir t)
(pcase (package-desc-kind pkg-desc)
@@ -42,7 +43,13 @@
(let ((el-file (expand-file-name (format "%s.el" name) pkg-dir)))
(package--write-file-no-coding el-file)))
(kind (error "Unknown package kind: %S" kind)))
+ (defun dhelpa-autoload-insert-section-header (real-fun outbuf autoloads load-name file time)
+ (funcall real-fun outbuf autoloads load-name file pkg-time))
+ (advice-add #'autoload-insert-section-header
+ :around #'dhelpa-autoload-insert-section-header)
(package--make-autoloads-and-stuff pkg-desc pkg-dir)
+ (advice-remove #'autoload-insert-section-header
+ #'dhelpa-autoload-insert-section-header)
;; Write out (partial) package description in a form easily parsed by