您好我已打开缓冲区循环,在我的.emacs
中放置以下命令(global-set-key (kbd "<C-tab>") 'bury-buffer)
但是在骑自行车时如何避免循环通过消息和scrratch缓冲区 始终存在于任何emacs缓冲区列表中。我从不使用那些缓冲剂而成为眼睛疼痛 在我的缓冲区列表中循环时
答案 0 :(得分:7)
如果您从未使用暂存缓冲区,只需将其添加到.emacs即可自动关闭它:
(kill-buffer“* scratch *”)
我还在this code上找到了Emacs wiki哪个应该做你想做的事情:
; 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
,例如:
(add-to-list 'crs-hated-buffers "*Messages*")
(add-to-list 'crs-hated-buffers "*scratch*")
答案 1 :(得分:5)
卢克回答了你的具体问题。根据我的个人经验,缓冲循环作为最近使用的堆栈而不是Emacs默认循环功能更有用。也就是说,您最近使用的缓冲区应该冒泡到堆栈顶部,类似于alt-tab在Windows中的工作方式。
有很多软件包在wiki上实现了这一点。我推荐buffer-stack
。默认情况下,它有一个排除缓冲区列表,我已经包含了buffer-stack-suppl
配置,它执行相同的主模式过滤。如果您对buffer-stack
提出问题,我会尽力提供帮助。
答案 2 :(得分:3)
我没有使用的所有缓冲区,例如暂存,消息和完成,与我的工作流程混淆。
我已经设法完全摆脱它们,而不会以任何方式破坏emacs。
首先发布here,然后粘贴:
将其放在.emacs中:
;; Makes *scratch* empty.
(setq initial-scratch-message "")
;; Removes *scratch* from buffer after the mode has been set.
(defun remove-scratch-buffer ()
(if (get-buffer "*scratch*")
(kill-buffer "*scratch*")))
(add-hook 'after-change-major-mode-hook 'remove-scratch-buffer)
;; Removes *messages* from the buffer.
(setq-default message-log-max nil)
(kill-buffer "*Messages*")
;; Removes *Completions* from buffer after you've opened a file.
(add-hook 'minibuffer-exit-hook
'(lambda ()
(let ((buffer "*Completions*"))
(and (get-buffer buffer)
(kill-buffer buffer)))))
;; Don't show *Buffer list* when opening multiple files at the same time.
(setq inhibit-startup-buffer-menu t)
;; Show only one active window when opening multiple files at the same time.
(add-hook 'window-setup-hook 'delete-other-windows)
加成:
;; No more typing the whole yes or no. Just y or n will do.
(fset 'yes-or-no-p 'y-or-n-p)
答案 3 :(得分:1)
好吧,如果你使用ido-mode
在缓冲区之间循环,你可以设置ido-ignore-buffers
以匹配你想要忽略的缓冲区。来自文档:
匹配要忽略的缓冲区名称的正则表达式或函数列表。 例如,传统行为不是列出名称开头的缓冲区 有一个空格,正则表达式是“`”。请参阅源文件 过滤缓冲区名称的示例函数。
有关ido-mode
的更多信息,请参阅:Introduction to ido-mode