unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work
@ 2005-05-18  3:58 Daniel Brockman
  2005-06-14  5:28 ` Daniel Brockman
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Brockman @ 2005-05-18  3:58 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1036 bytes --]

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))

[-- Attachment #3: Type: text/plain, Size: 42 bytes --]


-- 
Daniel Brockman <daniel@brockman.se>

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work
  2005-05-18  3:58 [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work Daniel Brockman
@ 2005-06-14  5:28 ` Daniel Brockman
  2005-06-14  6:00   ` Daniel Brockman
  2005-06-14 15:09   ` Kim F. Storm
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Brockman @ 2005-06-14  5:28 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 117 bytes --]

I sent this patch over three weeks ago, but didn't get any response.
Kim, could you check whether this patch is ok?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1024 bytes --]

*** ido.el	14 Jun 2005 06:25:37 +0200	1.61
--- ido.el	14 Jun 2005 07:24:49 +0200	
***************
*** 1320,1328 ****
  
      (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))
  
      (let ((map (cdr ido-minor-mode-map-entry)))
        (when (memq ido-mode '(file both))
--- 1320,1330 ----
  
      (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
  
!     ;; Rebuild the keymap each time so that old bindings are not retained.
!     ;; This is necessary when switching from `both' to either `buffer' or `file'.
!     (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap)))
!     (setq minor-mode-map-alist (assq-delete-all 'ido-mode minor-mode-map-alist))
!     (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))

[-- Attachment #3: Type: text/plain, Size: 42 bytes --]


-- 
Daniel Brockman <daniel@brockman.se>

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work
  2005-06-14  5:28 ` Daniel Brockman
@ 2005-06-14  6:00   ` Daniel Brockman
  2005-06-14 15:09   ` Kim F. Storm
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Brockman @ 2005-06-14  6:00 UTC (permalink / raw)


Sorry, I forgot the ChangeLog entry.

2005-06-14  Daniel Brockman  <daniel@brockman.se>

	* ido.el (ido-mode): Rebuild ido-minor-mode-map-entry each time
	ido-mode is called with a non-nil argument.

-- 
Daniel Brockman <daniel@brockman.se>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work
  2005-06-14  5:28 ` Daniel Brockman
  2005-06-14  6:00   ` Daniel Brockman
@ 2005-06-14 15:09   ` Kim F. Storm
  2005-06-14 15:19     ` Daniel Brockman
  1 sibling, 1 reply; 5+ messages in thread
From: Kim F. Storm @ 2005-06-14 15:09 UTC (permalink / raw)
  Cc: emacs-devel

Daniel Brockman <daniel@brockman.se> writes:

> I sent this patch over three weeks ago, but didn't get any response.
> Kim, could you check whether this patch is ok?

I think the following patch is better -- can you pls. test it?

*** ido.el	12 Jun 2005 01:10:06 +0200	1.61
--- ido.el	14 Jun 2005 17:07:57 +0200	
***************
*** 1320,1326 ****
  
      (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))
  
--- 1320,1327 ----
  
      (add-hook 'kill-emacs-hook 'ido-kill-emacs-hook)
  
!     (if ido-minor-mode-map-entry
! 	(setcdr ido-minor-mode-map-entry (make-sparse-keymap))
        (setq ido-minor-mode-map-entry (cons 'ido-mode (make-sparse-keymap)))
        (add-to-list 'minor-mode-map-alist ido-minor-mode-map-entry))
  


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work
  2005-06-14 15:09   ` Kim F. Storm
@ 2005-06-14 15:19     ` Daniel Brockman
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Brockman @ 2005-06-14 15:19 UTC (permalink / raw)
  Cc: emacs-devel

storm@cua.dk (Kim F. Storm) writes:

> I think the following patch is better -- can you pls. test it?

Okay, that works great too.

-- 
Daniel Brockman <daniel@brockman.se>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-06-14 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-18  3:58 [PATCH] Switching from (ido-mode 'both) to (ido-mode 'buffer) doesn't work Daniel Brockman
2005-06-14  5:28 ` Daniel Brockman
2005-06-14  6:00   ` Daniel Brockman
2005-06-14 15:09   ` Kim F. Storm
2005-06-14 15:19     ` Daniel Brockman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).