[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 42df9609d5: compat-28: Add macroexp-warn-and-ret
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 42df9609d5: compat-28: Add macroexp-warn-and-return |
Date: |
Sat, 14 Jan 2023 14:57:24 -0500 (EST) |
branch: externals/compat
commit 42df9609d53ee5be5bed0cebf8f4ea78ab4c5468
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
compat-28: Add macroexp-warn-and-return
---
NEWS.org | 1 +
compat-28.el | 10 ++++++++++
compat-tests.el | 3 +++
compat.texi | 7 +++++--
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/NEWS.org b/NEWS.org
index 5d597fce19..fdd04f6989 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -3,6 +3,7 @@
* Development
- compat-27: Add generalized variables for ~decoded-time-*~.
+- compat-28: Add ~macroexp-warn-and-return~.
* Release of "Compat" Version 29.1.1.1
diff --git a/compat-28.el b/compat-28.el
index db5a2c70c7..ebcb68a348 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -738,6 +738,16 @@ where the mouse button is clicked to find a thing nearby."
;;;; Defined in macroexp.el
+(compat-defun macroexp-warn-and-return (msg form &optional _category
_compile-only _arg) ;; <OK>
+ "Return code equivalent to FORM labeled with warning MSG.
+CATEGORY is the category of the warning, like the categories that
+can appear in `byte-compile-warnings'.
+COMPILE-ONLY non-nil means no warning should be emitted if the code
+is executed without being compiled first.
+ARG is a symbol (or a form) giving the source code position for the message.
+It should normally be a symbol with position and it defaults to FORM."
+ (macroexp--warn-and-return msg form))
+
(compat-defun macroexp-file-name () ;; <OK>
"Return the name of the file from which the code comes.
Returns nil when we do not know.
diff --git a/compat-tests.el b/compat-tests.el
index bc6386e207..4e3edd2453 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -2085,6 +2085,9 @@
(ert-deftest macroexp-file-name ()
(should-equal (file-name-nondirectory (compat-tests--filename))
"compat-tests.el"))
+(ert-deftest macroexp-warn-and-return ()
+ (should-equal (macroexp-warn-and-return "test warning" '(some form)) '(some
form)))
+
(ert-deftest macroexpand-1 ()
(should-equal '(if a b c) (macroexpand-1 '(if a b c)))
(should-equal '(if a (progn b)) (macroexpand-1 '(when a b)))
diff --git a/compat.texi b/compat.texi
index 4066114c8d..8025fc123e 100644
--- a/compat.texi
+++ b/compat.texi
@@ -1769,6 +1769,11 @@ Return the name of the file in which the code is
currently being
evaluated, or @code{nil} if it cannot be determined.
@end defun
+@c based on lisp/emacs-lisp/macroexp.el
+@defun macroexp-warn-and-return msg form &optional category compile-only arg
+Return code equivalent to @code{form} labeled with warning @code{msg}.
+@end defun
+
@c copied from on lispref/os.texi
@defmac with-environment-variables variables body@dots{}
This macro sets the environment variables according to @var{variables}
@@ -1983,8 +1988,6 @@ Support for the @code{natnum} defcustom type.
@item
The function @code{macroexp-compiling-p}.
@item
-The function @code{macroexp-warn-and-return}.
-@item
Additional Edebug keywords.
@item
Shorthand support.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/compat 42df9609d5: compat-28: Add macroexp-warn-and-return,
ELPA Syncer <=