Function: compat-function

compat-function is a macro defined in compat.el.

Signature

(compat-function FUN)

Documentation

Return compatibility function symbol for FUN.

If the Emacs version provides a sufficiently recent version of FUN, the symbol FUN is returned itself. Otherwise the macro returns the symbol of a compatibility function which supports the behavior and calling convention of the current stable Emacs version. For example Compat 29.1 will provide compatibility functions which implement the behavior and calling convention of Emacs 29.1.

See also compat-call to directly call compatibility functions.

Source Code

;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat.el
;;;; Macros for extended compatibility function calls

(defmacro compat-function (fun)
  "Return compatibility function symbol for FUN.

If the Emacs version provides a sufficiently recent version of
FUN, the symbol FUN is returned itself.  Otherwise the macro
returns the symbol of a compatibility function which supports the
behavior and calling convention of the current stable Emacs
version.  For example Compat 29.1 will provide compatibility
functions which implement the behavior and calling convention of
Emacs 29.1.

See also `compat-call' to directly call compatibility functions."
  (let ((compat (intern (format "compat--%s" fun))))
    `#',(if (fboundp compat) compat fun)))