emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat f718081748 2/5: Deprecate all prefixed functions


From: ELPA Syncer
Subject: [elpa] externals/compat f718081748 2/5: Deprecate all prefixed functions
Date: Tue, 3 Jan 2023 14:57:28 -0500 (EST)

branch: externals/compat
commit f71808174871c32e604326cec890dbd9fb231f02
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Deprecate all prefixed functions
---
 compat-macs.el | 76 ++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 48 insertions(+), 28 deletions(-)

diff --git a/compat-macs.el b/compat-macs.el
index 02ea7e03ba..0fe1b6be84 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -147,36 +147,56 @@ attributes (see `compat--generate-function')."
     (funcall compat--generate-function
      name
      (lambda (realname version)
-       `(,(cond
-           ((eq type 'function) 'defun)
-           ((eq type 'macro) 'defmacro)
-           ((error "Unknown type")))
-         ,realname ,arglist
-         ;; Prepend compatibility notice to the actual
-         ;; documentation string.
-         ,(with-temp-buffer
-            (insert docstring)
-            (newline 2)
-            (insert
-             "[Compatibility "
-             (if version
-                 (format
-                  "%s for `%S', defined in Emacs %s.  \
-If this is not documented on your system, you can check \
+       `(progn
+          (,(cond
+             ((eq type 'function) 'defun)
+             ((eq type 'macro) 'defmacro)
+             ((error "Unknown type")))
+           ,(if (plist-get rest :prefix)
+                (intern (format "compat--explicit-%s" oldname))
+              realname)
+           ,arglist
+           ;; Prepend compatibility notice to the actual
+           ;; documentation string.
+           ,(with-temp-buffer
+              (insert docstring)
+              (newline 2)
+              (insert
+               "[Compatibility "
+               (if version
+                   (format
+                    "%s for `%S', defined in Emacs %s.  \
+If this is not documented on yourself system, you can check \
 `(compat) Emacs %s' for more details."
-                  type oldname version version)
-               (format
-                "code %s for `%S'"
-                type oldname))
-             "]")
-            (let ((fill-column 80))
-              (fill-region (point-min) (point-max)))
-            (buffer-string))
-         ,@body))
+                    type oldname version version)
+                 (format
+                  "code %s for `%S'"
+                  type oldname))
+               "]")
+              (let ((fill-column 80))
+                (fill-region (point-min) (point-max)))
+              (buffer-string))
+           ,@body)
+          ,@(and (plist-get rest :prefix)
+                 (message "COMPAT realname=%S name=%S oldname=%S" realname 
name oldname)
+                 (if (string= realname name)
+                     `((defalias ',name ',(intern (format 
"compat--explicit-%s" oldname)))
+                       (make-obsolete
+                        ',name
+                        "Use `compat-funcall' or `compat-function' instead"
+                        "29.1"))
+                   `((defalias ',realname #',(intern (format 
"compat--explicit-%s" oldname))))))))
      (lambda (realname _version)
-         ;; Functions and macros are installed by aliasing the name of the
-         ;; compatible function to the name of the compatibility function.
-       `(defalias ',name #',realname))
+       ;; Functions and macros are installed by aliasing the name of the
+       ;; compatible function to the name of the compatibility function.
+       (if (and (plist-get rest :prefix) (string= realname oldname))
+           `(progn
+              (defalias ',name ',realname)
+              (make-obsolete
+               ',name
+               "Use `compat-funcall' or `compat-function' instead"
+               "29.1"))
+         `(defalias ',name #',realname)))
      (lambda ()
        `(not (fboundp ',name)))
      rest)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]