[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1c68495 145/272: ivy.el (ivy-expand-file-if-directory): Ne
From: |
Oleh Krehel |
Subject: |
[elpa] master 1c68495 145/272: ivy.el (ivy-expand-file-if-directory): New defun |
Date: |
Mon, 25 Apr 2016 10:13:22 +0000 |
branch: master
commit 1c6849575da3cadd82981c6fd696b3464e9212e6
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy-expand-file-if-directory): New defun
* ivy.el (ivy--directory-done): Use `ivy-expand-file-if-directory'.
(ivy-partial-or-done): Use `ivy-expand-file-if-directory'.
---
ivy.el | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/ivy.el b/ivy.el
index c73e5a5..5ebdb4a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -541,21 +541,12 @@ When ARG is t, exit with current text, ignoring the
candidates."
(ivy--exhibit))
((or
(and
- (not (equal ivy-text ""))
- (ignore-errors
- (file-directory-p
- (setq dir
- (file-name-as-directory
- (expand-file-name
- ivy-text ivy--directory))))))
+ (not (string= ivy-text ""))
+ (setq dir (ivy-expand-file-if-directory ivy-text)))
(and
+ (> ivy--length 0)
(not (string= ivy--current "./"))
- (cl-plusp ivy--length)
- (ignore-errors
- (file-directory-p
- (setq dir (file-name-as-directory
- (expand-file-name
- ivy--current ivy--directory)))))))
+ (setq dir (ivy-expand-file-if-directory ivy--current))))
(ivy--cd dir)
(ivy--exhibit))
((or (and (equal ivy--directory "/")
@@ -597,6 +588,16 @@ When ARG is t, exit with current text, ignoring the
candidates."
(t
(ivy-done)))))
+(defun ivy-expand-file-if-directory (file-name)
+ "Expand FILE-NAME as directory.
+When this directory doesn't exist, return nil."
+ (when (stringp file-name)
+ (let ((full-name
+ (file-name-as-directory
+ (expand-file-name file-name ivy--directory))))
+ (when (file-directory-p full-name)
+ full-name))))
+
(defcustom ivy-tab-space nil
"When non-nil, `ivy-partial-or-done' should insert a space."
:type 'boolean)
@@ -609,13 +610,12 @@ If the text hasn't changed as a result, forward to
`ivy-alt-done'."
(or (and (equal ivy--directory "/")
(string-match "\\`[^/]+:.*\\'" ivy-text))
(string-match "\\`/" ivy-text)))
- (let ((default-directory ivy--directory))
+ (let ((default-directory ivy--directory)
+ dir)
(minibuffer-complete)
(setq ivy-text (ivy--input))
- (when (file-directory-p
- (expand-file-name ivy-text ivy--directory))
- (ivy--cd (file-name-as-directory
- (expand-file-name ivy-text ivy--directory)))))
+ (when (setq dir (ivy-expand-file-if-directory ivy-text))
+ (ivy--cd dir)))
(or (ivy-partial)
(when (or (eq this-command last-command)
(eq ivy--length 1))
- [elpa] master 7ed5b06 119/272: ivy.el (ivy--preselect-index): Don't use regexp-quote, (continued)
- [elpa] master 7ed5b06 119/272: ivy.el (ivy--preselect-index): Don't use regexp-quote, Oleh Krehel, 2016/04/25
- [elpa] master dcf4957 123/272: counsel.el (counsel--async-command): Add sentinel and filter args, Oleh Krehel, 2016/04/25
- [elpa] master 53ca6ed 065/272: ivy.el (ivy-do-completion-in-region): New defcustom, Oleh Krehel, 2016/04/25
- [elpa] master ca2b47f 240/272: Add timing information to async commands, Oleh Krehel, 2016/04/25
- [elpa] master d544427 093/272: swiper.el (swiper--re-builder): Replace \t with 4 spaces, Oleh Krehel, 2016/04/25
- [elpa] master 1f3ea7d 095/272: ivy.el (ivy-next-history-element): Handle "M-n M-n" better, Oleh Krehel, 2016/04/25
- [elpa] master ab3ad4e 085/272: doc/ivy.org: Add more CUSTOM_ID, Oleh Krehel, 2016/04/25
- [elpa] master 725e19a 170/272: counsel.el (counsel-ag-occur): Add, Oleh Krehel, 2016/04/25
- [elpa] master ccbf9ef 204/272: Improve counsel-async initial anchoring, Oleh Krehel, 2016/04/25
- [elpa] master 2fb8d86 260/272: ivy.el (ivy-done): Allow ivy-dispatching-done to exit with no cands, Oleh Krehel, 2016/04/25
- [elpa] master 1c68495 145/272: ivy.el (ivy-expand-file-if-directory): New defun,
Oleh Krehel <=
- [elpa] master d4fc54b 110/272: ivy-test.el (counsel-unquote-regex-parens): Add test, Oleh Krehel, 2016/04/25
- [elpa] master 5f0d175 172/272: counsel.el (counsel-prompt-function-dir): Make portable, Oleh Krehel, 2016/04/25
- [elpa] master 5765208 185/272: counsel.el (counsel-pt-base-command): Add regex flag, Oleh Krehel, 2016/04/25
- [elpa] master 67ac850 211/272: counsel.el (counsel-M-x): Add help action, Oleh Krehel, 2016/04/25
- [elpa] master 189c093 207/272: counsel.el (counsel-ace-link): New command, Oleh Krehel, 2016/04/25
- [elpa] master 8c2f213 059/272: counsel.el (counsel-yank-pop): Truncate during display, Oleh Krehel, 2016/04/25
- [elpa] master 5c2c1df 166/272: counsel.el (counsel-git-grep-map): Bind "C-c C-m" to counsel-git-grep-switch-cmd, Oleh Krehel, 2016/04/25
- [elpa] master e6f92fd 191/272: ivy.el (ivy-occur-press): Add counsel-describe-function, Oleh Krehel, 2016/04/25
- [elpa] master 871f78c 168/272: Add optional exit-code table to counsel--async-cmd, Oleh Krehel, 2016/04/25
- [elpa] master 668aaf3 155/272: counsel.el: add outline for `counsel-mode', Oleh Krehel, 2016/04/25