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.devel Subject: Re: compat.el and Emacs unstable master branch features Date: Wed, 13 Sep 2023 10:31:27 +0000 Message-ID: <87bke6s6tc.fsf@posteo.net> References: <87wn1axgh6.fsf@breatheoutbreathe.in> <87a5u2ydzg.fsf@breatheoutbreathe.in> <83msy25g0s.fsf@gnu.org> <624CBB7F-1442-400D-8D4D-1B26EBE9DACB@breatheoutbreathe.in> <877cp5bmig.fsf@breatheoutbreathe.in> <871qvz4kdw.fsf@localhost> <8734zoaolv.fsf@localhost> <87fs3o8uil.fsf@localhost> <87msxwa8kd.fsf@breatheoutbreathe.in> <87il8j7ji9.fsf@localhost> <80479897-500e-fe60-6586-0a44ccb5993b@daniel-mendler.de> <877coz7f6h.fsf@localhost> <86d6e412-9e5b-9086-56ce-e3794085096a@daniel-mendler.de> <874jk37dgh.fsf@localhost> <3f6176d5-ccc9-ec37-8adc-4e221388e164@daniel-mendler.de> <87ledd85ef.fsf@localhost> <87zg1rd7zj.fsf@posteo.net> 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="25116"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ihor Radchenko , Joseph Turner , Stefan Monnier , Adam Porter , Eli Zaretskii , phillip.lord@russet.org.uk, emacs-devel@gnu.org, ~pkal/compat-devel@lists.sr.ht To: Daniel Mendler Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 13 13:51:05 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qgOOd-0006E5-Gn for ged-emacs-devel@m.gmane-mx.org; Wed, 13 Sep 2023 13:51:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qgOO1-00049I-Mx; Wed, 13 Sep 2023 07:50:26 -0400 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 1qgONi-00043v-61 for emacs-devel@gnu.org; Wed, 13 Sep 2023 07:50:08 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgONa-0003rp-St for emacs-devel@gnu.org; Wed, 13 Sep 2023 07:50:03 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 2E716240028 for ; Wed, 13 Sep 2023 13:49:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1694605797; bh=wZRWa6JbnQcKBhDhB2ksPhGPE9qseANc7Ew4mDcziNg=; h=From:To:Cc:Subject:Date:Message-ID:Autocrypt:MIME-Version:From; b=TPW7ErW86//5DlMpxKduaRTiB4Qjw1JfYpB9WGLDQZ1x+pXaEbwDkzWkbJxEWXyad wNi5kWoTq6NhIV9greFLxUJd+v8LCgIpnUOmeJ9I+yUn8qQOHbCuzqKALT7DnznDbg oShbqukfB5TzOQoDP7L+fMbzq5m4a22WZLs4a/G4wjyug1C4FzIUzMzwn3Rk9A7uY/ oDmeeeKRH/5LI+IwDP8O7F8doPU+8hMpWgT3gRJsguD2pZeoKc74k2vm4sx1qGN3Nu /P5lppyCpZvGHbsEihRvzkDYKE3EPzdYSmhms6iNHKzDxg95gGpKjFGR8Yr1+8pGoz ISVx5DXEbMmiA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RlzJz1sBZz6tvc; Wed, 13 Sep 2023 13:49:54 +0200 (CEST) In-Reply-To: (Daniel Mendler's message of "Tue, 12 Sep 2023 12:27:27 +0200") 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 Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310542 Archived-At: --=-=-= Content-Type: text/plain Daniel Mendler writes: > On 9/12/23 12:02, Philip Kaludercic wrote: >> Ihor Radchenko writes: >> >>> Daniel Mendler writes: >>> >>>> ... Providing a public API won't work >>>> since Compat is not included in Emacs itself. A design criterion of >>>> Compat is also to keep the public API surface as small as possible. >>> >>> Maybe it is the time to consider including the compat.el API into Emacs? >>> We are getting a number of :core packages published on ELPA and >>> naturally having to solve various compatibility problems. >> >> I am a bit behind wrt Compat development. Are we talking about adding >> the `compat-call, etc. macros to the core? So basically just a >> >> (defmacro compat-call (&rest args) args) >> >> that would be overriden by compat's compat-call, as soon as that is >> loaded > > Yes, if the Emacs maintainers agree I think this could be done. Take > compat.el, remove the part which requires compat-29, and copy it to > lisp/ or lisp/emacs-lisp/. As you said, if Compat (the package) is > installed it will be preferred over the core compat.el. The advantage of > this move is that core package could require compat directly without > passing a noerror argument to require. Furthermore `compat-call' and > `compat-function' would be available and wouldn't have to be copied as > is currently the case for example in erc-compat.el. That sounds good! How does this look like: --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Add-the-public-API-of-Compat-to-the-core.patch >From 3245c3c4e6a8a4c35c4072df3a0bfefcabe0555d 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. --- lisp/emacs-lisp/compat.el | 61 +++++++++++++++++++++++++++++++++++++++ lisp/progmodes/python.el | 2 +- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 lisp/emacs-lisp/compat.el diff --git a/lisp/emacs-lisp/compat.el b/lisp/emacs-lisp/compat.el new file mode 100644 index 00000000000..4c60093b6be --- /dev/null +++ b/lisp/emacs-lisp/compat.el @@ -0,0 +1,61 @@ +;;; compat.el --- Pseudo-Compatibility for Elisp -*- lexical-binding: t; -*- + +;; Copyright (C) 2021-2023 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: 1.0 +;; 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 4b940b3f13b..bf0e27bc786 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -264,7 +264,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) -- 2.39.2 --=-=-=--