diff options
| author | Stefan Monnier | 2021-12-31 00:03:35 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2021-12-31 00:03:35 -0500 |
| commit | 87f7412418ff2e4b2fe29d921aa6583b0b17bc29 (patch) | |
| tree | c08e79b92669d57f523b34112d0c80f523aa54cd | |
| parent | 59732a83c8875c8986d2221600d559a24d8309cc (diff) | |
| download | emacs-87f7412418ff2e4b2fe29d921aa6583b0b17bc29.tar.gz emacs-87f7412418ff2e4b2fe29d921aa6583b0b17bc29.zip | |
* lisp/emacs-lisp/package.el (package-get-version): Add fallback
| -rw-r--r-- | lisp/emacs-lisp/package.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index de4cebccca3..7b90e361bd4 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -4076,7 +4076,9 @@ The list is displayed in a buffer named `*Packages*'." | |||
| 4076 | "Return the version number of the package in which this is used. | 4076 | "Return the version number of the package in which this is used. |
| 4077 | Assumes it is used from an Elisp file placed inside the top-level directory | 4077 | Assumes it is used from an Elisp file placed inside the top-level directory |
| 4078 | of an installed ELPA package. | 4078 | of an installed ELPA package. |
| 4079 | The return value is a string (or nil in case we can't find it)." | 4079 | The return value is a string (or nil in case we can't find it). |
| 4080 | It works in more cases if the call is in the file which contains | ||
| 4081 | the `Version:' header." | ||
| 4080 | ;; In a sense, this is a lie, but it does just what we want: precompute | 4082 | ;; In a sense, this is a lie, but it does just what we want: precompute |
| 4081 | ;; the version at compile time and hardcodes it into the .elc file! | 4083 | ;; the version at compile time and hardcodes it into the .elc file! |
| 4082 | (declare (pure t)) | 4084 | (declare (pure t)) |
| @@ -4095,6 +4097,7 @@ The return value is a string (or nil in case we can't find it)." | |||
| 4095 | (let* ((pkgdir (file-name-directory file)) | 4097 | (let* ((pkgdir (file-name-directory file)) |
| 4096 | (pkgname (file-name-nondirectory (directory-file-name pkgdir))) | 4098 | (pkgname (file-name-nondirectory (directory-file-name pkgdir))) |
| 4097 | (mainfile (expand-file-name (concat pkgname ".el") pkgdir))) | 4099 | (mainfile (expand-file-name (concat pkgname ".el") pkgdir))) |
| 4100 | (unless (file-readable-p mainfile) (setq mainfile file)) | ||
| 4098 | (when (file-readable-p mainfile) | 4101 | (when (file-readable-p mainfile) |
| 4099 | (require 'lisp-mnt) | 4102 | (require 'lisp-mnt) |
| 4100 | (with-temp-buffer | 4103 | (with-temp-buffer |