GNU bug report logs -
#71374
[PATCH] Simplify 'help-enable-variable-value-editing' using
Previous Next
Reported by: Philip Kaludercic <philipk <at> posteo.net>
Date: Wed, 5 Jun 2024 07:15:02 UTC
Severity: wishlist
Tags: patch
Done: Philip Kaludercic <philipk <at> posteo.net>
Bug is archived. No further changes may be made.
Full log
Message #32 received at 71374 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Eshel Yaron <me <at> eshelyaron.com> writes:
> reopen 71374
> quit
>
> Hi Philip,
>
> Philip Kaludercic <philipk <at> posteo.net> writes:
>
>> I hadn't pushed the change, have done so now. Closing the report.
>> Thanks for the reminder.
>
> 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.
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:
[Message part 2 (text/plain, inline)]
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)))))
(defun help-fns--run-describe-functions (functions &rest args)
[Message part 3 (text/plain, inline)]
Additionally, I moved the `get-text-property' after the check, to ensure
that the indented error message is used.
Comments?
>
> Thanks,
>
> Eshel
--
Philip Kaludercic on peregrine
This bug report was last modified 262 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.