GNU bug report logs -
#78530
31.0.50; [PATCH] eglot-code-action-suggestion doesn't call the callback function in the original buffer
Previous Next
Full log
View this message in rfc822 format
Ping! João, any comments or suggestions?
> Cc: 78530 <at> debbugs.gnu.org
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Thu, 22 May 2025 18:00:09 -0700
>
> > On May 22, 2025, at 2:28 AM, João Távora <joaotavora <at> gmail.com> wrote:
> >
> > Ok,
> >
> > To understand exactly what you mean, just show a patch to eldoc.el. Even though I'm not directly maintaining it anymore lately, I can look at it.
>
> Something like this. This way, documentation functions don’t need to worry about running the callback in the original buffer.
>
> Yuan
>
>
> From a8145feaee2491718d06f725da8624c251895e29 Mon Sep 17 00:00:00 2001
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Thu, 22 May 2025 17:57:37 -0700
> Subject: [PATCH] Eldoc: Run eldoc-display-functions with original buffer
> (bug#78530)
>
> * lisp/emacs-lisp/eldoc.el (eldoc--invoke-strategy): Run the
> hook with the original buffer as the current buffer. This way
> we're certain that the buffer-local value of
> 'eldoc-display-functions' is used.
> ---
> lisp/emacs-lisp/eldoc.el | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
> index 9e193580106..3d8202c34fa 100644
> --- a/lisp/emacs-lisp/eldoc.el
> +++ b/lisp/emacs-lisp/eldoc.el
> @@ -896,7 +896,8 @@ eldoc--invoke-strategy
> (want 0)
> ;; The doc strings and corresponding options registered so
> ;; far.
> - (docs-registered '()))
> + (docs-registered '())
> + (orig-buffer (current-buffer)))
> (cl-labels
> ((register-doc
> (pos string plist origin)
> @@ -905,12 +906,13 @@ eldoc--invoke-strategy
> docs-registered)))
> (display-doc
> ()
> - (run-hook-with-args
> - 'eldoc-display-functions (mapcar #'cdr
> - (setq docs-registered
> - (sort docs-registered
> - (lambda (a b) (< (car a) (car b))))))
> - interactive))
> + (with-current-buffer orig-buffer
> + (run-hook-with-args
> + 'eldoc-display-functions (mapcar #'cdr
> + (setq docs-registered
> + (sort docs-registered
> + (lambda (a b) (< (car a) (car b))))))
> + interactive)))
> (make-callback
> (method origin)
> (let ((pos (prog1 howmany (cl-incf howmany))))
> --
> 2.39.5 (Apple Git-154)
>
This bug report was last modified 6 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.