]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove "erc-" prefixed Compat definitions
authorF. Jason Park <jp@neverwas.me>
Fri, 16 Feb 2024 04:17:20 +0000 (20:17 -0800)
committerEshel Yaron <me@eshelyaron.com>
Sat, 17 Feb 2024 13:02:33 +0000 (14:02 +0100)
* lisp/erc/erc-compat.el: Remove NO-ERROR argument from top-level
`require' for library `compat' because it's guaranteed to be present.
(erc-compat-function, erc-compat-call): Redefine as obsolete aliases
for unprefixed namesakes.
* lisp/erc/erc-fill.el (erc-fill-wrap-nudge): Use `compat-call'
instead of `erc-compat-call'.

(cherry picked from commit e288e1b2f352952e826727967a406c8675fd5594)

lisp/erc/erc-compat.el
lisp/erc/erc-fill.el

index 9b8699f694907897770f8c42fcb023bf46c13b97..b5b8fbaf8ab9ca45d51962b9a04bd88c91517824 100644 (file)
 
 ;;; Code:
 
-(require 'compat nil 'noerror)
+(require 'compat)
 (eval-when-compile (require 'cl-lib))
 
-;; Except for the "erc-" namespacing, these two definitions should be
-;; continuously updated to match the latest upstream ones verbatim.
-;; Although they're pretty simple, it's likely not worth checking for
-;; and possibly deferring to the non-prefixed versions.
-;;
-;; BEGIN Compat macros
-
-;;;; Macros for extended compatibility function calls
-
-(defmacro erc-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)))
-
-(defmacro erc-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)))
-
-;; END Compat macros
+(define-obsolete-function-alias 'erc-compat-function #'compat-function "30.1")
+(define-obsolete-function-alias 'erc-compat-call #'compat-call "30.1")
 
 ;;;###autoload(autoload 'erc-define-minor-mode "erc-compat")
 (define-obsolete-function-alias 'erc-define-minor-mode
index b91ce007087257f239b3318d222a9914505f2a36..547b3a11043c631874c37d2df7240f1ac532c2fd 100644 (file)
@@ -832,7 +832,7 @@ decorations applied by third-party modules."
          (line (count-screen-lines (window-start) (window-point))))
     (when (zerop arg)
       (setq arg 1))
-    (erc-compat-call
+    (compat-call
      set-transient-map
      (let ((map (make-sparse-keymap)))
        (dolist (key '(?= ?- ?0))