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

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

[nongnu] elpa/flx 482b887215 046/182: (BREAKING) activate through proper


From: ELPA Syncer
Subject: [nongnu] elpa/flx 482b887215 046/182: (BREAKING) activate through proper minor-mode
Date: Tue, 13 Dec 2022 03:59:25 -0500 (EST)

branch: elpa/flx
commit 482b8872159323f3f74fcca104cafd98719b26bd
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>

    (BREAKING) activate through proper minor-mode
    
    - also decouple from ido-enable-flex-matching
---
 README.md  |  5 +++--
 flx-ido.el | 25 +++++++++++++++----------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index f1b3e5bc26..0e0f14efc1 100644
--- a/README.md
+++ b/README.md
@@ -67,8 +67,9 @@ to your init file.
 Add this to your init file and *flx* match will be enabled for ido.
 
     (require 'flx-ido)
-    (setq ido-enable-flex-matching t
-          flx-ido-use              t)
+    (ido-mode 1)
+    (ido-everywhere 1)
+    (flx-ido-mode 1)
 
 
 
diff --git a/flx-ido.el b/flx-ido.el
index 7d41aec95e..3fb663420c 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
 ;; Version: 0.1
 ;; Last-Updated:
 ;;           By:
-;;     Update #: 44
+;;     Update #: 49
 ;; URL:
 ;; Keywords:
 ;; Compatibility:
@@ -23,8 +23,9 @@
 ;; Add to your init file:
 ;;
 ;;     (require 'flx-ido)
-;;     (setq ido-enable-flex-matching t
-;;           flx-ido-use              t)
+;;     (ido-mode 1)
+;;     (ido-everywhere 1)
+;;     (flx-ido-mode 1)
 ;;
 ;;
 
@@ -160,16 +161,13 @@ item, in which case, the ending items are deleted."
                              res-items
                            (flx-ido-match-internal query res-items)))))
 
-(defvar flx-ido-use t
-  "Use flx matching for ido.")
-
 (defadvice ido-exit-minibuffer (around flx-ido-undecorate activate)
   "Remove flx properties after."
   (let* ((obj (car ido-matches))
          (str (if (consp obj)
                   (car obj)
                 obj)))
-    (when (and flx-ido-use str)
+    (when (and flx-ido-mode str)
       (remove-text-properties 0 (length str)
                               '(face flx-highlight-face) str)))
 
@@ -179,17 +177,24 @@ item, in which case, the ending items are deleted."
   "Clear flx narrowed hash beforehand.
 
 Remove flx properties after."
-  (when flx-ido-use
+  (when flx-ido-mode
     (clrhash flx-ido-narrowed-matches-hash))
   ad-do-it)
 
 (defadvice ido-set-matches-1 (around flx-ido-set-matches-1 activate)
   "Choose between the regular ido-set-matches-1 and my-ido-fuzzy-match"
-  (if (and flx-ido-use
-           ido-enable-flex-matching)
+  (if flx-ido-mode
       (setq ad-return-value (flx-ido-match ido-text (ad-get-arg 0)))
     ad-do-it))
 
+;;;###autoload
+(define-minor-mode flx-ido-mode
+  "Toggle flx ido mode"
+  :init-value nil
+  :lighter ""
+  :group 'ido
+  :global t)
+
 (provide 'flx-ido)
 
 



reply via email to

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