Function: compat-call
compat-call is a macro defined in compat.el.
Signature
(compat-call FUN &rest ARGS)
Documentation
Call compatibility function or macro FUN with ARGS.
A good example function is plist-get which was extended with an
additional predicate argument in Emacs 29.1. The compatibility
function, which supports this additional argument, can be
obtained via (compat-function plist-get) and called
via (compat-call plist-get plist prop predicate). It is not
possible to directly call (plist-get plist prop predicate) on
Emacs older than 29.1, since the original plist-get function
does not yet support the predicate argument. Note that the
Compat library never overrides existing functions.
See also compat-function to lookup compatibility functions.
Source Code
;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat.el
(defmacro compat-call (fun &rest args)
"Call compatibility function or macro FUN with ARGS.
A good example function is `plist-get' which was extended with an
additional predicate argument in Emacs 29.1. The compatibility
function, which supports this additional argument, can be
obtained via (compat-function plist-get) and called
via (compat-call plist-get plist prop predicate). It is not
possible to directly call (plist-get plist prop predicate) on
Emacs older than 29.1, since the original `plist-get' function
does not yet support the predicate argument. Note that the
Compat library never overrides existing functions.
See also `compat-function' to lookup compatibility functions."
(let ((compat (intern (format "compat--%s" fun))))
`(,(if (fboundp compat) compat fun) ,@args)))