aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm2005-07-08 09:44:47 +0000
committerKim F. Storm2005-07-08 09:44:47 +0000
commitb2d4c118dd01e4fc5c86690a77e6e8872b0b30e4 (patch)
tree4ada4fa08aad0cd701e70dd4fc907bda0024ab21
parentc380c937e53dbb2b4f740b5af4755efeb1f8ba91 (diff)
downloademacs-b2d4c118dd01e4fc5c86690a77e6e8872b0b30e4.tar.gz
emacs-b2d4c118dd01e4fc5c86690a77e6e8872b0b30e4.zip
(ido-before-fallback-functions): New hook.
(ido-buffer-internal, ido-file-internal, ido-read-buffer) (ido-read-file-name): Run it.
-rw-r--r--lisp/ido.el18
1 files changed, 17 insertions, 1 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index d4d94164f3c..7912c2185b9 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -881,6 +881,12 @@ the file name using normal `read-file-name' style."
881 :type '(repeat symbol) 881 :type '(repeat symbol)
882 :group 'ido) 882 :group 'ido)
883 883
884(defcustom ido-before-fallback-functions '()
885 "List of functions to call before calling a fallback command.
886The fallback command is passed as an argument to the functions."
887 :type 'hook
888 :group 'ido)
889
884;;; Internal Variables 890;;; Internal Variables
885 891
886;; Persistent variables 892;; Persistent variables
@@ -1918,7 +1924,10 @@ If INITIAL is non-nil, it specifies the initial input string."
1918(defun ido-buffer-internal (method &optional fallback prompt default initial switch-cmd) 1924(defun ido-buffer-internal (method &optional fallback prompt default initial switch-cmd)
1919 ;; Internal function for ido-switch-buffer and friends 1925 ;; Internal function for ido-switch-buffer and friends
1920 (if (not ido-mode) 1926 (if (not ido-mode)
1921 (call-interactively (or fallback 'switch-to-buffer)) 1927 (progn
1928 (run-hook-with-args 'ido-before-fallback-functions
1929 (or fallback 'switch-to-buffer))
1930 (call-interactively (or fallback 'switch-to-buffer)))
1922 (let* ((ido-context-switch-command switch-cmd) 1931 (let* ((ido-context-switch-command switch-cmd)
1923 (ido-current-directory nil) 1932 (ido-current-directory nil)
1924 (ido-directory-nonreadable nil) 1933 (ido-directory-nonreadable nil)
@@ -1937,6 +1946,8 @@ If INITIAL is non-nil, it specifies the initial input string."
1937 1946
1938 ((eq ido-exit 'fallback) 1947 ((eq ido-exit 'fallback)
1939 (let ((read-buffer-function nil)) 1948 (let ((read-buffer-function nil))
1949 (run-hook-with-args 'ido-before-fallback-functions
1950 (or fallback 'switch-to-buffer))
1940 (call-interactively (or fallback 'switch-to-buffer)))) 1951 (call-interactively (or fallback 'switch-to-buffer))))
1941 1952
1942 ;; Check buf is non-nil. 1953 ;; Check buf is non-nil.
@@ -2068,6 +2079,8 @@ If INITIAL is non-nil, it specifies the initial input string."
2068 ;; we don't want to change directory of current buffer. 2079 ;; we don't want to change directory of current buffer.
2069 (let ((default-directory ido-current-directory) 2080 (let ((default-directory ido-current-directory)
2070 (read-file-name-function nil)) 2081 (read-file-name-function nil))
2082 (run-hook-with-args 'ido-before-fallback-functions
2083 (or fallback 'find-file))
2071 (call-interactively (or fallback 'find-file)))) 2084 (call-interactively (or fallback 'find-file))))
2072 2085
2073 ((eq ido-exit 'switch-to-buffer) 2086 ((eq ido-exit 'switch-to-buffer)
@@ -2134,6 +2147,7 @@ If INITIAL is non-nil, it specifies the initial input string."
2134 (setq filename (concat ido-current-directory filename)) 2147 (setq filename (concat ido-current-directory filename))
2135 (ido-record-command fallback filename) 2148 (ido-record-command fallback filename)
2136 (ido-record-work-directory) 2149 (ido-record-work-directory)
2150 (run-hook-with-args 'ido-before-fallback-functions fallback)
2137 (funcall fallback filename)) 2151 (funcall fallback filename))
2138 2152
2139 ((eq method 'insert) 2153 ((eq method 'insert)
@@ -4210,6 +4224,7 @@ If REQUIRE-MATCH is non-nil, an existing buffer must be selected."
4210 (buf (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match))) 4224 (buf (ido-read-internal 'buffer prompt 'ido-buffer-history default require-match)))
4211 (if (eq ido-exit 'fallback) 4225 (if (eq ido-exit 'fallback)
4212 (let ((read-buffer-function nil)) 4226 (let ((read-buffer-function nil))
4227 (run-hook-with-args 'ido-before-fallback-functions 'read-buffer)
4213 (read-buffer prompt default require-match)) 4228 (read-buffer prompt default require-match))
4214 buf))) 4229 buf)))
4215 4230
@@ -4256,6 +4271,7 @@ See `read-file-name' for additional parameters."
4256 (setq filename 'fallback))) 4271 (setq filename 'fallback)))
4257 (if (eq filename 'fallback) 4272 (if (eq filename 'fallback)
4258 (let ((read-file-name-function nil)) 4273 (let ((read-file-name-function nil))
4274 (run-hook-with-args 'ido-before-fallback-functions 'read-file-name)
4259 (read-file-name prompt dir default-filename mustmatch initial predicate)) 4275 (read-file-name prompt dir default-filename mustmatch initial predicate))
4260 filename))) 4276 filename)))
4261 4277