Eshel Yaron writes: > Philip Kaludercic writes: > >> Eshel Yaron writes: >> >>> I'm reopening this (hope you don't mind) to keep track of the minor >>> regressions I mentioned here: >>> >>> https://lists.gnu.org/archive/html/emacs-devel/2024-07/msg01202.html >> >> Thanks, and my apologies for the late reply. > > No problem at all. > >> The issue seems to be that (thing-at-point 'sexp) returns nil if inside >> a s-expression looking at whitespace: >> >> (1 2 3 4 5) >> ^ >> M-: (thing-at-point 'sexp) ;=> nil >> >> One idea is to fall back on a defun at point, if no sexp is found: >> >> diff --git a/lisp/help-fns.el b/lisp/help-fns.el >> index 8ea5b301684..4d55ea8bbff 100644 >> --- a/lisp/help-fns.el >> +++ b/lisp/help-fns.el >> @@ -1507,13 +1507,14 @@ help-fns-edit-variable >> "Edit the variable under point." >> (declare (completion ignore)) >> (interactive) >> - (let* ((val (thing-at-point 'sexp)) >> - (var (get-text-property 0 'help-fns--edit-variable val))) >> + (let ((val (or (thing-at-point 'sexp) >> + (thing-at-point 'defun)))) >> (unless val >> - (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))))) >> + (error "No value at point")) >> + (let* ((var (get-text-property 0 'help-fns--edit-variable val)) >> + (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))))) > > Maybe I'm missing something, but why are val and the thing-at-point call > needed at all? Simply grabbing the help-fns--edit-variable property at > point should be work as well, I think. No, I think you are right, we don't have to take the detour over 'thing-at-point', meaning that if I am not mistaken, the fix should reduce itself to: