GNU bug report logs -
#54225
[PATCH] with-demoted-errors: Fix macroexp-warn-and-return call
Previous Next
Reported by: Kyle Meyer <kyle <at> kyleam.com>
Date: Thu, 3 Mar 2022 03:01:01 UTC
Severity: normal
Tags: moreinfo, patch
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54225 in the body.
You can then email your comments to 54225 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
lomov.vl <at> yandex.ru, bug-gnu-emacs <at> gnu.org
:
bug#54225
; Package
emacs
.
(Thu, 03 Mar 2022 03:01:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Kyle Meyer <kyle <at> kyleam.com>
:
New bug report received and forwarded. Copy sent to
lomov.vl <at> yandex.ru, bug-gnu-emacs <at> gnu.org
.
(Thu, 03 Mar 2022 03:01:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The macroexp-warn-and-return call added to with-demoted-errors in
d52c929e31f (2022-02-04) is incorrect. The with-demoted-errors format
string is passed as MSG, the actual message is passed as FORM, and the
form is passed as CATEGORY, leading to with-demoted-errors returning
"Missing format argument".
* lisp/subr.el (with-demoted-errors): Call macroexp-warn-and-return
with correct arguments.
---
lisp/subr.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/subr.el b/lisp/subr.el
index eb9af0b36da..7dde7589dd9 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4560,7 +4560,7 @@ with-demoted-errors
(if (eq orig-body body) exp
;; The use without `format' is obsolete, let's warn when we bump
;; into any such remaining uses.
- (macroexp-warn-and-return format "Missing format argument" exp))))
+ (macroexp-warn-and-return "Missing format argument" exp))))
(defmacro combine-after-change-calls (&rest body)
"Execute BODY, but don't call the after-change functions till the end.
base-commit: 543640628607ec06e9698cc50c33497ca75155a4
--
2.34.0
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54225
; Package
emacs
.
(Thu, 03 Mar 2022 14:37:03 GMT)
Full text and
rfc822 format available.
Message #8 received at 54225 <at> debbugs.gnu.org (full text, mbox):
Kyle Meyer <kyle <at> kyleam.com> writes:
> The macroexp-warn-and-return call added to with-demoted-errors in
> d52c929e31f (2022-02-04) is incorrect. The with-demoted-errors format
> string is passed as MSG, the actual message is passed as FORM, and the
> form is passed as CATEGORY, leading to with-demoted-errors returning
> "Missing format argument".
>
> * lisp/subr.el (with-demoted-errors): Call macroexp-warn-and-return
> with correct arguments.
[...]
> - (macroexp-warn-and-return format "Missing format argument" exp))))
> + (macroexp-warn-and-return "Missing format argument" exp))))
The code flow in with-demoted-errors is pretty confusing. Can it be
improved upon instead of tweaked this way? (`format' here will be
"Error: %S" at least in some cases, I guess?)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) moreinfo.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Thu, 03 Mar 2022 14:37:03 GMT)
Full text and
rfc822 format available.
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Thu, 03 Mar 2022 15:15:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Kyle Meyer <kyle <at> kyleam.com>
:
bug acknowledged by developer.
(Thu, 03 Mar 2022 15:15:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 54225-done <at> debbugs.gnu.org (full text, mbox):
Kyle Meyer [2022-03-02 22:00:35] wrote:
> The macroexp-warn-and-return call added to with-demoted-errors in
> d52c929e31f (2022-02-04) is incorrect. The with-demoted-errors format
> string is passed as MSG, the actual message is passed as FORM, and the
> form is passed as CATEGORY, leading to with-demoted-errors returning
> "Missing format argument".
>
> * lisp/subr.el (with-demoted-errors): Call macroexp-warn-and-return
> with correct arguments.
> ---
> lisp/subr.el | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/subr.el b/lisp/subr.el
> index eb9af0b36da..7dde7589dd9 100644
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -4560,7 +4560,7 @@ with-demoted-errors
> (if (eq orig-body body) exp
> ;; The use without `format' is obsolete, let's warn when we bump
> ;; into any such remaining uses.
> - (macroexp-warn-and-return format "Missing format argument" exp))))
> + (macroexp-warn-and-return "Missing format argument" exp))))
>
> (defmacro combine-after-change-calls (&rest body)
> "Execute BODY, but don't call the after-change functions till the end.
>
> base-commit: 543640628607ec06e9698cc50c33497ca75155a4
Thanks. I used the patch below, instead.
Stefan
diff --git a/lisp/subr.el b/lisp/subr.el
index eb9af0b36da..2321765f953 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4560,7 +4560,7 @@ with-demoted-errors
(if (eq orig-body body) exp
;; The use without `format' is obsolete, let's warn when we bump
;; into any such remaining uses.
- (macroexp-warn-and-return format "Missing format argument" exp))))
+ (macroexp-warn-and-return "Missing format argument" exp nil nil format))))
(defmacro combine-after-change-calls (&rest body)
"Execute BODY, but don't call the after-change functions till the end.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54225
; Package
emacs
.
(Fri, 04 Mar 2022 00:23:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 54225 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> The code flow in with-demoted-errors is pretty confusing. Can it be
> improved upon instead of tweaked this way?
Yesterday I dealt with that, and I think I understood most parts: the
code is a bit ugly but necessarily because the semantics are (also
necessarily due to backwards compatibility). The cases to be supported
are:
- FORMAT is a string (and BODY not empty) - the expected use case
- FORMAT is nil: that's equivalent to FORMAT being "Error: %S"
- Anything else: also use the above default format string but
additionally add that sexp to the BODY since it's expected to be code
(backwards compatibility). It works but you get a warning.
Once the third case will not be supported any more the code can be made
much simpler.
Michael.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 01 Apr 2022 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 231 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.