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

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

[elpa] externals/marginalia 668265a 211/241: Simplify setup


From: Stefan Monnier
Subject: [elpa] externals/marginalia 668265a 211/241: Simplify setup
Date: Fri, 28 May 2021 20:49:29 -0400 (EDT)

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

    Simplify setup
---
 marginalia.el | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/marginalia.el b/marginalia.el
index f99581b..4f99efb 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -793,18 +793,14 @@ Remember `this-command' for 
`marginalia-classify-by-command-name'."
 (define-minor-mode marginalia-mode
   "Annotate completion candidates with richer information."
   :global t
-
-  ;; Reset first to get a clean slate.
-  (advice-remove #'completion-metadata-get 
#'marginalia--completion-metadata-get)
-  (remove-hook 'minibuffer-setup-hook #'marginalia--minibuffer-setup)
-
-  ;; Now add our tweaks.
-  (when marginalia-mode
-    ;; Ensure that we remember this-command in order to select the annotation 
function.
-    (add-hook 'minibuffer-setup-hook #'marginalia--minibuffer-setup)
-
-    ;; Replace the metadata function.
-    (advice-add #'completion-metadata-get :before-until 
#'marginalia--completion-metadata-get)))
+  (if marginalia-mode
+      (progn
+        ;; Ensure that we remember this-command in order to select the 
annotation function.
+        (add-hook 'minibuffer-setup-hook #'marginalia--minibuffer-setup)
+        ;; Replace the metadata function.
+        (advice-add #'completion-metadata-get :before-until 
#'marginalia--completion-metadata-get))
+    (advice-remove #'completion-metadata-get 
#'marginalia--completion-metadata-get)
+    (remove-hook 'minibuffer-setup-hook #'marginalia--minibuffer-setup)))
 
 ;; If you want to cycle between annotators while being in the minibuffer, the 
completion-system
 ;; should refresh the candidate list. Currently there is no support for this 
in marginalia, but it



reply via email to

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