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

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 11 Feb 2024 21:56:02 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
66554: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66554
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#66554: [PATCH] Add the public API of Compat to the core
From: Philip Kaludercic <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked], [email-masked]
Date: Sun, 11 Feb 2024 21:52:04 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Philip Kaludercic <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>>> From: Philip Kaludercic <[email-masked]>
>>> Cc: [email-masked],  [email-masked],  [email-masked],
>>>   [email-masked]
>>> Date: Sat, 10 Feb 2024 16:29:00 +0000
>>> 
>>> >> Note that Compat provides replacement functions with extended
>>> >> functionality for functions that are already defined (@code{sort},
>>> >> @code{assoc}, @dots{}).  These functions may have changed their
>>> >> calling convention (additional optional arguments) or may have changed
>>> >> their behavior.  These functions must be looked up explicitly with
>>> >> @code{compat-function} or called explicitly with @code{compat-call}.
>>> >> We call them ``Extended Definitions''.  In contrast, newly ``Added
>>> >> Definitions'' can be called as usual.
>>> >
>>> > Thanks.  I suggest to copy the above paragraph to the ELisp reference
>>> > manual, 
>>> 
>>> OK, can do.
>>> 
>>> >         and add a cross-reference to the Compat manual after it.
>>> 
>>> IIUC the cross-reference will be broken, unless the user has installed
>>> Compat manually.
>>
>> I wouldn't be worried about that: the cross-reference is readable, and
>> the reader will understand what it says even if it cannot be followed.
>> We do that for other manuals, which belong to other packages that
>> might not be installed.
>
> OK.  I don't have access to the machine with the latest version of the
> patch, but as soon as I get that going again, I'll update it and push
> the change to master.

I have pushed the patch to master, and will therefore close this bug
report.  Thanks to everyone involved for helping out.

Subject: [PATCH] Add the public API of Compat to the core
From: Philip Kaludercic <[email-masked]>
To: [email-masked]
Date: Sun, 15 Oct 2023 09:35:22 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

See https://lists.gnu.org/archive/html/emacs-devel/2023-10/msg00260.html
for the background behind this proposal.

In GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version
 3.24.37, cairo version 1.16.0) of 2023-10-13 built on quetzal
Repository revision: 97959349651a8fb170c1c754e73a4d86ed24d018
Repository branch: master
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-pgtk --with-imagemagick --with-tree-sitter'

>From 9ab5748d0e93c84c36c5559a4cda2087b3a24560 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <[email-masked]>
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 <[email-masked]>,				\
+;;   Daniel Mendler <[email-masked]>
+;; Maintainer:								\
+;;   Daniel Mendler <[email-masked]>,				\
+;;   Compat Development <~pkal/[email-masked]>,
+;;   [email-masked]
+;; 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 <https://www.gnu.org/licenses/>.
+
+;;; 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