Subject: Re: bug#66554: [PATCH] Add the public API of Compat to the core

From: Philip Kaludercic <[email-masked]>
Date: Thu, 11 Jan 2024 17:35:00 +0000

Daniel Mendler <[email-masked]> writes:

> Philip Kaludercic <[email-masked]> writes:
>>> Thanks. I also want to make sure that we specify the Compat version
>>> somewhere in the package builtins, such that Compat won't be installed
>>> if it is not needed, e.g., when a package requires (compat "30.1.x") and
>>> is installed on Emacs 30. Philip, what is needed to achieve this? It
>>> seems to me that this is not yet handled in the proposed patch.
>>
>> If I am not mistaken, all we would have to do is to adjust the version
>> number in the patch to the current Emacs version -- and update it
>> whenever Emacs is updated.  I have a slight concern that this could be
>> easily forgotten, if it isn't hooked into some update scripts.
>
> Okay, I see. The specified version should probably be something like
> 30.1.999 to make sure that packages requiring any Compat 30.1.x version
> will not download the ELPA package?

Because of 

  (version< "30.1" "30.1.1")

we can just set it to the actual Emacs version.

> Is there a place where we could add a warning to make sure that bumping
> the version won't be forgotten?

I think that admin/admin.el's `set-version' could be used like this:

diff --git a/admin/admin.el b/admin/admin.el
index 7fa2727aeb7..b8a9b41350a 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -115,6 +115,10 @@ set-version
   (set-version-in-file root "nt/README.W32" version
 		       (rx (and "version" (1+ space)
 				(submatch (1+ (in "0-9."))))))
+  (set-version-in-file root "lisp/emacs-lisp/compat.el" version
+		       (rx (and bol ";; Version : " (1+ space)
+				(submatch (1+ (in "0-9."))))))
+
   ;; TODO: msdos could easily extract the version number from
   ;; configure.ac with sed, rather than duplicating the information.
   (set-version-in-file root "msdos/sed2v2.inp" version

> Daniel

Eli Zaretskii <[email-masked]> writes:

>> From: Stefan Kangas <[email-masked]>
>> Date: Wed, 10 Jan 2024 14:02:02 -0800
>> Cc: [email-masked], [email-masked], 
>> 	Stefan Monnier <[email-masked]>
>> 
>> Philip Kaludercic <[email-masked]> writes:
>> 
>> > See https://lists.gnu.org/archive/html/emacs-devel/2023-10/msg00260.html
>> > for the background behind this proposal.
>> 
>> I'm fine with this, and see the same benefits as described above.
>> 
>> I'd like to hear if Eli and Stefan M has anything to add, though, so I'm
>> copying them in here.
>
> I don't mind, but it sounds like the details of adding compat.el to
> core are not yet clear to all, and are still being discussed.  Also,
> it sounds like we would need to modify compat.el for every release or
> something? if so, this should be in make-tarball.txt.

As mentioned above, I think this could be automated.

> It might be also a good idea to mention this in the ELisp manual
> somewhere.

This being "Compat"?