Last active
December 21, 2015 19:28
-
-
Save tam17aki/6354092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun ido-smart-select-text-throw () | |
(let ((match (ido-name (car ido-matches)))) | |
(throw 'ido | |
(setq ido-selected | |
(if match | |
(replace-regexp-in-string "/\\'" "" match) | |
ido-text) | |
ido-text ido-selected | |
ido-final-text ido-text)))) | |
(defun ido-smart-select-text () | |
"Select the current completed item. Do NOT descend into directories." | |
(interactive) | |
(when (and (or (not ido-require-match) | |
(if (memq ido-require-match | |
'(confirm confirm-after-completion)) | |
(if (or (eq ido-cur-item 'dir) | |
(eq last-command this-command)) | |
t | |
(setq ido-show-confirm-message t) | |
nil)) | |
(ido-existing-item-p)) | |
(not ido-incomplete-regexp)) | |
(when ido-current-directory | |
(setq ido-exit 'takeprompt) | |
(unless (and ido-text (= 0 (length ido-text))) | |
(ido-smart-select-text-throw)))) | |
(cond ((= 0 (length ido-text)) | |
(ido-smart-select-text-throw)) | |
(t | |
(exit-minibuffer)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment