From: "Bozhidar Batsov" <bozhidar@batsov.dev>
To: "Emacs Devel" <emacs-devel@gnu.org>
Subject: What's the right way to extract a package's version from the header metadata?
Date: Wed, 29 Dec 2021 08:29:52 +0200 [thread overview]
Message-ID: <e8629330-e229-4443-b87f-5c31895c730e@www.fastmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]
Recently I replaced pkg-info (a now abandoned package) with the following snippet in some of my packages:
(defconst cider-version
(eval-when-compile
(lm-version (or load-file-name buffer-file-name)))
"The current version of CIDER.")
The above snippet is from CIDER, but I've used this code in several places.
Basically I want to extract the package version from the *Version:* header instead of having to duplicate it. I know of package-get-package-version, but I assume it won't work for people who didn't install my packages via package.el.
However, a bunch of users immediately started to complain that cider-version became nil for them, so clearly I made some mistake. The problem is that I'm not sure what's wrong and how to best proceed, so I hope that someone here might give me some pointers. My best guess is that I shouldn't use load-file-name, but rather something else. More context - https://github.com/clojure-emacs/cider/commit/096c18418e1e7c379f4d1f3d3622baaf3308859a and https://github.com/clojure-emacs/sayid/pull/59
Thanks in advance for your help!
[-- Attachment #2: Type: text/html, Size: 2235 bytes --]
next reply other threads:[~2021-12-29 6:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-29 6:29 Bozhidar Batsov [this message]
2021-12-29 7:42 ` What's the right way to extract a package's version from the header metadata? Stefan Monnier
2021-12-29 7:54 ` Bozhidar Batsov
2021-12-29 18:22 ` Thierry Volpiatto
2021-12-29 18:42 ` Bozhidar Batsov
2021-12-30 9:04 ` Thierry Volpiatto
2021-12-30 1:13 ` Jonas Bernoulli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e8629330-e229-4443-b87f-5c31895c730e@www.fastmail.com \
--to=bozhidar@batsov.dev \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).