[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 16d391d 263/395: ivy.el (ivy--done): Handle i
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 16d391d 263/395: ivy.el (ivy--done): Handle ivy-text being a full path when on remote |
Date: |
Thu, 25 Feb 2021 08:32:16 -0500 (EST) |
branch: externals/ivy-hydra
commit 16d391dfbff55109d7c0f4b59839336977d51046
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
ivy.el (ivy--done): Handle ivy-text being a full path when on remote
Suppose we are on "/ssh:dev:/bin", and `ivy-text' is yanked
"/etc/hosts". Then "RET" or "C-j" should select "/ssh:dev:/etc/hosts".
* ivy-test.el (ivy--handle-full-path-yank-on-remote): Add test.
---
ivy-test.el | 7 +++++++
ivy.el | 17 +++++++++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index 7af21c1..599f840 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -1510,6 +1510,13 @@ a buffer visiting a file."
(ivy--handle-directory "/sudo::"))
"/sudo::/tmp/")))
+(ert-deftest ivy--handle-full-path-yank-on-remote ()
+ (should
+ (string=
+ (let ((ivy--directory "/ssh:dev:/bin/"))
+ (ivy--expand-file-name "/etc/hosts"))
+ "/ssh:dev:/etc/hosts")))
+
(ert-deftest ivy-inhibit-action ()
(should (equal (ivy-with
'(let ((ivy-inhibit-action #'identity))
diff --git a/ivy.el b/ivy.el
index e092118..bbddc8d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -730,6 +730,18 @@ N is obtained from `ivy-more-chars-alist'."
`(with-selected-window (ivy--get-window ivy-last)
,@body))
+(defun ivy--expand-file-name (text)
+ (cond
+ ((eq (ivy-state-history ivy-last) 'grep-files-history)
+ text)
+ (ivy--directory
+ (if (and (string-match-p "^/" text) (file-remote-p ivy--directory))
+ (let ((parts (split-string ivy--directory ":")))
+ (concat (nth 0 parts) ":" (nth 1 parts) ":" text))
+ (expand-file-name text ivy--directory)))
+ (t
+ text)))
+
(defun ivy--done (text)
"Insert TEXT and exit minibuffer."
(if (member (ivy-state-prompt ivy-last) '("Create directory: " "Make
directory: "))
@@ -737,10 +749,7 @@ N is obtained from `ivy-more-chars-alist'."
(when (stringp text)
(insert
(setf (ivy-state-current ivy-last)
- (if (and ivy--directory
- (not (eq (ivy-state-history ivy-last)
'grep-files-history)))
- (expand-file-name text ivy--directory)
- text))))
+ (ivy--expand-file-name text))))
(setq ivy-exit 'done)
(exit-minibuffer)))
- [elpa] externals/ivy-hydra 251c219 193/395: Enable setting the display function with ivy-configure, (continued)
- [elpa] externals/ivy-hydra 251c219 193/395: Enable setting the display function with ivy-configure, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ee2a537 204/395: * counsel.el (counsel-mark--get-evil-candidates): Fix typo, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra eeb14b1 213/395: ivy-test.el (ivy-read-history): Add a test, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1bf5b98 234/395: ivy.el: Fix next-error randomly jumping to previous match, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra bd9945b 243/395: Fix recent regression in ivy--preselect-index, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0ecc41c 240/395: * ivy.el (ivy-occur-next-error): Use dolist., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra ec16352 253/395: ivy.el (ivy-resume): Check that :action is not identity, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f3f4c8c 246/395: Fix ivy-auto-shrink-minibuffer regression, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 57c7d7c 259/395: Call actions with default-directory bound to last state dir, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 92e5a95 252/395: Add command counsel-describe-symbol, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 16d391d 263/395: ivy.el (ivy--done): Handle ivy-text being a full path when on remote,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra ce5b20a 283/395: counsel.el (counsel-grep-like-occur): Fix for a list arg, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra db5a894 327/395: ivy-test.el (ivy-with): Don't use counsel-locate-git-root, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0b5c08a 308/395: counsel.el (counsel-grep-like-occur): Fix copy-sequence for cl-mapcan, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra aef1d4d 302/395: ivy.el (ivy-configure): Add :parent keyword, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra cbcb7ad 034/395: swiper.el (swiper-isearch-format-function): Refactor, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 388e0d4 043/395: ivy.el (ivy--magic-tilde-directory): Fix for non-standard home path, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5e393b0 047/395: .travis.yml (env): Bump to emacs-26.3-travis, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 2d4d6d6 076/395: Use text, not "current", in -dispatching-done when no matches, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8c23823 073/395: ivy-test.el (ivy-swiper-wgrep): Re-enable on 24.5, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 9e7f21a 078/395: ivy.el (ivy-completing-read): Fix require-match arg being symbol, Basil L. Contovounesios, 2021/02/25