From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Philip Kaludercic <philipk@posteo.net>
Cc: 66554@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
stefankangas@gmail.com, monnier@iro.umontreal.ca
Subject: bug#66554: [PATCH] Add the public API of Compat to the core
Date: Wed, 07 Feb 2024 18:31:39 +0100 [thread overview]
Message-ID: <87jzngw58k.fsf@daniel-mendler.de> (raw)
In-Reply-To: <875xz05h6m.fsf@posteo.net> (Philip Kaludercic's message of "Wed, 07 Feb 2024 17:15:45 +0000")
Philip Kaludercic <philipk@posteo.net> writes:
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> Eli Zaretskii <eliz@gnu.org> writes:
>>
>>>> From: Philip Kaludercic <philipk@posteo.net>
>>>> Cc: mail@daniel-mendler.de, 66554@debbugs.gnu.org, stefankangas@gmail.com,
>>>> monnier@iro.umontreal.ca
>>>> Date: Tue, 06 Feb 2024 19:10:32 +0000
>>>>
>>>> >> +@defmac compat-call fun &rest args
>>>> >> +This macro calls the compatibility function @var{fun} with @var{args}.
>>>> >> +Many functions provided by Compat can be called directly without this
>>>> >> +macro. However in the case where Compat provides an alternative
>>>> >> +version of an existing function, the function call has to go through
>>>> >> +@code{compat-call}.
>>>> >> +@end defmac
>>>> >
>>>> > This description left me without understanding when I need to use
>>>> > compat-call and when I can just call FUN. Can you explain more?
>>>>
>>>> The intention was for this paragraph to catch that case,
>>>>
>>>> However in the case where Compat provides an alternative version of an
>>>> existing function, the function call has to go through
>>>> @code{compat-call}.
>>>>
>>>> though the real information is to be found in the Compat manual, where
>>>> the functions that have to be called via compat-call are documented.
>>>>
>>>> Should the above sentence be rephrased to give a general feeling for
>>>> when this is the case
>>>>
>>>> However in the case where Compat provides an alternative version of an
>>>> existing function, the function call has to go through
>>>> @code{compat-call}. This is the case when, for example the signature
>>>> changes between versions, preventing older versions of Emacs from
>>>> using optional arguments introduced in newer releases.
>>>>
>>>> or should we just refer to the external manual?
>>>
>>> Let me try to make my point more clear: I'd prefer that the reader
>>> emerges from reading this description with a practical way of knowing
>>> when to call the function directly and when to call it via
>>> 'compat-call'. If that's not easy to understand, perhaps we should
>>> tell that 'compat-call' should always be used, to avoid some rare
>>> corner cases where a direct call will not do, and be done?
>>
>> I don't think we should recommend always using `compat-call', that would
>> make code unreadable. What definitions have to be called via
>> `compat-call' really depends on how they were defined in Compat. I
>> don't know of a better rule to describe it without copying the
>> documentation from the Compat manual (that wouldn't be a good idea
>> either, because it wouldn't stay up to date).
>
> Daniel, do have any ideas how to improve the documentation here? It
> seems to me that the authoritative source of information on what
> functions to compat-call is Compat itself, right?
The Compat manual explicitly lists how each function should be called.
This information is not static, since new functions are added with every
Compat release. Examples from the Compat manual:
Function: compat-call plist-get plist prop &optional predicate
Function: ntake n list
I think we should explain the general idea in the compat.el file in
Emacs itself (docstrings and commentary) and refer to the Compat manual
for the list of supported functions and their calling convention. The
explanations in the current patch look good to me.
Daniel
next prev parent reply other threads:[~2024-02-07 17:31 UTC|newest]
Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-15 9:35 bug#66554: [PATCH] Add the public API of Compat to the core Philip Kaludercic
2024-01-10 22:02 ` Stefan Kangas
2024-01-11 5:27 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 7:54 ` Philip Kaludercic
2024-01-11 8:06 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 17:35 ` Philip Kaludercic
2024-01-11 17:58 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 19:24 ` Philip Kaludercic
2024-01-11 20:11 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 20:24 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-11 20:43 ` Philip Kaludercic
2024-01-11 21:01 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 16:29 ` Philip Kaludercic
2024-01-12 18:05 ` Eli Zaretskii
2024-01-12 18:17 ` Philip Kaludercic
2024-01-12 18:29 ` Eli Zaretskii
2024-01-12 18:40 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 20:05 ` Eli Zaretskii
2024-01-12 22:27 ` Philip Kaludercic
2024-01-13 6:44 ` Eli Zaretskii
2024-01-13 12:23 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-18 19:51 ` Philip Kaludercic
2024-01-18 20:17 ` Eli Zaretskii
2024-01-18 20:33 ` Stefan Kangas
2024-01-19 6:40 ` Eli Zaretskii
2024-01-19 6:52 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-18 20:35 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-19 6:43 ` Eli Zaretskii
2024-01-19 6:57 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-19 16:44 ` Philip Kaludercic
2024-01-19 18:50 ` Eli Zaretskii
2024-01-24 6:23 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 7:58 ` Philip Kaludercic
2024-01-26 10:42 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-26 12:35 ` Eli Zaretskii
2024-02-01 15:53 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-02 8:11 ` Philip Kaludercic
2024-02-02 12:36 ` Eli Zaretskii
2024-02-06 19:10 ` Philip Kaludercic
2024-02-06 19:37 ` Eli Zaretskii
2024-02-06 19:59 ` Philip Kaludercic
2024-02-07 17:15 ` Philip Kaludercic
2024-02-07 17:31 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-02-07 17:43 ` Eli Zaretskii
2024-02-08 7:40 ` Philip Kaludercic
2024-02-08 8:21 ` Eli Zaretskii
2024-02-08 10:47 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-10 16:29 ` Philip Kaludercic
2024-02-10 16:36 ` Eli Zaretskii
2024-02-10 16:46 ` Philip Kaludercic
2024-02-10 17:20 ` Eli Zaretskii
2024-02-10 17:40 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-10 17:47 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-10 18:03 ` Eli Zaretskii
2024-02-10 18:00 ` Eli Zaretskii
2024-02-10 18:14 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-10 19:12 ` Eli Zaretskii
2024-02-11 21:52 ` Philip Kaludercic
2024-01-18 20:47 ` Philip Kaludercic
2024-01-19 6:47 ` Eli Zaretskii
2024-01-18 20:18 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-18 20:41 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-18 23:34 ` Stefan Kangas
2024-01-19 5:49 ` Philip Kaludercic
2024-01-19 6:42 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 8:10 ` Eli Zaretskii
2024-01-11 20:24 ` Philip Kaludercic
2024-01-11 20:40 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 7:32 ` Eli Zaretskii
2024-01-12 7:38 ` Philip Kaludercic
2024-01-12 11:54 ` Eli Zaretskii
2024-01-11 10:32 ` Eli Zaretskii
2024-01-11 19:35 ` Stefan Kangas
2024-01-11 20:07 ` Philip Kaludercic
2024-01-12 7:12 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jzngw58k.fsf@daniel-mendler.de \
--to=bug-gnu-emacs@gnu.org \
--cc=66554@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=mail@daniel-mendler.de \
--cc=monnier@iro.umontreal.ca \
--cc=philipk@posteo.net \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).