From 0d0af8a0a291aec409992bfcdae06dc36e2634b4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 25 Dec 2019 20:27:17 -0500 Subject: [PATCH] Strip out advice in command docstrings --- which-key.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/which-key.el b/which-key.el index 1da0cfb019e..74de73741ea 100644 --- a/which-key.el +++ b/which-key.el @@ -1671,7 +1671,12 @@ and `which-key-show-docstrings' is non-nil. If return the docstring." (let* ((orig-sym (intern original)) (doc (when (commandp orig-sym) - (documentation orig-sym))) + (string-trim-left + (documentation orig-sym) + (concat "\\(?::" + "\\(?:\\(?:after\\|before\\)\\(?:-\\(?:until\\|while\\)\\)?\\|around\\|override\\|filter-\\(?:args\\|return\\)\\)" + " advice: [^\n]+\n" + "\\)+\n")))) (docstring (when doc (which-key--propertize (car (split-string doc "\n")) 'face 'which-key-docstring-face))))