emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/marginalia ef325fc 073/241: In symbol annotator skip li


From: Stefan Monnier
Subject: [elpa] externals/marginalia ef325fc 073/241: In symbol annotator skip lines about advice in function docstring
Date: Fri, 28 May 2021 20:48:59 -0400 (EDT)

branch: externals/marginalia
commit ef325fce977f4bf213a8d34f2d1c3b7b5272a983
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@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))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]