简体   繁体   中英

emacs: close buffers list on selection

Is there a configuration hook to make the " Buffers List " buffer automatically closing when a buffer is selected in such window? Each time the buffer list opens and I select a buffer I have to manually close it using Cx Ck and this is annoying, also because it leaves the frame split in at least two windows.

Not sure about a config option, but you can always use q (or a Cx 1 in your current buffer) instead of Cx Ck to close the temp buffer.

PS Almost nobody uses buffer-list these days. Most Emacs users simply remap it to ibuffer (its much smarter and you might like the fact that its temp buffer disappears by default):

(global-set-key (kbd "C-x C-b") 'ibuffer)

You can tweak this function for your requirement:

(defun kill-other-buffers ()
  "Kill all other buffers."
  (interactive)
  (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))

This code kills all the buffers except the current one. Source: Emacs Wiki

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM