在对 emacs 进行 latex、预览和跳转到 PDF 时,有时会出现错误和问题,在这种情况下,emacs 会抛出一堆框架,这些框架会侵入编辑窗口,我必须以某种方式手动关闭它们。您建议我如何阻止这种情况发生?如果我真的在意错误,我宁愿去查看相应的缓冲区,或者更好的是,latex 错误可能会出现在后台的单独窗口中。
答案1
这可能是一个很好的起点(取自EmacsWiki):
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bury unwanted buffers ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 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*" "*Messages*" "*scratch*" "*auto-install"))
; 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。