« ^ »

Emacs 28でel-getをrequireしようとするとdefine-obsolete-function-aliasでエラーする

所要時間: 約 2分

開発版版のEmacs (28.0.50) をソースからビルドして使っている。 el-getをrequireしようとしたところ以下のエラーが発生した。

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-function-alias \\='old-fun \\='new-fun \"22.1\" \"old-fun's doc.\")\n\nis equivalent to the following two lines of code:\n\n(defalias \\='old-fun \\='new-fun \"old-fun's doc.\")\n(make-obsolete \\='old-fun \\='new-fun \"22.1\")\n\nWHEN should be a string indicating when the function was first\nmade obsolete, for example a date or a release number.\n\nSee the docstrings of `defalias' and `make-obsolete' for more details." #<bytecode 0x155f8ed4497b9d3b>)('el-get-package-status 'el-get-read-package-status)
  (define-obsolete-function-alias 'el-get-package-status 'el-get-read-package-status)
  eval-buffer(#<buffer  *load*-95274> nil "/usr/local/ng/el-get/el-get-status.el" nil t)  ; Reading at buffer position 7064
  load-with-code-conversion("/usr/local/ng/el-get/el-get-status.el" "/usr/local/ng/el-get/el-get-status.el" nil t)
  require(el-get-status)
  eval-buffer(#<buffer  *load*> nil "/usr/local/ng/el-get/el-get.el" nil t)  ; Reading at buffer position 8196
  load-with-code-conversion("/usr/local/ng/el-get/el-get.el" "/usr/local/ng/el-get/el-get.el" nil t)
  require(el-get)
  (progn (require 'el-get))
  eval((progn (require 'el-get)) t)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  #<subr call-interactively>(eval-last-sexp nil nil)
  apply(#<subr call-interactively> eval-last-sexp (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> eval-last-sexp nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (eval-last-sexp nil nil))
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

原因はel-get-status.elのrequireに失敗しており、define-obsolete-function-aliasを呼んでいる箇所で失敗している。 定義を確認したところdefine-obsolete-function-aliasはwhen引数が追加されていた。

(defmacro define-obsolete-function-alias ( obsolete-name current-name when
                                           &optional docstring)
  "Set OBSOLETE-NAME's function definition to CURRENT-NAME and mark it obsolete.

\(define-obsolete-function-alias \\='old-fun \\='new-fun \"22.1\" \"old-fun's doc.\")

is equivalent to the following two lines of code:

\(defalias \\='old-fun \\='new-fun \"old-fun's doc.\")
\(make-obsolete \\='old-fun \\='new-fun \"22.1\")

WHEN should be a string indicating when the function was first
made obsolete, for example a date or a release number.

See the docstrings of `defalias' and `make-obsolete' for more details."
  (declare (doc-string 4))
  `(progn
     (defalias ,obsolete-name ,current-name ,docstring)
     (make-obsolete ,obsolete-name ,current-name ,when)))
/Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/byte-run.el.gz

暫定的にwhenにtを指定することで回避した。whenは本来いつからなのかを指定する引数と思われる。

(define-obsolete-function-alias 'el-get-package-status 'el-get-read-package-status t)
/usr/local/ng/el-get/el-get-status.el

後でPull requestを確認したところ、すでに修正が作成されていた。

https://github.com/dimitri/el-get/pull/2796