GNU bug report logs -
#76528
30; Advising functions can cause docstring to be lost
Previous Next
Full log
View this message in rfc822 format
>>> Stefan, any comments?
>>
>> Just that it's directly related to this part of the code in
>> `nadvice.el`:
>>
>> ;; FIXME: We could use a defmethod on `function-documentation' instead,
>> ;; except when (autoloadp nf)!
>> (put symbol 'function-documentation `(advice--make-docstring ',symbol))
>
> Transient (transient--wrap-command) has to advise every command that is
> invoked while the menu is active, so this has the potential to cause a
> lot of damage.
Indeed. 🙁
I guess this hasn't been noticed until now because
`function-documentation` is not used very often.
> How should I deal with that? Maybe essentially?:
Well, we should fix it in `nadvice.el`, of course. But for
compatibility with older Emacsen...
> (let ((docstr (documentation this-command))
> (advice (lambda (fn &rest args) (apply fn args))))
> (advice-add this-command :around advice)
[...]
> (advice-remove this-command advice)
> (unless (equal (documentation this-command) docstr)
> (put this-command 'function-documentation docstr)))
That sounds about right, tho you'd have to replace the `(documentation
this-command)` with `(get this-command 'function-documentation)`.
Somewhat related question: can it happen that the command (stored in
`this-command`, apparently) is not a symbol, and if so how do you
wrap it?
Stefan
This bug report was last modified 110 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.