From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Function to retrieve package version Date: Tue, 21 May 2019 15:56:06 -0700 Message-ID: <87zhnf76yh.fsf@ericabrahamsen.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="249570"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 22 00:56:23 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTDgE-0012rD-SN for ged-emacs-devel@m.gmane.org; Wed, 22 May 2019 00:56:23 +0200 Original-Received: from localhost ([127.0.0.1]:60559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTDgD-0004bH-KX for ged-emacs-devel@m.gmane.org; Tue, 21 May 2019 18:56:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTDg7-0004bA-Uy for emacs-devel@gnu.org; Tue, 21 May 2019 18:56:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTDg6-0000Qj-QL for emacs-devel@gnu.org; Tue, 21 May 2019 18:56:15 -0400 Original-Received: from [195.159.176.226] (port=52900 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTDg6-0000PB-K7 for emacs-devel@gnu.org; Tue, 21 May 2019 18:56:14 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hTDg3-0012gW-I6 for emacs-devel@gnu.org; Wed, 22 May 2019 00:56:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:5oaKp1NwVr5y9DZ0T9u0qXxCrfk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236873 Archived-At: Stefan Monnier writes: >> (defvar my-great-package-version >> (package-get-version)) > > C-h o package-get-version RET says: > > package-get-version is an autoloaded compiled Lisp function in ‘package.el’. > > (package-get-version) > > This function does not change global state, including the match data. > > 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). Aren't there a set of functions that start from a package name string, rather than the current file? I thought there were functions that would first retrieve a struct from your installed files, then extract a name/version from that?