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

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

[elpa] master d752db5 333/399: counsel.el (counsel-find-file-extern-exte


From: Oleh Krehel
Subject: [elpa] master d752db5 333/399: counsel.el (counsel-find-file-extern-extensions): New defcustom
Date: Sat, 20 Jul 2019 14:57:51 -0400 (EDT)

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

    counsel.el (counsel-find-file-extern-extensions): New defcustom
    
    Allows us to press "RET" instead of "M-o x" like we did before.
---
 counsel.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/counsel.el b/counsel.el
index ea8265c..bd6da76 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1857,14 +1857,21 @@ Skip some dotfiles unless `ivy-text' requires them."
 (defvar counsel-find-file-speedup-remote t
   "Speed up opening remote files by disabling `find-file-hook' for them.")
 
+(defcustom counsel-find-file-extern-extensions '("mp4" "mkv" "xlsx")
+  "List of extensions that make `counsel-find-file' use 
`counsel-find-file-extern'."
+  :type '(repeat string))
+
 (defun counsel-find-file-action (x)
   "Find file X."
   (with-ivy-window
-    (if (and counsel-find-file-speedup-remote
-             (file-remote-p ivy--directory))
-        (let ((find-file-hook nil))
-          (find-file (expand-file-name x ivy--directory)))
-      (find-file (expand-file-name x ivy--directory)))))
+    (cond ((and counsel-find-file-speedup-remote
+                (file-remote-p ivy--directory))
+           (let ((find-file-hook nil))
+             (find-file (expand-file-name x ivy--directory))))
+          ((member (file-name-extension x) counsel-find-file-extern-extensions)
+           (counsel-find-file-extern x))
+          (t
+           (find-file (expand-file-name x ivy--directory))))))
 
 (defun counsel--preselect-file ()
   "Return candidate to preselect during filename completion.



reply via email to

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