branch: master
commit 1220781cb24fab9bb5918984c3679be64ad1f109
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-find-file): Speed up opening remotes
---
counsel.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 9101d03..f767fbf 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1306,6 +1306,9 @@ Skip some dotfiles unless `ivy-text' requires them."
(declare-function ffap-guesser "ffap")
+(defvar counsel-find-file-speedup-remote t
+ "Speed up opening remote files by disabling `find-file-hook' for them.")
+
;;;###autoload
(defun counsel-find-file (&optional initial-input)
"Forward to `find-file'.
@@ -1317,7 +1320,12 @@ When INITIAL-INPUT is non-nil, use it in the minibuffer
during completion."
:action
(lambda (x)
(with-ivy-window
- (find-file (expand-file-name x ivy--directory))))
+ (let ((find-file-hook (if (and
+ counsel-find-file-speedup-remote
+ (file-remote-p ivy--directory))
+ nil
+ find-file-hook)))
+ (find-file (expand-file-name x ivy--directory)))))
:preselect (when counsel-find-file-at-point
(require 'ffap)
(let ((f (ffap-guesser)))