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

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

[elpa] externals/marginalia c05face 042/241: Improve marginalia-toggle-a


From: Stefan Monnier
Subject: [elpa] externals/marginalia c05face 042/241: Improve marginalia-toggle-annotators if invoked from minibuffer
Date: Fri, 28 May 2021 20:48:53 -0400 (EDT)

branch: externals/marginalia
commit c05face289026223e800df97ae2b3ec0d22a12e6
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    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



reply via email to

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