bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#71406: 30.0.50; string-edit signals error when user aborts and :abor


From: Eli Zaretskii
Subject: bug#71406: 30.0.50; string-edit signals error when user aborts and :abort-callback parameter nil
Date: Sat, 08 Jun 2024 16:09:33 +0300

> From: Nicholas Vollmer <nv@parenthetic.dev>
> Date: Thu, 06 Jun 2024 12:03:34 -0400
> 
> 
> 1. emacs -q
> 2. eval (string-edit "test" "" #'ignore)
> 3. In the "*edit string*" buffer eval string-edit-abort.
> 
> The following error is signaled:
> 
> Debugger entered--Lisp error: (void-variable 
> string-edit--abort-callback)
>   string-edit-abort()
>   funcall-interactively(string-edit-abort)
>   command-execute(string-edit-abort)
> 
> Seeing as string-edit specifies this parameter as a &key, it 
> should either provide a default (#'ignore?) or error if the caller 
> does not provide an abort function (Though why specify it as a 
> keyword arg if it's mandatory?).

Thanks, I fixed this with the patch below.

diff --git a/lisp/textmodes/string-edit.el b/lisp/textmodes/string-edit.el
index 03be426..cafed5a 100644
--- a/lisp/textmodes/string-edit.el
+++ b/lisp/textmodes/string-edit.el
@@ -75,8 +75,7 @@ string-edit
     (setq buffer-undo-list nil)
     (string-edit-mode)
     (setq-local string-edit--success-callback success-callback)
-    (when abort-callback
-      (setq-local string-edit--abort-callback abort-callback))
+    (setq-local string-edit--abort-callback abort-callback)
     (setq-local header-line-format
                 (substitute-command-keys
                  "Type \\<string-edit-mode-map>\\[string-edit-done] when 
you've finished editing or \\[string-edit-abort] to abort"))





reply via email to

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