From aa851ef7e0cc96db7a49a794ea38334c5d6e846f Mon Sep 17 00:00:00 2001 From: Thierry Volpiatto Date: Wed, 2 Nov 2011 10:19:47 +0100 Subject: [PATCH] * anything-config.el (anything-find-files-down-one-level): Disable when completing tramp hostnames. (anything-ff-writing-tramp-name-p): New use it. --- anything-config.el | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/anything-config.el b/anything-config.el index 5127bb9..790b6a9 100644 --- a/anything-config.el +++ b/anything-config.el @@ -3493,16 +3493,17 @@ You should not modify this yourself and know what you do if you do so.") "Go down one level like unix command `cd ..'. If prefix numeric arg is given go ARG level down." (interactive "p") - (with-anything-window - (setq anything-follow-mode nil)) - ;; When going to precedent level we want to be at the line - ;; corresponding to actual directory, so store this info - ;; in `anything-ff-last-expanded'. - (if (and (not (file-directory-p anything-pattern)) - (file-exists-p anything-pattern)) - (setq anything-ff-last-expanded anything-pattern) - (setq anything-ff-last-expanded anything-ff-default-directory)) - (when (anything-file-completion-source-p) + (when (and (anything-file-completion-source-p) + (not (anything-ff-writing-tramp-name-p))) + (with-anything-window + (setq anything-follow-mode nil)) + ;; When going to precedent level we want to be at the line + ;; corresponding to actual directory, so store this info + ;; in `anything-ff-last-expanded'. + (if (and (not (file-directory-p anything-pattern)) + (file-exists-p anything-pattern)) + (setq anything-ff-last-expanded anything-pattern) + (setq anything-ff-last-expanded anything-ff-default-directory)) (let ((new-pattern (anything-reduce-file-name anything-pattern arg :unix-close t :expand t))) (anything-set-pattern new-pattern)))) @@ -3534,8 +3535,7 @@ When only one candidate is remaining and it is a directory, expand to this directory." (when (and anything-ff-auto-update-flag (anything-file-completion-source-p) - (not (string= (anything-ff-set-pattern anything-pattern) - "Invalid tramp file name"))) + (not (anything-ff-writing-tramp-name-p))) (let* ((history-p (string= (assoc-default 'name (anything-get-current-source)) "Read File Name History")) @@ -3644,6 +3644,11 @@ purpose." collect (concat tn host))) :test 'equal)))) +(defun anything-ff-writing-tramp-name-p () + "Return non--nil when user is currently writing a tramp name in minibuffer." + (string= (anything-ff-set-pattern anything-pattern) + "Invalid tramp file name")) + (defun anything-ff-set-pattern (pattern) "Handle tramp filenames in `anything-pattern'." (let ((methods (mapcar 'car tramp-methods)) -- 2.11.4.GIT