您好,我已打开缓冲区循环,将以下命令放入我的 .emacs 中
(global-set-key (kbd "<C-tab>") 'bury-buffer)
但是在循环时如何避免循环遍历消息和临时缓冲区
始终存在于任何 emacs 缓冲区列表中。我从不使用这些缓冲区并变得令人眼花缭乱
当循环浏览我的缓冲区列表时
如果您从不使用暂存缓冲区,只需将其添加到 .emacs 中即可自动关闭它:
(终止缓冲区“*scratch*”)
我还发现这段代码 http://www.emacswiki.org/emacs/ControlTABbufferCycling#toc3 on the Emacs 维基 http://www.emacswiki.org/这应该做你想做的事:
; necessary support function for buffer burial
(defun crs-delete-these (delete-these from-this-list)
"Delete DELETE-THESE FROM-THIS-LIST."
(cond
((car delete-these)
(if (member (car delete-these) from-this-list)
(crs-delete-these (cdr delete-these) (delete (car delete-these)
from-this-list))
(crs-delete-these (cdr delete-these) from-this-list)))
(t from-this-list)))
; this is the list of buffers I never want to see
(defvar crs-hated-buffers
'("KILL" "*Compile-Log*"))
; might as well use this for both
(setq iswitchb-buffer-ignore (append '("^ " "*Buffer") crs-hated-buffers))
(defun crs-hated-buffers ()
"List of buffers I never want to see, converted from names to buffers."
(delete nil
(append
(mapcar 'get-buffer crs-hated-buffers)
(mapcar (lambda (this-buffer)
(if (string-match "^ " (buffer-name this-buffer))
this-buffer))
(buffer-list)))))
; I'm sick of switching buffers only to find KILL right in front of me
(defun crs-bury-buffer (&optional n)
(interactive)
(unless n
(setq n 1))
(let ((my-buffer-list (crs-delete-these (crs-hated-buffers)
(buffer-list (selected-frame)))))
(switch-to-buffer
(if (< n 0)
(nth (+ (length my-buffer-list) n)
my-buffer-list)
(bury-buffer)
(nth n my-buffer-list)))))
(global-set-key [(control tab)] 'crs-bury-buffer)
(global-set-key [(control meta tab)] (lambda ()
(interactive)
(crs-bury-buffer -1)))
您需要将临时缓冲区和消息缓冲区添加到变量中crs-hated-buffers
, e.g.:
(add-to-list 'crs-hated-buffers "*Messages*")
(add-to-list 'crs-hated-buffers "*scratch*")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)