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

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

[elpa] externals/compat 52c16805b4 4/5: Disallow :prefix and :realname f


From: ELPA Syncer
Subject: [elpa] externals/compat 52c16805b4 4/5: Disallow :prefix and :realname for compat-defvar
Date: Tue, 3 Jan 2023 11:57:27 -0500 (EST)

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

    Disallow :prefix and :realname for compat-defvar
---
 compat-macs.el | 60 ++++++++++++++++++++++++++++------------------------------
 1 file changed, 29 insertions(+), 31 deletions(-)

diff --git a/compat-macs.el b/compat-macs.el
index 377daf06d1..463231ea36 100644
--- a/compat-macs.el
+++ b/compat-macs.el
@@ -225,37 +225,35 @@ local with a value of `permanent' or just buffer local 
with any
 non-nil value."
   (declare (debug (name form stringp [&rest keywordp sexp]))
            (doc-string 3) (indent 2))
-  ;; Check if we want an explicitly prefixed function
-  (let ((oldname name))
-    (when (plist-get attr :prefix)
-      (setq name (intern (format "compat-%s" name))))
-    (funcall compat--generate-function
-     name
-     (lambda (realname version)
-       (let ((localp (plist-get attr :local)))
-         `(progn
-            (,(if (plist-get attr :constant) 'defconst 'defvar)
-             ,realname ,initval
-             ;; Prepend compatibility notice to the actual
-             ;; documentation string.
-             ,(if version
-                  (format
-                   "[Compatibility variable for `%S', defined in Emacs 
%s]\n\n%s"
-                   oldname version docstring)
-                (format
-                 "[Compatibility variable for `%S']\n\n%s"
-                 oldname docstring)))
-            ;; Make variable as local if necessary
-            ,(cond
-              ((eq localp 'permanent)
-               `(put ',realname 'permanent-local t))
-              (localp
-               `(make-variable-buffer-local ',realname))))))
-     (lambda (realname _version)
-       `(defvaralias ',name ',realname))
-     (lambda ()
-       `(not (boundp ',name)))
-     attr 'variable)))
+  (when (or (plist-get attr :prefix) (plist-get attr :realname))
+    (error ":prefix cannot be specified for compatibility variables"))
+  (funcall compat--generate-function
+           name
+           (lambda (realname version)
+             (let ((localp (plist-get attr :local)))
+               `(progn
+                  (,(if (plist-get attr :constant) 'defconst 'defvar)
+                   ,realname ,initval
+                   ;; Prepend compatibility notice to the actual
+                   ;; documentation string.
+                   ,(if version
+                        (format
+                         "[Compatibility variable for `%S', defined in Emacs 
%s]\n\n%s"
+                         name version docstring)
+                      (format
+                       "[Compatibility variable for `%S']\n\n%s"
+                       name docstring)))
+                  ;; Make variable as local if necessary
+                  ,(cond
+                    ((eq localp 'permanent)
+                     `(put ',realname 'permanent-local t))
+                    (localp
+                     `(make-variable-buffer-local ',realname))))))
+           (lambda (realname _version)
+             `(defvaralias ',name ',realname))
+           (lambda ()
+             `(not (boundp ',name)))
+           attr 'variable))
 
 (provide 'compat-macs)
 ;;; compat-macs.el ends here



reply via email to

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