summaryrefslogtreecommitdiff
path: root/lisp/ido.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2018-06-26 07:51:01 -0700
committerGlenn Morris <rgm@gnu.org>2018-06-26 07:51:01 -0700
commit513b97c0e94f5c25dd9ac82aea86c9eba248589d (patch)
tree08bfa10e294e43635ec5e03a375ae0837de5040f /lisp/ido.el
parent61f73703c74756e6963cc622f03bcc6938ab71b2 (diff)
parent12c77f6918c4a60dbbae3f716a58300b4026e8da (diff)
Merge from origin/emacs-26
12c77f6 (origin/emacs-26) Add ido-fallback special variable (Bug#31707) 826e8d1 Merge branch 'emacs-26' of git.sv.gnu.org:/srv/git/emacs into... c784876 Tighten a cross-reference in documentation 517dc0b Fix last change in tramp-sh.el f43186f Revert previous patch; comment was OK after all. 4c3306e Fix lead comment for count_trailing_zero_bits b419f27 ; * doc/emacs/files.texi (Interlocking): Fix a non-portable @... 7488de4 * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Fix docstring q... 0b69807 Make a minor update to the CSS mode docstring 9a53b6d Say how to override a primitive interactive spec 1d77078 Fix Bug#31941
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 705e7dd6301..3b102e07c55 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1242,6 +1242,9 @@ Only used if `ido-use-virtual-buffers' is non-nil.")
;; Dynamically bound in ido-read-internal.
(defvar ido-completing-read)
+;; If dynamically set when ido-exit is 'fallback, overrides fallback command.
+(defvar ido-fallback nil)
+
;;; FUNCTIONS
(defun ido-active (&optional merge)
@@ -2220,6 +2223,7 @@ If cursor is not at the end of the user input, move to end of input."
(run-hook-with-args 'ido-before-fallback-functions
(or fallback 'switch-to-buffer))
(call-interactively (or fallback 'switch-to-buffer)))
+ (setq ido-fallback nil)
(let* ((ido-context-switch-command switch-cmd)
(ido-current-directory nil)
(ido-directory-nonreadable nil)
@@ -2245,7 +2249,7 @@ If cursor is not at the end of the user input, move to end of input."
((eq ido-exit 'fallback)
(let ((read-buffer-function nil))
- (setq this-command (or fallback 'switch-to-buffer))
+ (setq this-command (or ido-fallback fallback 'switch-to-buffer))
(run-hook-with-args 'ido-before-fallback-functions this-command)
(call-interactively this-command)))
@@ -2341,6 +2345,7 @@ If cursor is not at the end of the user input, move to end of input."
;; Internal function for ido-find-file and friends
(unless item
(setq item 'file))
+ (setq ido-fallback nil)
(let ((ido-current-directory (ido-expand-directory default))
(ido-context-switch-command switch-cmd)
ido-directory-nonreadable ido-directory-too-big
@@ -2412,7 +2417,7 @@ If cursor is not at the end of the user input, move to end of input."
;; we don't want to change directory of current buffer.
(let ((default-directory ido-current-directory)
(read-file-name-function nil))
- (setq this-command (or fallback 'find-file))
+ (setq this-command (or ido-fallback fallback 'find-file))
(run-hook-with-args 'ido-before-fallback-functions this-command)
(call-interactively this-command)))
@@ -2821,13 +2826,15 @@ If no buffer or file exactly matching the prompt exists, maybe create a new one.
(setq ido-exit 'takeprompt)
(exit-minibuffer))
-(defun ido-fallback-command ()
- "Fallback to non-Ido version of current command."
+(defun ido-fallback-command (&optional fallback-command)
+ "Fallback to non-Ido version of current command.
+The optional FALLBACK-COMMAND argument indicates which command to run."
(interactive)
(let ((i (length ido-text)))
(while (> i 0)
(push (aref ido-text (setq i (1- i))) unread-command-events)))
(setq ido-exit 'fallback)
+ (setq ido-fallback fallback-command)
(exit-minibuffer))
(defun ido-enter-find-file ()