GNU bug report logs - #71406
30.0.50; string-edit signals error when user aborts and :abort-callback parameter nil

Previous Next

Package: emacs;

Reported by: Nicholas Vollmer <nv <at> parenthetic.dev>

Date: Fri, 7 Jun 2024 03:51:03 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 71406 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicholas Vollmer <nv <at> parenthetic.dev>
Cc: 71406 <at> debbugs.gnu.org
Subject: Re: 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 <at> 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"))




This bug report was last modified 1 year and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.