unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Function to retrieve package version
@ 2019-05-21  4:55 Paul W. Rankin
  2019-05-21  8:32 ` Michael Albinus
  2019-05-21 21:55 ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Paul W. Rankin @ 2019-05-21  4:55 UTC (permalink / raw)
  To: Emacs developers

wrt. 
http://lists.gnu.org/archive/html/help-gnu-emacs/2019-05/msg00022.html

I would like an easy function that retrieves the version of the 
current package, e.g.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;;; my-great-package.el --- A great package

;; Copyright (c) 1952-2019  Free Software Foundation, Inc.

;; Author: Mr. Big Pants <mister@bigpants.com>
;; Version: 2.7.0
;; Package-Requires: ((emacs "24.5"))

(defvar my-great-package-version
  (package-get-version))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    my-great-package-version
    -> "2.7.0"

-- 
https://www.paulwrankin.com



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-21  4:55 Function to retrieve package version Paul W. Rankin
@ 2019-05-21  8:32 ` Michael Albinus
  2019-05-21  9:08   ` Paul W. Rankin
  2019-05-21 21:55 ` Stefan Monnier
  1 sibling, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2019-05-21  8:32 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: Emacs developers

"Paul W. Rankin" <hello@paulwrankin.com> writes:

> wrt. http://lists.gnu.org/archive/html/help-gnu-emacs/2019-05/msg00022.html
>
> I would like an easy function that retrieves the version of the
> current package, e.g.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ;;; my-great-package.el --- A great package
>
> ;; Copyright (c) 1952-2019  Free Software Foundation, Inc.
>
> ;; Author: Mr. Big Pants <mister@bigpants.com>
> ;; Version: 2.7.0
> ;; Package-Requires: ((emacs "24.5"))
>
> (defvar my-great-package-version
>  (package-get-version))
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>    my-great-package-version
>    -> "2.7.0"

(or (lm-header "package-version")
    (lm-header "version"))

Best regards, Michael.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-21  8:32 ` Michael Albinus
@ 2019-05-21  9:08   ` Paul W. Rankin
  2019-05-21  9:40     ` Michael Albinus
  0 siblings, 1 reply; 13+ messages in thread
From: Paul W. Rankin @ 2019-05-21  9:08 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Emacs developers


On Tue, May 21 2019, Michael Albinus wrote:
>>    my-great-package-version
>>    -> "2.7.0"
>
> (or (lm-header "package-version")
>     (lm-header "version"))

Thanks Michael, this is the best!

The lisp-mnt library should be added to the Elisp manual :)



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-21  9:08   ` Paul W. Rankin
@ 2019-05-21  9:40     ` Michael Albinus
  2019-05-21 20:18       ` Richard Stallman
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2019-05-21  9:40 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: Emacs developers

"Paul W. Rankin" <hello@paulwrankin.com> writes:

>> (or (lm-header "package-version")
>>     (lm-header "version"))
>
> Thanks Michael, this is the best!
>
> The lisp-mnt library should be added to the Elisp manual :)

Yes, I was first looking there, and couldn't find it.

Do you want to contribute a patch? Or at least a bug report? (I'm
completely short in time; otherwise I would do it myself)

Best regards, Michael.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-21  9:40     ` Michael Albinus
@ 2019-05-21 20:18       ` Richard Stallman
  2019-05-22  2:02         ` Paul W. Rankin
  0 siblings, 1 reply; 13+ messages in thread
From: Richard Stallman @ 2019-05-21 20:18 UTC (permalink / raw)
  To: Michael Albinus; +Cc: hello, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > The lisp-mnt library should be added to the Elisp manual :)

  > Yes, I was first looking there, and couldn't find it.

Please don't do that.  The manual is very long already.  That makes
printing expensive.  Before we add a new topic, we need to consider
whether the benefit is worth the increase in cost.

You write it and put it in an @ifnottex conditional.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-21  4:55 Function to retrieve package version Paul W. Rankin
  2019-05-21  8:32 ` Michael Albinus
