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

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

[elpa] master 468e914 109/399: counsel.el (counsel--file-name-filter): C


From: Oleh Krehel
Subject: [elpa] master 468e914 109/399: counsel.el (counsel--file-name-filter): Clean up style
Date: Sat, 20 Jul 2019 14:56:59 -0400 (EDT)

branch: master
commit 468e914330b1e07c01ce646d8d5c63b68971900e
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel--file-name-filter): Clean up style
    
    Don't use `and' for side effects.
    Avoid overwriting `cmd' binding.
    
    Re #1984
---
 counsel.el | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/counsel.el b/counsel.el
index 828ae44..742f334 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1877,21 +1877,23 @@ If USE-IGNORE is non-nil, try to generate a command 
that respects
   (let ((regex ivy--old-re)
         (ignore-re (list (counsel--elisp-to-pcre
                           counsel-find-file-ignore-regexp)))
-        (cmd (cl-find-if
-              (lambda (x)
-                (executable-find
-                 (car (split-string (car x)))))
-              counsel-file-name-filter-alist)))
-    (and use-ignore ivy-use-ignore
-         counsel-find-file-ignore-regexp
-         (cdr cmd)
-         (not (string-match-p "\\`\\." ivy-text))
-         (not (string-match-p counsel-find-file-ignore-regexp
-                              (or (car ivy--old-cands) "")))
-         (setq regex (if (stringp regex)
-                         (list ignore-re (cons regex t))
-                       (cons ignore-re regex))))
-    (setq cmd (format (car cmd) (counsel--elisp-to-pcre regex (cdr cmd))))
+        (filter-cmd (cl-find-if
+                     (lambda (x)
+                       (executable-find
+                        (car (split-string (car x)))))
+                     counsel-file-name-filter-alist))
+        cmd)
+    (when (and use-ignore ivy-use-ignore
+               counsel-find-file-ignore-regexp
+               (cdr filter-cmd)
+               (not (string-match-p "\\`\\." ivy-text))
+               (not (string-match-p counsel-find-file-ignore-regexp
+                                    (or (car ivy--old-cands) ""))))
+      (setq regex (if (stringp regex)
+                      (list ignore-re (cons regex t))
+                    (cons ignore-re regex))))
+    (setq cmd (format (car filter-cmd)
+                      (counsel--elisp-to-pcre regex (cdr filter-cmd))))
     (if (string-match-p "csh\\'" shell-file-name)
         (replace-regexp-in-string "\\?!" "?\\\\!" cmd)
       cmd)))



reply via email to

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