GNU bug report logs -
#35663
27.0.50; Eldoc support for apply
Previous Next
To reply to this bug, email your comments to 35663 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Fri, 10 May 2019 00:12:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Michael Heerdegen <michael_heerdegen <at> web.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 10 May 2019 00:12:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hello,
when editing something like
(apply #'call-process
(car command)
nil
(if stderr-file (list t stderr-file) t)
nil
(append (cdr command) (list archive name)))
eldoc support would be useful to see the argument names of
'call-process' instead of the signature of 'apply'.
Would doing something like this be acceptable?
[0001-WIP-Make-eldoc-handle-apply-specially.patch (text/x-diff, inline)]
From 5eb45fe4a22bb8d130e5318335439b11ef00623b Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen <at> web.de>
Date: Fri, 10 May 2019 02:00:18 +0200
Subject: [PATCH] WIP: Make eldoc handle 'apply' specially
---
lisp/progmodes/elisp-mode.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index cb1b17b447..7631bc60b1 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1356,6 +1356,16 @@ elisp-eldoc-documentation-function
((eq current-symbol (car current-fnsym))
(or (apply #'elisp-get-fnsym-args-string current-fnsym)
(elisp-get-var-docstring current-symbol)))
+ ((and (memq (car current-fnsym) '(apply apply-partially))
+ (< 1 (cadr current-fnsym))
+ (let ((args (save-excursion
+ (let ((argument-index (- (elisp--beginning-of-sexp) 2)))
+ (forward-sexp)
+ (save-match-data
+ (and (looking-at (rx (* (or space "\n")) (or "`" "'" "#'")))
+ (goto-char (match-end 0))
+ (list (elisp--current-symbol) argument-index)))))))
+ (and args (apply #'elisp-get-fnsym-args-string args)))))
(t
(or (elisp-get-var-docstring current-symbol)
(apply #'elisp-get-fnsym-args-string current-fnsym))))))
--
2.20.1
[Message part 3 (text/plain, inline)]
We could also make the displayed text more special to show that this is
actually an 'apply' call and handle the last argument specially but I
think it would be overkill to add so much code for this side case. OTOH
the suggested patch above already feels like a big relief.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Fri, 10 May 2019 00:59:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 35663 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> Hello,
>
> when editing something like
>
> (apply #'call-process
> (car command)
> nil
> (if stderr-file (list t stderr-file) t)
> nil
> (append (cdr command) (list archive name)))
>
> eldoc support would be useful to see the argument names of
> 'call-process' instead of the signature of 'apply'.
Yes, I've kind of wanted something like this for a while.
> + ((and (memq (car current-fnsym) '(apply apply-partially))
funcall too please? :)
> We could also make the displayed text more special to show that this is
> actually an 'apply' call and handle the last argument specially but I
> think it would be overkill to add so much code for this side case.
Yeah, and I doubt any sort of eldoc display would be of much use for the
last apply arg anyway.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Fri, 10 May 2019 10:25:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 35663 <at> debbugs.gnu.org (full text, mbox):
Noam Postavsky <npostavs <at> gmail.com> writes:
> > + ((and (memq (car current-fnsym) '(apply apply-partially))
>
> funcall too please? :)
Why would you want to write something like (funcall #'fun arg ...) when
FUN is a symbol?
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Fri, 10 May 2019 10:29:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 35663 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> Noam Postavsky <npostavs <at> gmail.com> writes:
>
>> > + ((and (memq (car current-fnsym) '(apply apply-partially))
>>
>> funcall too please? :)
>
> Why would you want to write something like (funcall #'fun arg ...) when
> FUN is a symbol?
Hmm, maybe I mixed this is up with stepping into funcall/apply with
edebug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Fri, 10 May 2019 11:42:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 35663 <at> debbugs.gnu.org (full text, mbox):
Noam Postavsky <npostavs <at> gmail.com> writes:
> Hmm, maybe I mixed this is up with stepping into funcall/apply with
> edebug.
Probably. We should also fix this. I currently use this hack as
workaround:
(advice-add
'edebug-instrument-callee :around
(defun my-edebug-instrument-callee--around-ad (f)
(condition-case nil
(funcall f)
(error
(when (y-or-n-p "edebug-instrument-callee error - select a function by name?")
(edebug-instrument-function
(intern
(completing-read
"Function to instrument: " obarray #'fboundp t
(when (looking-at "\(\\(?:funcall\\|apply\\|funcall-interactively\\) +\\(?:#?'\\)?\\(\\(?:\\sw\\|\\s_\\)+\\)[ \)]")
(match-string 1))))))))))
I guess in unambiguous cases we can even omit prompting.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Wed, 26 Aug 2020 10:33:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 35663 <at> debbugs.gnu.org (full text, mbox):
Michael Heerdegen <michael_heerdegen <at> web.de> writes:
> when editing something like
>
> (apply #'call-process
> (car command)
> nil
> (if stderr-file (list t stderr-file) t)
> nil
> (append (cdr command) (list archive name)))
>
> eldoc support would be useful to see the argument names of
> 'call-process' instead of the signature of 'apply'.
Yeah, that would be really nice... Some people might want to know what
the signature to apply is, though, but probably a lot fewer.
> @@ -1356,6 +1356,16 @@ elisp-eldoc-documentation-function
> ((eq current-symbol (car current-fnsym))
> (or (apply #'elisp-get-fnsym-args-string current-fnsym)
> (elisp-get-var-docstring current-symbol)))
> + ((and (memq (car current-fnsym) '(apply apply-partially))
> + (< 1 (cadr current-fnsym))
> + (let ((args (save-excursion
[...]
The patch no longer applies, because eldoc has been rewritten
substantially over the last year. Is there any interest in resurrecting
this patch and getting it applied? I've added João to the Cc.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Wed, 26 Aug 2020 11:13:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 35663 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
I think this makes sense. SLY/SLIME for CL do something similar
with #'make-instance, for instance. As soon as you type the function name
or class name and the autodoc system recognizes it, it switches to the
showing you the args for that function instead.
The patch shouldn't be terribly difficult to adapt, since I've not
significantly
touched the client-side logic (as in clients of eldoc).
I think you can try doing so. I'll keep this on my radar,
João
On Wed, Aug 26, 2020 at 11:32 AM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>
> > when editing something like
> >
> > (apply #'call-process
> > (car command)
> > nil
> > (if stderr-file (list t stderr-file) t)
> > nil
> > (append (cdr command) (list archive name)))
> >
> > eldoc support would be useful to see the argument names of
> > 'call-process' instead of the signature of 'apply'.
>
> Yeah, that would be really nice... Some people might want to know what
> the signature to apply is, though, but probably a lot fewer.
>
> > @@ -1356,6 +1356,16 @@ elisp-eldoc-documentation-function
> > ((eq current-symbol (car current-fnsym))
> > (or (apply #'elisp-get-fnsym-args-string current-fnsym)
> > (elisp-get-var-docstring current-symbol)))
> > + ((and (memq (car current-fnsym) '(apply apply-partially))
> > + (< 1 (cadr current-fnsym))
> > + (let ((args (save-excursion
>
> [...]
>
> The patch no longer applies, because eldoc has been rewritten
> substantially over the last year. Is there any interest in resurrecting
> this patch and getting it applied? I've added João to the Cc.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
>
--
João Távora
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#35663
; Package
emacs
.
(Thu, 27 Aug 2020 13:08:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 35663 <at> debbugs.gnu.org (full text, mbox):
João Távora <joaotavora <at> gmail.com> writes:
> I think this makes sense. SLY/SLIME for CL do something similar
> with #'make-instance, for instance. As soon as you type the function name
> or class name and the autodoc system recognizes it, it switches to the
> showing you the args for that function instead.
>
> The patch shouldn't be terribly difficult to adapt, since I've not
> significantly touched the client-side logic (as in clients of eldoc).
I had a very brief look at adapting the patch to the new eldoc setup --
I guess the code should go into elisp-eldoc-funcall?
However, the parameters have changed somewhat, and I'm not familiar with
this code at all, so I think it would be preferable if somebody else
took a look at it.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 4 years and 355 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.