@ 2019-05-21 21:55 ` Stefan Monnier
  2019-05-21 22:56   ` Eric Abrahamsen
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2019-05-21 21:55 UTC (permalink / raw)
  To: emacs-devel

> (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).


-- Stefan




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-21 21:55 ` Stefan Monnier
@ 2019-05-21 22:56   ` Eric Abrahamsen
  0 siblings, 0 replies; 13+ messages in thread
From: Eric Abrahamsen @ 2019-05-21 22:56 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> 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?




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-21 20:18       ` Richard Stallman
@ 2019-05-22  2:02         ` Paul W. Rankin
  2019-05-22  2:26           ` Eli Zaretskii
  2019-05-22 22:39           ` Richard Stallman
  0 siblings, 2 replies; 13+ messages in thread
From: Paul W. Rankin @ 2019-05-22  2:02 UTC (permalink / raw)
  To: rms; +Cc: Michael Albinus, emacs-devel


On Wed, May 22 2019, Richard Stallman wrote:
> Please don't do that.  The manual is very long already.  That 
> makes
> printing expensive.  Before we add a new topic, we need to 
> consider
> whether the benefit is worth the increase in cost.

Can you elaborate on what you mean here Richard? Do you mean 
people printing the Elisp manual themselves, or does the FSF print 
copies of the Elisp manual gratis?

If the former, surely the benefit of Emacs Lisp package 
maintainers knowing about the built-in "utility functions for 
Emacs Lisp maintainers" outweighs the miniscule additional cost of 
a couple of paragraphs that might add a single page to the printed 
output, which at the very most (barring some sort of OCD 
condition) will be printed once per major release?

And if I'm going to the trouble/expense of printing the entire 
Elisp manual, I damn sure want it to be as complete as possible, 
rather than later discover it's missing key topics and so will 
require a reprint. The idea that I'm being miserly about my stock 
of printer paper in this scenario is a little unrealistic...



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-22  2:02         ` Paul W. Rankin
@ 2019-05-22  2:26           ` Eli Zaretskii
  2019-05-22  2:49             ` Paul W. Rankin
  2019-05-22 22:39           ` Richard Stallman
  1 sibling, 1 reply; 13+ messages in thread
From: Eli Zaretskii @ 2019-05-22  2:26 UTC (permalink / raw)
  To: emacs-devel, Paul W. Rankin, rms; +Cc: Michael Albinus

On May 22, 2019 5:02:20 AM GMT+03:00, "Paul W. Rankin" <hello@paulwrankin.com> wrote:
> 
> On Wed, May 22 2019, Richard Stallman wrote:
> > Please don't do that.  The manual is very long already.  That 
> > makes
> > printing expensive.  Before we add a new topic, we need to 
> > consider
> > whether the benefit is worth the increase in cost.
> 
> Can you elaborate on what you mean here Richard? Do you mean 
> people printing the Elisp manual themselves, or does the FSF print 
> copies of the Elisp manual gratis?
> 
> If the former, surely the benefit of Emacs Lisp package 
> maintainers knowing about the built-in "utility functions for 
> Emacs Lisp maintainers" outweighs the miniscule additional cost of 
> a couple of paragraphs that might add a single page to the printed 
> output, which at the very most (barring some sort of OCD 
> condition) will be printed once per major release?
> 
> And if I'm going to the trouble/expense of printing the entire 
> Elisp manual, I damn sure want it to be as complete as possible, 
> rather than later discover it's missing key topics and so will 
> require a reprint. The idea that I'm being miserly about my stock 
> of printer paper in this scenario is a little unrealistic...

Richard means the manual whjch the FSF prints and sells.  If it's too large, it will be more expensive.

