emacs-devel
[Top][All Lists]
Advanced

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

global-set-key has no effect for iswitchb-buffer


From: Reiner Steib
Subject: global-set-key has no effect for iswitchb-buffer
Date: Fri, 09 Mar 2007 19:28:54 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

Hi,

I have iswitchb-mode enabled.  But occasionally I want to use the
plain `switch-to-buffer' command which I have bound to `C-c b b'.
Recently (well, I haven't updated from CVS for a while) this stopped
to work: `C-c b b' also calls `iswitchb-buffer'.

To reproduce:

$ emacs -Q -eval '
(progn
  (iswitchb-mode 1)
  (global-set-key (kbd "C-c b b") (quote switch-to-buffer)))
'

- C-c b b

- Expected prompt: Switch to buffer (...)
  Actual prompt:   iswitch {*Messages*,*scratch*}

Reverting Stephan's patch (see below) fixed the problem.  But I'm not
sure if this change was installed fix some other bug.

2007-01-03  Stefan Monnier  <address@hidden>

        * iswitchb.el (iswitchb-global-map): Use command-remapping if available.

--8<---------------cut here---------------start------------->8---
--- iswitchb.el 17 Mar 2006 21:29:33 -0000      1.67
+++ iswitchb.el 3 Jan 2007 03:37:15 -0000       1.68
@@ -1,7 +1,7 @@
 ;;; iswitchb.el --- switch between buffers using substrings
 
 ;; Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004,
-;;   2005, 2006 Free Software Foundation, Inc.
+;;   2005, 2006, 2007 Free Software Foundation, Inc.
 
 ;; Author: Stephen Eglen <address@hidden>
 ;; Maintainer: Stephen Eglen <address@hidden>
@@ -495,14 +495,13 @@
 
 (defvar iswitchb-global-map
   (let ((map (make-sparse-keymap)))
-    (substitute-key-definition 'switch-to-buffer ; normally C-x b
-                              'iswitchb-buffer map global-map)
-    (substitute-key-definition 'switch-to-buffer-other-window ; C-x 4 b
-                              'iswitchb-buffer-other-window map global-map)
-    (substitute-key-definition 'switch-to-buffer-other-frame ; C-x 5 b
-                              'iswitchb-buffer-other-frame map global-map)
-    (substitute-key-definition 'display-buffer ; C-x 4 C-o
-                              'iswitchb-display-buffer map global-map)
+    (dolist (b '((switch-to-buffer . iswitchb-buffer)
+                 (switch-to-buffer-other-window . iswitchb-buffer-other-window)
+                 (switch-to-buffer-other-frame . iswitchb-buffer-other-frame)
+                 (display-buffer . iswitchb-display-buffer)))
+      (if (fboundp 'command-remapping)
+          (define-key map (vector 'remap (car b)) (cdr b))
+        (substitute-key-definition (car b) (cdr b) map global-map)))
     map)
   "Global keymap for `iswitchb-mode'.")
 
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

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