emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What's the right way to extract a package's version from the header meta


From: Bozhidar Batsov
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
User-agent: Cyrus-JMAP/3.5.0-alpha0-4525-g8883000b21-fm-20211221.001-g8883000b

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!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]