Emacs中的缓冲区循环:避免擦伤和消息缓冲

Emacs中的缓冲区循环:避免擦伤和消息缓冲,emacs,Emacs,嗨,我已经打开了缓冲区循环,在my.emacs中放置了以下命令 (global-set-key (kbd "<C-tab>") 'bury-buffer) (全局设置键(kbd“”)”缓冲区) 但是,在循环时,如何避免在消息和scratch缓冲区之间循环 始终存在于任何emacs缓冲区列表中。我从不使用这些缓冲液,会让我眼睛发痛 在我的缓冲区列表中循环时如果您从未使用过暂存缓冲区,只需将其添加到.emacs中即可自动关闭它: (终止缓冲区“*scratch*”) 我还在上找到了您

嗨,我已经打开了缓冲区循环,在my.emacs中放置了以下命令

(global-set-key (kbd "<C-tab>") 'bury-buffer)
(全局设置键(kbd“”)”缓冲区)
但是,在循环时,如何避免在消息和scratch缓冲区之间循环 始终存在于任何emacs缓冲区列表中。我从不使用这些缓冲液,会让我眼睛发痛
在我的缓冲区列表中循环时

如果您从未使用过暂存缓冲区,只需将其添加到.emacs中即可自动关闭它:

(终止缓冲区“*scratch*”)

我还在上找到了您想做什么就做什么:

; 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)))

卢克回答了你的具体问题。根据我个人的经验,缓冲区循环作为最近使用的堆栈比Emacs默认循环函数更有用。也就是说,您最近使用的缓冲区应该位于堆栈顶部,类似于Windows中alt tab的工作方式


有相当多的包在上实现了这一点<代码>缓冲堆栈是我推荐的。默认情况下,它有一个排除的缓冲区列表,我已经包括了我的
缓冲区堆栈suppl
配置,它执行相同的主模式过滤。如果您询问有关
缓冲区堆栈的问题,我会尽力提供帮助。

好的,如果您使用
ido模式
在缓冲区之间循环,您可以设置
ido ignore buffers
,以匹配要忽略的缓冲区。从文件中:

匹配要忽略的缓冲区名称的正则表达式或函数的列表。 例如,传统行为是不列出名称以开头的缓冲区 带有一个空格,其regexp为“`”。有关详细信息,请参阅源文件 过滤缓冲区名称的示例函数


有关
ido模式的更多信息,请参见:

我没有使用的所有缓冲区,如刮擦、消息和完成,都干扰了我的工作流程

我设法完全摆脱了它们,而没有以任何方式破坏emacs

首先发布,然后粘贴以下内容:

将此文件放在.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)

当我要求缓冲区堆栈总是忽略/取消跟踪某些缓冲区时,如何指定通配符?e、 g.如果我想让它添加到untrack list*.html中,我该怎么做?
;; No more typing the whole yes or no. Just y or n will do.
(fset 'yes-or-no-p 'y-or-n-p)