summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2018-10-19 18:10:42 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2018-10-19 18:10:42 -0400
commit32e411943d3f1d1546bfcb1aad8c4d4cd28857d6 (patch)
tree0743371b31fa4e1e67f272ad6ac5056681e96822 /lisp/emacs-lisp
parent7cfe2dc415d0a5768f9e6800836ff6887079dc30 (diff)
downloademacs-32e411943d3f1d1546bfcb1aad8c4d4cd28857d6.tar.gz
emacs-32e411943d3f1d1546bfcb1aad8c4d4cd28857d6.tar.bz2
emacs-32e411943d3f1d1546bfcb1aad8c4d4cd28857d6.zip
* emacs-lisp/package.el (package-get-version): Change into a function
(package-quickstart-refresh): Mangle string so it doesn't turn into a false positive for "no-byte-compile: t".
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/package.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 06e9956da4a..9c4c3e9fe7a 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -3452,11 +3452,14 @@ The list is displayed in a buffer named `*Packages*'."
(list-packages t))
;;;###autoload
-(defmacro package-get-version ()
+(defun package-get-version ()
"Return the version number of the package in which this is used.
Assumes it is used from an Elisp file placed inside the top-level directory
of an installed ELPA package.
The return value is a string (or nil in case we can't find it)."
+ ;; In a sense, this is a lie, but it does just what we want: precompute
+ ;; the version at compile time and hardcodes it into the .elc file!
+ (declare (pure t))
;; Hack alert!
(let ((file
(or (if (boundp 'byte-compile-current-file) byte-compile-current-file)
@@ -3476,6 +3479,7 @@ The return value is a string (or nil in case we can't find it)."
(pkgname (file-name-nondirectory (directory-file-name pkgdir)))
(mainfile (expand-file-name (concat pkgname ".el") pkgdir)))
(when (file-readable-p mainfile)
+ (require 'lisp-mnt)
(with-temp-buffer
(insert-file-contents mainfile)
(or (lm-header "package-version")
@@ -3567,7 +3571,7 @@ activations need to be changed, such as when `package-load-list' is modified."
(insert "
;; Local\sVariables:
;; version-control: never
-;; no-byte-compile: t
+;;\sno-byte-compile: t
;; no-update-autoloads: t
;; End:
"))))