branch: externals/ivy-hydra
commit 47ec37b395cc1b304bbf91e804f138634544a9df
Author: Basil L. Contovounesios <[email protected]>
Commit: Basil L. Contovounesios <[email protected]>

    ivy.el: Fix some string predicates
    
    (ivy--dirname-p, ivy--magic-file-slash): Simplify now that Ivy
    requires Emacs 24.5 or later by using string-suffix-p instead of
    slower regexp matching.
    (ivy--occur-insert-lines): Escape leading dot in regexp by using
    existing helper ivy--starts-with-dotslash.
    
    Re: #1817, #1845, #1846
---
 ivy.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ivy.el b/ivy.el
index afc3595..9360857 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2078,7 +2078,7 @@ An :init is a function with no arguments.
       #'directory-name-p
     (lambda (name)
       "Return non-nil if NAME ends with a directory separator."
-      (string-match-p "/\\'" name))))
+      (string-suffix-p "/" name))))
 
 (defun ivy--sorted-files (dir)
   "Return the list of files in DIR.
@@ -3251,7 +3251,7 @@ Possible choices are 
'ivy-magic-slash-non-match-cd-selected,
       (cond ((member ivy-text ivy--all-candidates)
              (ivy--cd canonical))
             ((and (eq system-type 'windows-nt) (string= ivy-text "//")))
-            ((string-match-p "//\\'" ivy-text)
+            ((string-suffix-p "//" ivy-text)
              (ivy--cd
               (ivy--magic-file-doubleslash-directory)))
             ((string-match-p "\\`/ssh:" ivy-text)
@@ -5038,7 +5038,7 @@ When `ivy-calling' isn't nil, call `ivy-occur-press'."
        highlight
        help-echo "mouse-1: call ivy-action")
      cand)
-    (insert (if (string-match-p "\\`.[/\\]" cand) "" "    ")
+    (insert (if (ivy--starts-with-dotslash cand) "" "    ")
             cand ?\n)))
 
 (defun ivy--occur-default (cands)

Reply via email to