all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* global-set-key has no effect for iswitchb-buffer
@ 2007-03-09 18:28 Reiner Steib
  2007-03-09 23:36 ` Kim F. Storm
  0 siblings, 1 reply; 3+ messages in thread
From: Reiner Steib @ 2007-03-09 18:28 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

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  <monnier@iro.umontreal.ca>

	* 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 <stephen@gnu.org>
 ;; Maintainer: Stephen Eglen <stephen@gnu.org>
@@ -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/

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

* Re: global-set-key has no effect for iswitchb-buffer
  2007-03-09 18:28 global-set-key has no effect for iswitchb-buffer Reiner Steib
@ 2007-03-09 23:36 ` Kim F. Storm
  2007-03-24 12:13   ` Reiner Steib
  0 siblings, 1 reply; 3+ messages in thread
From: Kim F. Storm @ 2007-03-09 23:36 UTC (permalink / raw)
  To: Reiner Steib; +Cc: Stefan Monnier, emacs-devel

Reiner Steib <reinersteib+gmane@imap.cc> writes:

> 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'.


Try:

(defalias 'switch-to-buffer-1 'switch-to-buffer)
and bind C-c b b to switch-to-buffer-1

Alternatively, you could use ido-mode instead.
Then you'd have the standard switch-to-buffer on C-x b C-b

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

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

* Re: global-set-key has no effect for iswitchb-buffer
  2007-03-09 23:36 ` Kim F. Storm
@ 2007-03-24 12:13   ` Reiner Steib
  0 siblings, 0 replies; 3+ messages in thread
From: Reiner Steib @ 2007-03-24 12:13 UTC (permalink / raw)
  To: Kim F. Storm; +Cc: Stefan Monnier, emacs-devel

On Sat, Mar 10 2007, Kim F. Storm wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>> 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'.
[ (iswitchb-mode 1)
  (global-set-key (kbd "C-c b b") (quote switch-to-buffer)) ]

> Try:
>
> (defalias 'switch-to-buffer-1 'switch-to-buffer)
> and bind C-c b b to switch-to-buffer-1

Well, this is a possible workaround.  But is it correct behavior of
`iswitchb-mode' to shadow the original `switch-to-buffer' command?
AFAICS the documentation  mentions only rebinding of keys:

,----[ (info "(emacs)Iswitchb") ]
|    Iswitchb global minor mode provides convenient switching between
| buffers using substrings of their names.  It replaces the normal
| definitions of `C-x b', `C-x 4 b', `C-x 5 b', and `C-x 4 C-o' with
| alternative commands that are somewhat "smarter."
`----

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

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

end of thread, other threads:[~2007-03-24 12:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 18:28 global-set-key has no effect for iswitchb-buffer Reiner Steib
2007-03-09 23:36 ` Kim F. Storm
2007-03-24 12:13   ` Reiner Steib

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.