Warning (bytecomp) 警告应该如何让它不提示?

每次开启emacs 都会出现:

Warning (bytecomp): ‘buffer-local-value’ is an obsolete generalized variable.

如何才能让emacs不出现这样的提示? emacs版本是emacs-plus@29,mac

See byte-compile-warnings

1 个赞

我设置 (setq byte-compile-warnings nil) 后也不行?

肯定可以,还可以设置byte-compile-warning-types

测试用下面的代码可以解决,而且要放在配置比较靠前的位置:

(setq byte-compile-warnings '(not nresolved
                                  free-vars
                                  callargs
                                  redefine
                                  obsolete
                                  noruntime
                                  cl-functions
                                  interactive-only
                                  ))
2 个赞

在 Emacs 文件夹中新建 .dir-locals.el

加入

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((emacs-lisp-mode
  (byte-compile-warnings not free-vars unresolved obsolete)
  (flycheck-disabled-checkers emacs-lisp emacs-lisp-checkdoc)))

;; Local Variables:
;; no-byte-compile: t
;; End:

虽然我还在用28,但基本可以猜出来有两个问题

  1. 为什么你每次启动 Emacs 都会编译东西?这不应该是正常行为,一般也就编译时候出现一次 Warning,之后就不该出现了。

  2. 检查一遍自己的配置,出现这个 Warning 无非就是用的包还没来得及给 29 做适配,自己改一遍或者让包的作者去改。

每次启动会编译不少东西。Messages 里有很多提示,不知道问题出在哪里?启动时间很长。其中一部分提示如下,不知道是不是重新编译了?

.emacs.d/site-lisp/c-eldoc/deferred.el: Warning: ‘loop’ is an obsolete alias (as of 27.1); use ‘cl-loop’ instead. [10 times]
.emacs.d/site-lisp/c-eldoc/deferred.el: Warning: ‘incf’ is an obsolete alias (as of 27.1); use ‘cl-incf’ instead.
.emacs.d/site-lisp/c-eldoc/deferred.el: Warning: ‘progv’ is an obsolete alias (as of 27.1); use ‘cl-progv’ instead.
.emacs.d/site-lisp/c-eldoc/deferred.el: Warning: ‘loop’ is an obsolete alias (as of 27.1); use ‘cl-loop’ instead.
Return : (10)
Return : (10 40)
Loading flymake (native compiled elisp)...done
ad-handle-definition: ‘org-publish’ got redefined
Created ipynb link.
org-super-agenda-mode enabled.
.emacs.d/site-lisp/org-bullets/org-bullets.el: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode'
.emacs.d/site-lisp/learn/org-learn.el: Warning: ‘assert’ is an obsolete alias (as of 27.1); use ‘cl-assert’ instead. [2 times]
.emacs.d/site-lisp/org-download/org-download.el: Warning: ‘decf’ is an obsolete alias (as of 27.1); use ‘cl-decf’ instead.
ad-handle-definition: ‘org-publish’ got redefined
.emacs.d/site-lisp/org-edit-latex/org-edit-latex.el: Warning: Case 'ask will match ‘quote’.  If that’s intended, write (ask quote) instead.  Otherwise, don’t quote ‘ask’.
.emacs.d/site-lisp/org-edit-latex/org-edit-latex.el: Warning: Case 'nil will match ‘quote’.  If that’s intended, write (nil quote) instead.  Otherwise, don’t quote ‘nil’.