changeset 61808:083f920d9c86

(ido-everywhere): Save and restore old read-buffer-function and read-file-name-function values. Don't overwrite existing non-nil values if ido-mode is enabled without ido-everywhere.
author Kim F. Storm <storm@cua.dk>
date Sun, 24 Apr 2005 19:09:13 +0000
parents af1e99c64e71
children f83775915bd2
files lisp/ido.el
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ido.el	Sun Apr 24 19:08:56 2005 +0000
+++ b/lisp/ido.el	Sun Apr 24 19:09:13 2005 +0000
@@ -1346,12 +1346,21 @@
   (setq ido-everywhere (if arg
 			   (> (prefix-numeric-value arg) 0)
 			 (not ido-everywhere)))
-  (setq read-file-name-function
-	(and ido-everywhere (memq ido-mode '(both file))
-	     'ido-read-file-name))
-  (setq read-buffer-function
-	(and ido-everywhere (memq ido-mode '(both buffer))
-	     'ido-read-buffer)))
+  (when (get 'ido-everywhere 'file)
+    (setq read-file-name-function (get 'ido-everywhere 'file))
+    (put 'ido-everywhere 'file nil))
+  (when (get 'ido-everywhere 'buffer)
+    (setq read-buffer-function (get 'ido-everywhere 'buffer))
+    (put 'ido-everywhere 'buffer nil))
+  (when ido-everywhere
+    (when (memq ido-mode '(both file))
+      (unless (get 'ido-everywhere 'file)
+	(put 'ido-everywhere 'file read-file-name-function))
+      (setq read-file-name-function 'ido-read-file-name))
+    (when (memq ido-mode '(both buffer))
+      (unless (get 'ido-everywhere 'buffer)
+	(put 'ido-everywhere 'buffer read-buffer-function))
+      (setq read-buffer-function 'ido-read-buffer))))
 
 
 ;;; IDO KEYMAP