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

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

[elpa] master 93616f7 296/399: ivy.el (ivy--regex): Match initial dot in


From: Oleh Krehel
Subject: [elpa] master 93616f7 296/399: ivy.el (ivy--regex): Match initial dot in the input as a literal dot
Date: Sat, 20 Jul 2019 14:57:43 -0400 (EDT)

branch: master
commit 93616f75b0fcf4d21cc964a018fa2c2d1931f8c0
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    ivy.el (ivy--regex): Match initial dot in the input as a literal dot
    
    This brings much more usability, e.g. enter ".org" to switch between
    Org-mode files, ".el" for Elisp etc.
    
    * ivy-test.el (ivy--regex): Add test.
---
 ivy-test.el | 5 ++++-
 ivy.el      | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ivy-test.el b/ivy-test.el
index dbde2ec..1c11c1d 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -207,7 +207,10 @@ will bring the behavior in line with the newer Emacsen."
                  
"\\(\\(?:interactive\\|swiper\\)\\).*?\\(\\(?:list\\|symbol\\)\\)"))
   (should (equal (ivy--regex
                   "foo[")
-                 "foo\\[")))
+                 "foo\\["))
+  (should (equal (ivy--regex
+                  ".org")
+                 "\\.org")))
 
 (ert-deftest ivy--split-negation ()
   (should (equal (ivy--split-negation "") ()))
diff --git a/ivy.el b/ivy.el
index 2825a9d..5b13dc3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2535,7 +2535,9 @@ When GREEDY is non-nil, join words in a greedy way."
                       (if (= (length subs) 1)
                           (cons
                            (setq ivy--subexps 0)
-                           (car subs))
+                           (if (string-match-p "\\`\\.[^.]" (car subs))
+                               (concat "\\." (substring (car subs) 1))
+                             (car subs)))
                         (cons
                          (setq ivy--subexps (length subs))
                          (mapconcat



reply via email to

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