2015年4月23日木曜日

Recover the good old C-x C-b (list-buffers) behaviour around Emacs 24.4 and later

Something has been changed around Emacs 24.4:  my favorite C-x C-b (list-buffers) no longer works as before.  It displays the buffer menu in a random window.  Which windows is chosen is almost undeterministic and no way to predict.  Sometimes the current window is selected. :-(

This change is awful to me who built a special neuro circuit for Emacs.  I often did:
  • C-x C-b to display the buffer list in another window than the current
  • then immediately C-x o to move the cursor from the current window to the buffer list.
I can type these strokes in 0.5secs and this worked fine since what happened with C-x C-b was almost predictable.  24.x ruined it.

After long investigation, finally I found a way to recover the good old behaviour of C-x C-b (or at least something pretty similar):

(defun good-old-list-buffers ()     (interactive)   (display-buffer (list-buffers-noselect)))  (global-change-key (kbd "C-x C-b") 'good-old-list-buffers) 

This is it.  I hope this helps some other Emacs users.

Now the following is much nearer:

(defun good-old-list-buffers ()   (interactive)  (if (not (string-equal (buffer-name (current-buffer)) "*Buffer List*"))      (save-selected-window (buffer-menu-other-window))))(global-change-key (kbd "C-x C-b") 'good-old-list-buffers)


1 件のコメント:

  1. このコメントはブログの管理者によって削除されました。

    返信削除