Emacs创建了太多缓冲区

时间:2012-03-03 20:11:22

标签: emacs

Emacs创建的缓冲区太多了,比如启动它时的缓冲区:

Loading /home/david/.recentf...done
Cleaning up the recentf list...done (0 removed)
For information about GNU Emacs and the GNU system, type C-h C-a.

当我想要自动完成时,其他人喜欢以下内容:

Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
perl-backward-to-noncomment     perl-beginning-of-function
perl-electric-terminator    perl-end-of-function
perl-indent-command     perl-indent-exp
perl-mark-function  perl-mode
perldb

有没有办法可以让emacs终止自动完成缓冲区,而不是在开始时创建那个?感谢。

5 个答案:

答案 0 :(得分:5)

当我第一次开始使用emacs时,我就有了这种感觉。虽然我在使用它们时通常会关闭这些“临时”缓冲区,但更通用的答案是你只需要将它们放在脑海中并开发一个工作流程,在那里你可以找到你所做的缓冲区想要。否则,当你的自己的缓冲区不相关时,你会开始将它们视为混乱,并浪费精力关闭它们。

iswitchb-mode是一个好的开始。

答案 1 :(得分:4)

在emacs 24中有elisp函数:

清理缓冲器列表

这是由MidnightMode提供的,可以添加到其他版本中。

顾名思义也可以安排。

答案 2 :(得分:2)

iswitchb模式的替代方法是ido-mode,它非常相似,但看起来更清晰,它也使C-x-C-f(查找文件)看起来更好。

答案 3 :(得分:1)

顺便说一下,如果选择iswitchb,你也可以设置它来忽略某些缓冲区。只需将以下代码添加到emacs init文件中:

(add-to-list 'iswitchb-buffer-ignore "*Messages*")
(add-to-list 'iswitchb-buffer-ignore "*scratch")
(add-to-list 'iswitchb-buffer-ignore "*Completions")

答案 4 :(得分:1)

或者只是完全禁用暂存,消息和完成缓冲区,而不会破坏任何内容:

首先发布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)