Subject: bug#79225: 30.1; Success and abort callbacks are shared across different invocations of string-edit

From: Piyush Srivastava <[email-masked]>
Date: Tue, 12 Aug 2025 12:28:05 +0530

The function `string-edit' uses variables
`string-edit--success-callback' and `string-edit--abort-callback' to
store callbacks to be called on successful completion and abort
respectively.  However, these variables are declared using `defvar' and
not using `defvar-local', so it looks like they are shared across
different concurrent invocations of `string-edit' (e.g., if, while a
`string-edit' buffer is active, a user goes to another buffer and
invokes another command calling `read-string-from-buffer' from that
buffer).   Is this the intended behaviour?

In GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
 cairo version 1.18.0) of 2025-02-25 built on OptiPlex-7440-AIO
Windowing system distributor 'The X.Org Foundation', version 11.0.12302006
System Description: Ubuntu 24.04.2 LTS

Configured using:
 'configure --with-prefix=/usr/local --with-native-compilation
 --with-modules'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: en_IN.UTF-8
  value of $LC_NUMERIC: en_IN.UTF-8
  value of $LC_TIME: en_IN.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  whitespace-mode: t
  which-key-mode: t
  projectile-mode: t
  electric-pair-mode: t
  fido-vertical-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  fido-mode: t
  server-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/piyushs/.config/emacs/elpa/magit-4.3.0/magit-autorevert hides /home/piyushs/.config/emacs/elpa/magit-section-4.3.0/magit-autorevert
/home/piyushs/.config/emacs/elpa/transient-0.8.4/transient hides /usr/local/share/emacs/30.1/lisp/transient

Features:
(shadow sort mail-extr reporter emacsbug pcmpl-unix edebug cl-print
jka-compr slime-tests ert ewoc debug backtrace slime etags fileloop
arc-mode archive-mode hyperspec hippie-exp string-edit gptel-bedrock
gptel-gh gptel-org gptel-rewrite gptel-transient gptel-gemini
gptel-ollama cus-start gptel gptel-openai vc-hg vc-bzr vc-src vc-sccs
vc-cvs vc-rcs log-view bug-reference flyspell magit-extras face-remap
magit-submodule magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff git-commit log-edit pcvs-util add-log magit-core
magit-autorevert autorevert filenotify magit-margin magit-transient
magit-process with-editor magit-mode transient benchmark magit-git
magit-base magit-section cursor-sensor crm llama mm-archive message
sendmail yank-media rfc822 mml mml-sec epa mailabbrev gmm-utils
mailheader mm-decode mm-bodies mm-encode package-vc vc lisp-mnt gnutls
network-stream url-cache url-http url-auth mail-parse rfc2231 rfc2047
rfc2045 ietf-drums url-gw nsm puny epg rfc6068 epg-config
display-line-numbers mode-local tramp-cache time-stamp tramp-sh shortdoc
ess-tracebug comp comp-cstr warnings ess-utils ess-custom tramp trampver
tramp-integration files-x tramp-message tramp-compat shell
tramp-loaddefs help-fns radix-tree misearch multi-isearch dired-aux
ps-my-utils cal-islam holidays holiday-loaddefs mule-util cal-move
vc-git diff-mode track-changes vc-dispatcher beancount derived apropos
xref comp-run comp-common disp-table whitespace quail ag vc-svn
find-dired dired dired-loaddefs skeleton ibuf-macs which-key projectile
grep ibuf-ext ibuffer ibuffer-loaddefs org-attach org-protocol org-crypt
org-datetree org-habit org-agenda org-element org-persist xdg org-id
org-refile org-element-ast inline avl-tree generator ob-haskell ob-R
ob-python python project gnus nnheader gnus-util mail-utils range
mm-util mail-prsvr ispell howm-markdown citeproc citeproc-itemgetters
parsebib citeproc-cite citeproc-biblatex citeproc-bibtex ol-bibtex org
ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script
smie treesit executable ob-comint org-pcomplete pcomplete org-list
org-footnote org-faces org-entities noutline outline ob-emacs-lisp
ob-core ob-eval org-cycle org-table ol rx org-fold org-fold-core
org-keys oc org-loaddefs find-func cal-menu calendar cal-loaddefs
org-version org-compat org-macs format-spec bibtex parse-time iso8601
time-date citeproc-subbibs citeproc-sort citeproc-name
citeproc-formatters citeproc-proc citeproc-disamb citeproc-itemdata
citeproc-generic-elements citeproc-macro citeproc-choose citeproc-date
citeproc-number rst compile text-property-search comint ansi-osc
ansi-color ring citeproc-context citeproc-prange citeproc-style
citeproc-locale citeproc-term f citeproc-rt citeproc-lib citeproc-s
thingatpt compat s let-alist queue dash elec-pair notifications dbus xml
finder-inf use-package-ensure icomplete modus-vivendi-theme modus-themes
server edmacro kmacro cus-edit pp cus-load wid-edit cl-extra help-mode
use-package-bind-key bind-key easy-mmode use-package-core
ada-mode-autoloads ag-autoloads auctex-autoloads tex-site
cdlatex-autoloads citeproc-autoloads company-autoloads elfeed-autoloads
ess-autoloads flycheck-autoloads gnat-compiler-autoloads gptel-autoloads
haskell-mode-autoloads howm-autoloads htmlize-autoloads
lean4-mode-autoloads lsp-mode-autoloads ht-autoloads f-autoloads
lv-autoloads magit-autoloads pcase magit-section-autoloads
llama-autoloads markdown-mode-autoloads parsebib-autoloads
projectile-autoloads queue-autoloads s-autoloads slime-autoloads
macrostep-autoloads speed-type-autoloads dash-autoloads
spinner-autoloads string-inflection-autoloads stylus-mode-autoloads
tmr-autoloads transient-autoloads uniquify-files-autoloads
wisi-autoloads info with-editor-autoloads yasnippet-snippets-autoloads
yasnippet-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs icons password-cache json subr-x map byte-opt
gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page tab-bar
menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 903799 1968635) (symbols 48 48925 19) (strings 32 253930 118628)
 (string-bytes 1 10201886) (vectors 16 89901) (vector-slots 8 1848710 586934)
 (floats 8 446 66591) (intervals 56 4329 5321) (buffers 992 26))