GNU bug report logs -
#77834
[PATCH] Improve help-fns-edit-variable for Lisp editing
Previous Next
Full log
View this message in rfc822 format
Spencer Baugh <sbaugh <at> janestreet.com> writes:
[...]
> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
> index 0eb0a7a40be..7a0bc2908e9 100644
> --- a/lisp/help-fns.el
> +++ b/lisp/help-fns.el
> @@ -1561,11 +1561,20 @@ help-fns-edit-variable
> (let ((var (get-text-property (point) 'help-fns--edit-variable)))
> (unless var
> (error "No variable under point"))
> - (let ((str (read-string-from-buffer
> - (format ";; Edit the `%s' variable." (nth 0 var))
> - (prin1-to-string (nth 1 var)))))
> - (set (nth 0 var) (read str))
> - (revert-buffer))))
> + (string-edit
> + (format ";; Edit the `%s' variable." (nth 0 var))
> + (prin1-to-string (nth 1 var))
> + (lambda (edited)
> + (set (nth 0 var) edited)
> + (exit-recursive-edit))
> + :abort-callback
> + (lambda ()
> + (exit-recursive-edit)
> + (error "Aborted edit, variable unchanged"))
> + :major-mode #'emacs-lisp-mode
> + :read #'read)
> + (recursive-edit)
> + (revert-buffer)))
I don't remember the details here anymore, but why do you need the
`recursive-edit' and `exit-recursive-edit'? Shouldn't `string-edit'
take care of this instead of the caller?
[...]
This bug report was last modified 24 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.