branch: externals/marginalia
commit c05face289026223e800df97ae2b3ec0d22a12e6
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Improve marginalia-toggle-annotators if invoked from minibuffer
If the toggler is invoked from the minibuffer only toggle
the annotations locally. If invoked from another global context,
toggle the annotations globally.
---
marginalia.el | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index 675f19a..ee761f5 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -419,8 +419,15 @@ Remember `this-command' for annotation."
(defun marginalia-toggle-annotators ()
"Toggle between annotators in `marginalia-annotators'."
(interactive)
- (setq marginalia-annotators (append (cdr marginalia-annotators)
- (list (car marginalia-annotators)))))
+ (let ((annotators (append (cdr marginalia-annotators)
+ (list (car marginalia-annotators)))))
+ ;; If `marginalia-toggle-annotators' has been invoked from inside the
minibuffer, only change
+ ;; the annotators locally. This is useful if the command is used as an
action. If the command is
+ ;; not triggered from inside the minibuffer, toggle the annotator
globally. Hopefully this is
+ ;; not too confusing.
+ (if (minibufferp)
+ (setq-local marginalia-annotators annotators)
+ (setq marginalia-annotators annotators))))
(provide 'marginalia)
;;; marginalia.el ends here