]> git.eshelyaron.com Git - emacs.git/commit
Improve help-fns-edit-variable for Lisp editing
authorSpencer Baugh <sbaugh@janestreet.com>
Tue, 15 Apr 2025 21:17:27 +0000 (17:17 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 26 Apr 2025 17:36:28 +0000 (19:36 +0200)
commitd17ce33d7ae93ac34a2fe138877d30fc88f52d0c
treeae6abf423ee59debed81cbe7ccde756073d0ee2a
parent7495cd70da46bc38406113eca2417944dd6d7a0a
Improve help-fns-edit-variable for Lisp editing

Before d50c82f3e98e ("Simplify
'help-enable-variable-value-editing' using 'string-edit'"),
'help-fns-edit-variable' would open a buffer in 'emacs-lisp-mode'
and would not allow exiting that buffer with an invalid Lisp
expression.  Restore that functionality by enhancing 'string-edit'
to allow choosing a major mode and allow passing a function to
validate the buffer contents before returning.
* lisp/help-fns.el (help-fns-edit-variable): Call 'string-edit',
passing 'emacs-lisp-mode' and 'read'.
* lisp/textmodes/string-edit.el (string-edit--read): Add.
(string-edit): Add :major-mode and :read arguments and avoid
passive voice.
(read-string-from-buffer): Avoid passive voice in docs.
(string-edit-mode-map, string-edit-minor-mode-map)
(string-edit-mode, string-edit-minor-mode): Move 'string-edit'
keybindings to a minor mode.
(string-edit-done): Call 'string-edit--read' before exiting.
(Bug#77834)

(cherry picked from commit 8f58f55551341001119034f2e9f5fdc87d3abd54)
lisp/help-fns.el
lisp/textmodes/string-edit.el