But there's a way to have that cake and eat it, too: we can have certain portions of the manual conditioned by @ifnottex.  We already do that for some less important topics.  So there's no need to argue about this particular case.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-22  2:26           ` Eli Zaretskii
@ 2019-05-22  2:49             ` Paul W. Rankin
  2019-05-22  7:49               ` Michael Albinus
  2019-05-22  7:50               ` Eli Zaretskii
  0 siblings, 2 replies; 13+ messages in thread
From: Paul W. Rankin @ 2019-05-22  2:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Albinus, rms, emacs-devel


On Wed, May 22 2019, Eli Zaretskii wrote:
> Richard means the manual whjch the FSF prints and sells.  If 
> it's too large, it will be more expensive.
>
> But there's a way to have that cake and eat it, too: we can have 
> certain portions of the manual conditioned by @ifnottex.  We 
> already do that for some less important topics.  So there's no 
> need to argue about this particular case.

Makes sense. But getting immediate pushback just means I won't be 
contributing the topic.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-22  2:49             ` Paul W. Rankin
@ 2019-05-22  7:49               ` Michael Albinus
  2019-05-22  7:50               ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2019-05-22  7:49 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: Eli Zaretskii, rms, emacs-devel

"Paul W. Rankin" <hello@paulwrankin.com> writes:

> On Wed, May 22 2019, Eli Zaretskii wrote:
>> Richard means the manual whjch the FSF prints and sells.  If it's
>> too large, it will be more expensive.
>>
>> But there's a way to have that cake and eat it, too: we can have
>> certain portions of the manual conditioned by @ifnottex.  We already
>> do that for some less important topics.  So there's no need to argue
>> about this particular case.
>
> Makes sense. But getting immediate pushback just means I won't be
> contributing the topic.

In the given case, I believe it is not mandatory to document the whole
lisp-mnt package. It would suffice to document `lm-header' in the node
"(elisp) Library Headers".

Best regards, Michael.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-22  2:49             ` Paul W. Rankin
  2019-05-22  7:49               ` Michael Albinus
@ 2019-05-22  7:50               ` Eli Zaretskii
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2019-05-22  7:50 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: michael.albinus, rms, emacs-devel

> From: "Paul W. Rankin" <hello@paulwrankin.com>
> Cc: emacs-devel@gnu.org, rms@gnu.org, Michael Albinus <michael.albinus@gmx.de>
> Date: Wed, 22 May 2019 12:49:09 +1000
> 
> getting immediate pushback just means I won't be contributing the
> topic.

Not sure what you mean by that, Richard just asked not to add stuff
automatically without considering whether it's justified:

  Before we add a new topic, we need to consider whether the benefit
  is worth the increase in cost.

I see no negative pushback here, but that's me.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function to retrieve package version
  2019-05-22  2:02         ` Paul W. Rankin
  2019-05-22  2:26           ` Eli Zaretskii
@ 2019-05-22 22:39           ` Richard Stallman
  1 sibling, 0 replies; 13+ messages in thread
From: Richard Stallman @ 2019-05-22 22:39 UTC (permalink / raw)
  To: Paul W. Rankin; +Cc: michael.albinus, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Can you elaborate on what you mean here Richard?

No time today.  I am overloaded.  But maybe someone else
can explain this to you.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-05-22 22:39 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-21  4:55 Function to retrieve package version Paul W. Rankin
2019-05-21  8:32 ` Michael Albinus
2019-05-21  9:08   ` Paul W. Rankin
2019-05-21  9:40     ` Michael Albinus
2019-05-21 20:18       ` Richard Stallman
2019-05-22  2:02         ` Paul W. Rankin
2019-05-22  2:26           ` Eli Zaretskii
2019-05-22  2:49             ` Paul W. Rankin
2019-05-22  7:49               ` Michael Albinus
2019-05-22  7:50               ` Eli Zaretskii
2019-05-22 22:39           ` Richard Stallman
2019-05-21 21:55 ` Stefan Monnier
2019-05-21 22:56   ` Eric Abrahamsen

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).