branch: externals/marginalia commit ef325fce977f4bf213a8d34f2d1c3b7b5272a983 Author: Omar Antolín <omar.anto...@gmail.com> Commit: Omar Antolín <omar.anto...@gmail.com>
In symbol annotator skip lines about advice in function docstring Thanks to @purcell for reporting this. #19 --- marginalia.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/marginalia.el b/marginalia.el index f3c61d4..f83e3de 100644 --- a/marginalia.el +++ b/marginalia.el @@ -293,10 +293,21 @@ This hash table is needed to speed up `marginalia-annotate-command-binding'.") (defun marginalia-annotate-symbol (cand) "Annotate symbol CAND with its documentation string." - (marginalia--documentation - (let ((sym (intern cand))) + (when-let ((sym (intern-soft cand))) + (marginalia--documentation (cond - ((fboundp sym) (ignore-errors (documentation sym))) + ((fboundp sym) + (when-let ((doc (ignore-errors (documentation sym)))) + (replace-regexp-in-string + (rx bos + (1+ (seq "This function has " + (or ":before" ":after" ":around" ":override" + ":before-while" ":before-until" ":after-while" + ":after-until" ":filter-args" ":filter-return") + " advice: " (0+ nonl) "\n")) + "\n") + "" + doc))) ((facep sym) (documentation-property sym 'face-documentation)) (t (documentation-property sym 'variable-documentation))))))