make-obsolete-* 系列函数的 when 参数变更导致大量加载错误

在最近的提交 https://emba.gnu.org/emacs/emacs/-/commit/32c6732d16385f242b1109517f25e9aefd6caa5c 中,make-obsolete-* 系列函数的 when 参数改为不可选了。这就导致有不少的包加载错误,例如:

Debugger entered--Lisp error: (wrong-number-of-arguments (3 . 4) 2)
  #f(compiled-function (obsolete-name current-name when &optional docstring) "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete.\n\n(define-obsolete-func$
  (define-obsolete-function-alias 'global-nix-prettify-mode 'nix-prettify-global-mode)
  eval-buffer(#<buffer  *load*-591792> nil "/Users/*/.emacs.d/28.0.50/elpa/nix-mode-20201229..." nil t)  ; Reading at buffer position 5115
  load-with-code-conversion("/Users/*/.emacs.d/28.0.50/elpa/nix-mode-20201229..." "/Users/*/.emacs.d/28.0.50/elpa/nix-mode-20201229..." nil t)
  load("/Users/*/.emacs.d/28.0.50/elpa/nix-mode-20201229..." nil t)
  package--activate-autoloads-and-load-path(#s(package-desc :name nix-mode :version (20201229 138) :summary "Major mode for editing .nix files" :reqs ((emacs (25 1))) :kind nil :ar$
  package--load-files-for-activation(#s(package-desc :name nix-mode :version (20201229 138) :summary "Major mode for editing .nix files" :reqs ((emacs (25 1))) :kind nil :archive n$
  package-activate-1(#s(package-desc :name nix-mode :version (20201229 138) :summary "Major mode for editing .nix files" :reqs ((emacs (25 1))) :kind nil :archive nil :dir "/Users/$
  package-activate(nix-mode)
  package--activate-all()
  package-activate-all()
  package-initialize()

有些更新比较活跃的包已经跟进修复了,但还有些反应比较慢:

⋊> [~/.emacs.d] rg -U '\(define-obsolete-function-alias[\s\t\n]+([^\s\t\n]+)[\s\t\n]+([^\s\t\n]+)[\s\t\n]*\)' 28.0.50/elpa/ -g '*.el' -l
28.0.50/elpa/solarized-theme-20201207.1431/solarized.el
28.0.50/elpa/racer-20191001.2344/racer.el
28.0.50/elpa/php-mode-20210103.1738/php-local-manual.el
28.0.50/elpa/nix-mode-20201229.138/nix-prettify-mode.el
28.0.50/elpa/nix-mode-20201229.138/nix-mode-autoloads.el
28.0.50/elpa/list-utils-20200502.1309/list-utils.el
28.0.50/elpa/evil-20201107.1830/evil-ex.el

估计这种混乱还将持续数天。我看这也不是什么很重要的变更,干脆写俩 advice 把 when 参数改回去,让 Emacs 顺利跑起来才是正经。

1 个赞

直接rollback了。等稳定了再跟进。