From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#66554: [PATCH] Add the public API of Compat to the core Date: Wed, 10 Jan 2024 14:02:02 -0800 Message-ID: References: <87pm1ggrdx.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12916"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66554@debbugs.gnu.org, eliz@gnu.org, Stefan Monnier To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 10 23:03:28 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 1rNgfY-00037O-AV for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jan 2024 23:03:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNgfD-0007n1-Jp; Wed, 10 Jan 2024 17:03: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 1rNgfA-0007lg-Fv for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 17:03:04 -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 1rNgf9-0002KM-L3 for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 17:03:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNgf8-0004Sy-6f for bug-gnu-emacs@gnu.org; Wed, 10 Jan 2024 17:03:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jan 2024 22:03:02 +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.170492413017089 (code B ref 66554); Wed, 10 Jan 2024 22:03:02 +0000 Original-Received: (at 66554) by debbugs.gnu.org; 10 Jan 2024 22:02:10 +0000 Original-Received: from localhost ([127.0.0.1]:43370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNgeH-0004RY-Lu for submit@debbugs.gnu.org; Wed, 10 Jan 2024 17:02:10 -0500 Original-Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:42218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNgeF-0004RH-Cz for 66554@debbugs.gnu.org; Wed, 10 Jan 2024 17:02:08 -0500 Original-Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5534dcfdd61so8275837a12.0 for <66554@debbugs.gnu.org>; Wed, 10 Jan 2024 14:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704924123; x=1705528923; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=IuSUN2OKZveCib2erTu41b5fN8QqaV+kFwfKQGDOBzQ=; b=hlStahtSDB4jMapU+5suzqjilXzyyjA0hr9aIBjh7Od9vcNsGWNDvqe2cuCkRZBy2e 2EiG+5BkzY3xmfi5XDb0t+/esVMqMl2qh5VOaX+lb6lxz5uVEnuuleRrIzXs0o1IStdG l5T7wnjRRhK0yGE9Hh2KkNRlMoBKHD/iDqPFXebPGu0me0pYIlpk9nkyc6SaMBPtlv7a nL9GRJnJdAfsrdSNLok4lC0+Vq+Zc9KV5eOWEDfl0PyJ5hxVAgARmmO1jCqid6miFmt9 sUfF3kUZ9vkdzxTbFgfuQsZPBoEqQK+BBGZzKDLwI5LlWYOxSk4bOCETCdIhFtuc/vNH dBUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704924123; x=1705528923; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IuSUN2OKZveCib2erTu41b5fN8QqaV+kFwfKQGDOBzQ=; b=cgZ+WNlg5Cf3PfLVpMyW00vreD+PZixzpzL6NEydVu3OIZh8I6URh7ETvdRhdjCHhw kRmQjdaO2X2AUdxIPdi1It2h8rhfyrdgATkeoXttPt2XIaOt+v6GwnBqnYEbZNVGxLfj 3ZYhobvp5nP8T4jbeCcEMUbbwQfB30oTXlGyys6uBRoqCEAxgHNDaXhWEcFEF7Cp69Wr UU9N+KxGorqUh4z1wAq7CW/8gBv2IxE0iUMMb32ijOnHakLhwGUk2p4leGUCbvnOnTAY RF47j/h6G3ioCG85As8zUkwf8iv9wM7lt4rjX9N9kcSQ3eXCpE9hS3e6yhcj+D/qDtLb oxng== X-Gm-Message-State: AOJu0YxttSx5v8fpeV5b/5h1tCqwTK5MqW4b+2uryLrK15q16ZTnJsVS s5JYDpYo0aWPnRlO4RBh17UqcD8Lu1ImD7uS0QM= X-Google-Smtp-Source: AGHT+IHx9YpkePYIylFq0MEZmHe8Fy/g3LK+X5TMOx2RfrblUt2Kdb3K3FKlp+UDNNwCYMemRXWcok7pQe4zPdqQarA= X-Received: by 2002:aa7:c304:0:b0:558:308f:db04 with SMTP id l4-20020aa7c304000000b00558308fdb04mr143389edq.18.1704924122609; Wed, 10 Jan 2024 14:02:02 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 10 Jan 2024 14:02:02 -0800 In-Reply-To: <87pm1ggrdx.fsf@posteo.net> (Philip Kaludercic's message of "Sun, 15 Oct 2023 09:35:22 +0000") 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:277830 Archived-At: Philip Kaludercic 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. > From 9ab5748d0e93c84c36c5559a4cda2087b3a24560 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)