From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#66554: [PATCH] Add the public API of Compat to the core Date: Thu, 11 Jan 2024 20:07:41 +0000 Message-ID: <87a5pbpraq.fsf@posteo.net> References: <87pm1ggrdx.fsf@posteo.net> <83y1cwkvnw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25698"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66554@debbugs.gnu.org, Eli Zaretskii , monnier@iro.umontreal.ca To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 11 21:08:25 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rO1Lk-0006Sv-DO for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jan 2024 21:08:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rO1LT-0004NY-Lm; Thu, 11 Jan 2024 15:08:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rO1LR-0004Mq-Fb for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 15:08:05 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rO1LR-00067P-5y for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 15:08:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rO1LN-00051J-Vr for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 15:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jan 2024 20:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66554 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66554-submit@debbugs.gnu.org id=B66554.170500367119274 (code B ref 66554); Thu, 11 Jan 2024 20:08:01 +0000 Original-Received: (at 66554) by debbugs.gnu.org; 11 Jan 2024 20:07:51 +0000 Original-Received: from localhost ([127.0.0.1]:33986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rO1LC-00050o-ST for submit@debbugs.gnu.org; Thu, 11 Jan 2024 15:07:51 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:43449) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rO1L8-00050X-Ct for 66554@debbugs.gnu.org; Thu, 11 Jan 2024 15:07:49 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 36733240101 for <66554@debbugs.gnu.org>; Thu, 11 Jan 2024 21:07:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1705003663; bh=6VyauT1wskRmDDzDPbCC0x74+ZLCTqjy/t/8Ex1i84M=; h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version: From; b=gWZbUT85M+hiOVRRDe4lmEWHrkcE2k8trZL/fLj7wdQvOLz9wcNnQKrUqZ6i0Yo9f YUpFsDV2jTflaoruWlo+nJhDZ9Vm9oASaDmWsC+e+s5Ji7WCeMvrsGMGvkncVLAZ03 CQcAde+FWRa1eggGAoNz0+obicEzazkx+G35v6Jf5s5F+ybF6tl+/y+I1zcXX9YUoe LGIYQrCWxy9rMQK9PjS+3IxoW8Eol211r+Uv3DiAbzdQnFYBL2BwnHxK2FWOildUbM ot66vHxx3Hju32YxbFhYcGfe4a1zotr225mI1U4P40vJPPc+enLunrIuK6Kmlu+rqd bY9M6yNZVXY6w== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4T9wgy1V5Hz6twd; Thu, 11 Jan 2024 21:07:41 +0100 (CET) In-Reply-To: (Stefan Kangas's message of "Thu, 11 Jan 2024 11:35:28 -0800") Autocrypt: addr=philipk@posteo.net; keydata= mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof z4oM OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66; url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66"; preference=signencrypt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:277943 Archived-At: --=-=-= Content-Type: text/plain Stefan Kangas writes: > Eli Zaretskii writes: > >> 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. > > OK, thanks. There's no rush here, I think. I hope that people will > speak up so that we can get a handle on those details. > >> 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. >> >> It might be also a good idea to mention this in the ELisp manual >> somewhere. > > Philip, could you take a look at this and amend the patch accordingly? > Thanks in advance. This would integrate my previous two suggestions: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-the-public-API-of-Compat-to-the-core.patch >From 83743d8c407cf5ef8a34816b88e9b28d890bc7f6 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 13 Sep 2023 12:26:22 +0200 Subject: [PATCH] Add the public API of Compat to the core * lisp/emacs-lisp/compat.el: Add stub file with minimal definitions, so that core packages, that haven't been installed from ELPA, can make use of the public API and use more recent function signatures. * lisp/progmodes/python.el (compat): Remove 'noerror flag, because Compat can now be required without the real package being available. * admin/admin.el (set-version): Update the version in the package header when setting the version. * lisp/subr.el (version-regexp-alist): Add non-numeric version string "compat", to ensure that the build-in compat is always preferred. (Bug#66554) --- admin/admin.el | 5 ++++ lisp/emacs-lisp/compat.el | 61 +++++++++++++++++++++++++++++++++++++++ lisp/progmodes/python.el | 2 +- lisp/subr.el | 4 +-- 4 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 lisp/emacs-lisp/compat.el diff --git a/admin/admin.el b/admin/admin.el index 7fa2727aeb7..bcf1be6ff67 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -115,6 +115,11 @@ 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."))) + "compat"))) + ;; 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 diff --git a/lisp/emacs-lisp/compat.el b/lisp/emacs-lisp/compat.el new file mode 100644 index 00000000000..b45b3ede633 --- /dev/null +++ b/lisp/emacs-lisp/compat.el @@ -0,0 +1,61 @@ +;;; compat.el --- Pseudo-Compatibility for Elisp -*- lexical-binding: t; -*- + +;; Copyright (C) 2021-2024 Free Software Foundation, Inc. + +;; Author: \ +;; Philip Kaludercic , \ +;; Daniel Mendler +;; Maintainer: \ +;; Daniel Mendler , \ +;; Compat Development <~pkal/compat-devel@lists.sr.ht>, +;; emacs-devel@gnu.org +;; URL: https://github.com/emacs-compat/compat +;; Version: 30.1compat +;; Keywords: lisp, maint + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; The Compat package on ELPA provides forward-compatibility +;; definitions for other packages. While mostly transparent, a +;; minimal API is necessary whenever core definitions change calling +;; conventions (e.g. `plist-get' can be invoked with a predicate from +;; Emacs 29.1 onward). For core packages on ELPA to be able to take +;; advantage of this functionality, the macros `compat-function' and +;; `compat-call' have to be available in the core, usable even if +;; users do not have the Compat package installed, which this file +;; ensures. + +;; Note that Compat is not a core package and this file is not +;; available on GNU ELPA. + +;;; Code: + +(defmacro compat-function (fun) + "Return compatibility function symbol for FUN. +This is a pseudo-compatibility stub for core packages on ELPA, +that depend on the Compat package, whenever the user doesn't have +the package installed on their current system." + `#',fun) + +(defmacro compat-call (fun &rest args) + "Call compatibility function or macro FUN with ARGS. +This is a pseudo-compatibility stub for core packages on ELPA, +that depend on the Compat package, whenever the user doesn't have +the package installed on their current system." + (cons fun args)) + +(provide 'compat) +;;; compat.el ends here diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 1148da11a06..c3f18692f61 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -267,7 +267,7 @@ (eval-when-compile (require 'subr-x)) ;For `string-empty-p' and `string-join'. (require 'treesit) (require 'pcase) -(require 'compat nil 'noerror) +(require 'compat) (require 'project nil 'noerror) (require 'seq) diff --git a/lisp/subr.el b/lisp/subr.el index df28989b399..007206ebf0e 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6873,9 +6873,9 @@ version-separator Usually the separator is \".\", but it can be any other string.") - (defconst version-regexp-alist - '(("^[-._+ ]?snapshot$" . -4) + `(("^[-._+ ]?compat$" . ,most-positive-fixnum) + ("^[-._+ ]?snapshot$" . -4) ;; treat "1.2.3-20050920" and "1.2-3" as snapshot releases ("^[-._+]$" . -4) ;; treat "1.2.3-CVS" as snapshot release -- 2.39.2 --=-=-=--