emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't wo


From: Daniel Brockman
Subject: [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work
Date: Wed, 18 May 2005 05:58:07 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Steps to reproduce:

 1. M-: (ido-mode 'buffer)

 2. Note that C-x C-f is *not* bound to any ido stuff.

 3. M-: (ido-mode 'both)

 4. Note that C-x C-f *is* bound to ido stuff.

 5. M-: (ido-mode 'buffer)

 6. Note that C-x C-f is *still* bound to ido stuff.

Here's one solution:

Index: ido.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ido.el,v
retrieving revision 1.55
diff -u -r1.55 ido.el
--- ido.el      5 May 2005 22:15:58 -0000       1.55
+++ ido.el      18 May 2005 03:49:17 -0000
@@ -1320,9 +1320,14 @@
 
     (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
 
-    (unless ido-minor-mode-map-entry
-      (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap)))
-      (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry))
+    (when ido-minor-mode-map-entry
+      (setq minor-mode-map-alist
+            (assq-delete-all 'ido-mode minor-mode-map-alist)))
+
+    ;; In case the user wants to switch from, e.g., 'both to 'buffer, always
+    ;; create a fresh keymap so that old bindings are not retained.
+    (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap)))
+    (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry)
 
     (let ((map (cdr ido-minor-mode-map-entry)))
       (when (memq ido-mode '(file both))
-- 
Daniel Brockman <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]