在 emacs 中,是否有 Mx 命令或组合键将所有当前打开的缓冲区呈现到不同的窗口中?为清楚起见,假设我有四个打开的缓冲区,我现在只看到一个正在显示,我想一步一步在一个象限中显示每个缓冲区。
问问题
1669 次
2 回答
4
我推荐 ibuffer。Mx ibuffer 可能是您想要的。这是我的 ibuffer 配置:
;; *Messages* is so annoying. Also, I really like ibuffer
(require 'ibuf-ext)
(add-to-list 'ibuffer-never-show-predicates "^\\*Messages")
(add-to-list 'ibuffer-never-show-predicates "^\\*Completions")
(global-set-key (kbd "C-b") 'ibuffer)
(kill-buffer "*scratch*")
('ibuffer)
(switch-to-buffer "*Ibuffer*")
于 2012-08-29T21:32:36.630 回答
3
如果没有已知的方法,您将能够从以下代码开始:
(defun buffer-in-window-list ()
(let (buffers)
(walk-windows (lambda (window) (push (window-buffer window) buffers)) t t)
buffers))
(defun display-all-buffers ()
(interactive)
(let (buffers-in-window (buffer-in-window-list))
(dolist (buffer (buffer-list))
(when (and (not (string-match "\\`[[:space:]]*\\*" (buffer-name buffer)))
(not (memq buffer buffers-in-window)))
(set-window-buffer (split-window (get-largest-window)) buffer)))
(balance-windows)))
该display-all-buffers
命令为当前未在任何地方显示的每个缓冲区(包括其他帧)打开一个新窗口。出于可用性考虑,它会忽略名称以*
(可选地,以空格字符为前缀)开头的缓冲区,因为它们通常仅供内部使用。
请注意,Emacs 不允许用户制作太小的窗口。因此,当要显示的缓冲区过多时,该命令将按照最近显示或选择的顺序显示尽可能多的缓冲区并发出错误信号。
于 2012-08-30T02:09:10.320 回答