I like the cycling and switching behavior of iflipb, it is very similar to the behavior of Windows Alt-Tab. However, as stated earlier, Emacs does not make it easy to notice when you release the control key. This makes it impossible to switch between the two upper buffers: if you press C-Tab (and release) and then C-Tab (and release), you will not switch between the two upper buffers. Instead, iflipb just goes further down the buffer list. But if you execute any other Emacs command between two C-Tab events, iflipb recognizes that it starts in the buffer march, so it switches.
On Windows, AutoHotKey can come to the rescue and send Emacs a keystroke when releasing a control key. Here is my script:
#if WinActive("ahk_class Emacs") ^Tab:: Send {Blind}^{Tab} SetTimer, WaitForCtrlUp, 10 return WaitForCtrlUp: if(!GetKeyState("LControl", "P") and !GetKeyState("RControl","P")) { if WinActive("ahk_class Emacs") Send ^c: SetTimer, WaitForCtrlUp, Off } return
Whenever a C-Tab is pressed in emacs, the script starts polling the state of the control key. When the key is released, it sends Emacs the Cc : key sequence. I have a key associated with the "null" command, which is enough to get iflipb to notice what is happening.
Here's the corresponding excerpt .emacs:
; see http://www.emacswiki.org/emacs/iflipb (require 'iflipb) (global-set-key (kbd "<C-tab>") 'iflipb-next-buffer) (global-set-key (if (featurep 'xemacs) (kbd "<C-iso-left-tab>") (kbd "<CS-tab>")) 'iflipb-previous-buffer) (defun null-command () "Do nothing (other than standard command processing such as remembering this was the last command executed)" (interactive)) (global-set-key "\Cc:" 'null-command)
So this is kind of hacks, but it really works. Thanks to the posters at http://www.autohotkey.com/board/topic/72433-controltab/ , which tried to solve a similar problem.
David Martin
source share