manateelazycat / awesome-tab

Emacs package to provide out-of-the-box configuration to use tabs.
384 stars 38 forks source link

awesome-tab 和 flycheck 造成modeline 闪烁问题 #85

Closed loyalpartner closed 4 years ago

loyalpartner commented 4 years ago

blink

配置:

;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.

;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.

(setq package-enable-at-startup nil)
(setq package-archives
      '(("org"          . "http://orgmode.org/elpa/")
    ("gnu" . "http://elpa.gnu.org/packages/")
    ("melpa"        . "https://melpa.org/packages/")
    ("melpa-stable" . "http://stable.melpa.org/packages/")))

(package-initialize)

;; Bootstrap `use-package'
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(require 'use-package)

(use-package awesome-tab
  :load-path "~/.emacs.d/.local/straight/repos/awesome-tab"
  :config
  (awesome-tab-mode))

(use-package doom-modeline
  :ensure t
  :config
  (doom-modeline-mode 1))

(use-package flycheck
  :ensure t
  :init
  (setq flycheck-emacs-lisp-load-path 'inherit)
  (setq flycheck-check-syntax-automatically '(save mode-enabled idle-buffer-switch))
  (setq flycheck-buffer-switch-check-intermediate-buffers t)
  (setq flycheck-display-errors-delay 0.25)
  :config
  (global-flycheck-mode))

复现方法: 开两个窗口,分别打开来个不同的 elisp 文件, 然后多按几次保存

manateelazycat commented 4 years ago

我估计是doom-modeline的锅,awesome-tab不会刷新modeline

loyalpartner commented 4 years ago

移除了 doom-modeline , modeline 也会闪 (setq flycheck-check-syntax-automatically '(save mode-enabled idle-buffer-switch)) 这个设置让flycheck 在切换buffer的时候之后执行检查,似乎flycheck 又会生成一个 flycheck_xxx.el 的文件并被emacs打开了

manateelazycat commented 4 years ago

测试 emacs -Q 并只用awesome-tab,对比测试下,如果emacs -Q没问题就不是awesome-tab的锅

loyalpartner commented 4 years ago

flycheck 里面如果设置了 (setq flycheck-check-syntax-automatically '(save mode-enabled idle-buffer-switch)), 会添加 buffer-list-update-hook, https://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-List.html#Buffer-List 里面提到 Functions run by this hook should avoid calling select-window with a nil norecord argument or with-temp-buffer since either may lead to infinite recursion.

解决办法就是: 在 (with-temp-buffer ...) 外面套上 (let (buffer-list-update-hook) (with-temp-buffer ...) )