[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 5424a564 082/184: ivy.el (ivy--handle-directory): Extract
From: |
Oleh Krehel |
Subject: |
[elpa] master 5424a564 082/184: ivy.el (ivy--handle-directory): Extract |
Date: |
Wed, 16 Oct 2019 13:14:53 -0400 (EDT) |
branch: master
commit 5424a5643ee723102a7a1b3f7f434cc83cf735dc
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy--handle-directory): Extract
* ivy-test.el (ivy--handle-directory): Add test.
---
ivy-test.el | 6 ++++++
ivy.el | 14 +++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/ivy-test.el b/ivy-test.el
index e4ce500..6ed6484 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -1384,6 +1384,12 @@ a buffer visiting a file."
(ivy--yank-handle-case-fold "irstName"))
"irstname")))
+(ert-deftest ivy--handle-directory ()
+ (should (string= (ivy--handle-directory "/") "/"))
+ (should (string= (let ((ivy--directory "/tmp/"))
+ (ivy--handle-directory "/sudo::"))
+ "/sudo::/tmp/")))
+
(provide 'ivy-test)
;;; ivy-test.el ends here
diff --git a/ivy.el b/ivy.el
index 1b9090b..1588efc 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1010,14 +1010,18 @@ contains a single candidate.")
(ivy--cd dir)
(ivy--exhibit))))
+(defun ivy--handle-directory (input)
+ "Detect the next directory based on special values of INPUT."
+ (cond ((string= input "/")
+ "/")
+ ((string= input "/sudo::")
+ (concat input ivy--directory))))
+
(defun ivy--directory-done ()
"Handle exit from the minibuffer when completing file names."
- (let (dir)
+ (let ((dir (ivy--handle-directory ivy-text)))
(cond
- ((equal ivy-text "/")
- (ivy--cd "/"))
- ((equal ivy-text "/sudo::")
- (setq dir (concat ivy-text (expand-file-name ivy--directory)))
+ (dir
(let ((inhibit-message t))
(ivy--cd dir)))
((ivy--directory-enter))
- [elpa] master b4af1a6 040/184: swiper.el (swiper-recenter-top-bottom): Works for swiper-isearch, (continued)
- [elpa] master b4af1a6 040/184: swiper.el (swiper-recenter-top-bottom): Works for swiper-isearch, Oleh Krehel, 2019/10/16
- [elpa] master 327dbd6 058/184: counsel.el (counsel-rg-base-command): Don't include directory on non-Windows, Oleh Krehel, 2019/10/16
- [elpa] master 5140127 046/184: ivy.el: Run ispell-comments-and-strings, Oleh Krehel, 2019/10/16
- [elpa] master 2ecbd7d 054/184: ivy.el (ivy-read-action-ivy): Show the selected item in the prompt, Oleh Krehel, 2019/10/16
- [elpa] master ae70443 060/184: counsel.el (counsel-major): Add, Oleh Krehel, 2019/10/16
- [elpa] master f66eec5 059/184: Add counsel-buffer-or-recentf, Oleh Krehel, 2019/10/16
- [elpa] master 1303e10 061/184: counsel.el (counsel-M-x-action): Extract, Oleh Krehel, 2019/10/16
- [elpa] master ca5040d 078/184: counsel.el (counsel-rg-base-command): Remove "-S" flag, Oleh Krehel, 2019/10/16
- [elpa] master 20d604c 069/184: ivy.el (ivy-restrict-to-matches): Fix for ivy-resume, Oleh Krehel, 2019/10/16
- [elpa] master c307ae9 055/184: swiper.el (swiper--re-builder): Fix symbol bounds with char-fold-to-regexp, Oleh Krehel, 2019/10/16
- [elpa] master 5424a564 082/184: ivy.el (ivy--handle-directory): Extract,
Oleh Krehel <=
- [elpa] master d73376f 010/184: ivy.el (ivy--trim-trailing-re): Add, Oleh Krehel, 2019/10/16
- [elpa] master 824f8d7 072/184: counsel.el (counsel--find-return-list): Works with or without "./" prefix, Oleh Krehel, 2019/10/16
- [elpa] master 4fef498 065/184: Use file-name-at-point-functions for file commands, Oleh Krehel, 2019/10/16
- [elpa] master 3d0fcb5 064/184: ivy.el (ivy-partial): Fix trailing space issue, Oleh Krehel, 2019/10/16
- [elpa] master 7dea040 066/184: ivy.el (ivy-pre-prompt-function): Add, Oleh Krehel, 2019/10/16
- [elpa] master cd7e924 077/184: ivy.el (ivy-read): Fix docstring, Oleh Krehel, 2019/10/16
- [elpa] master da7e546 085/184: ivy.el (ivy-previous-line-and-call): Fix typo, Oleh Krehel, 2019/10/16
- [elpa] master 03fdaea 087/184: doc/ivy.org: Add more recommended key bindings, Oleh Krehel, 2019/10/16
- [elpa] master 941d408 086/184: doc/ivy.org: Fix "C-M-n" description, Oleh Krehel, 2019/10/16
- [elpa] master 4e9aaec 092/184: ivy-test: Fix tests using file names on Windows, Oleh Krehel, 2019/10/16