radian-software/el-patch

void-function: el-patch-fontify-as-defun

telotortium opened this issue · 6 comments

I'm using Doom Emacs, which performs a lot of pre-compilation of your config into autoload files.

Anyway, it appears that the latest release, which added el-patch-fontify-as-defun, breaks my config.

Debugger entered--Lisp error: (void-function el-patch-fontify-as-defun)
  el-patch-fontify-as-defun(el-patch-cl-defun)
  byte-code("\301\302\303\304#\305\306!\210\307 \210\310\300!\203\26\0\10\204\30\0\311\20\312\10\236\313\314!\1\203*\0\1\1\241\266\3\2025\0\312\1B\211\262\3\10B..." [el-patch-deftype-alist function-put el-patch-deftype lisp-indent-function defun require el-patch-stub el-patch--deftype-stub-setup boundp nil cl-defun copy-tree (:classify el-patch-classify-function :locate el-patch-locate-function :font-lock el-patch-fontify-as-defun :declare ((doc-string 3) (indent defun))) el-patch-fontify-as-defun el-patch-cl-defun] 5)
  load("/Users/rmirelan/.doom.d/doom.emacs.d/.local/autoloads.29.0.50" nil nomessage)
  (condition-case e (load (string-remove-suffix ".el" doom-autoloads-file) nil 'nomessage) ((debug file-missing) (if (locate-file doom-autoloads-file load-path) (signal 'doom-autoload-error e) (signal 'doom-error (list "Doom is in an incomplete state" "run 'doom sync' on the command line to repair it")))))
  (progn (setq doom-init-p t) (if doom-debug-p (progn (let ((inhibit-message (active-minibuffer-window))) (message #("DOOM Initializing Doom" 0 5 (face font-lock-comment-face)))))) (let ((--dolist-tail-- '(exec-path load-path))) (while --dolist-tail-- (let ((var (car --dolist-tail--))) (set-default var (get var 'initial-value)) (setq --dolist-tail-- (cdr --dolist-tail--))))) (condition-case e (load (string-remove-suffix ".el" doom-autoloads-file) nil 'nomessage) ((debug file-missing) (if (locate-file doom-autoloads-file load-path) (signal 'doom-autoload-error e) (signal 'doom-error (list "Doom is in an incomplete state" "run 'doom sync' on the command line to repair it"))))) (if doom-debug-p (doom-debug-mode 1)) (if (and (or (display-graphic-p) (daemonp)) doom-env-file) (progn (progn (set-default 'process-environment (get 'process-environment 'initial-value))) (doom-load-envvars-file doom-env-file 'noerror))) (require 'core-modules) (autoload 'doom-initialize-packages "core-packages") (eval-after-load 'package #'(lambda nil (require 'core-packages))) (eval-after-load 'straight #'(lambda nil (doom-initialize-packages))) (if noninteractive nil (add-hook 'after-change-major-mode-hook #'doom-run-local-var-hooks-maybe-h 100) (add-hook 'hack-local-variables-hook #'doom-run-local-var-hooks-h) (add-hook 'emacs-startup-hook #'doom-load-packages-incrementally-h) (add-hook 'window-setup-hook #'doom-display-benchmark-h) (doom-run-hook-on 'doom-first-buffer-hook '(find-file-hook doom-switch-buffer-hook)) (doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook)) (doom-run-hook-on 'doom-first-input-hook '(pre-command-hook)) (add-hook 'doom-first-buffer-hook #'gcmh-mode)))
  (if (or force-p (not doom-init-p)) (progn (setq doom-init-p t) (if doom-debug-p (progn (let ((inhibit-message (active-minibuffer-window))) (message #("DOOM Initializing Doom" 0 5 (face font-lock-comment-face)))))) (let ((--dolist-tail-- '(exec-path load-path))) (while --dolist-tail-- (let ((var (car --dolist-tail--))) (set-default var (get var 'initial-value)) (setq --dolist-tail-- (cdr --dolist-tail--))))) (condition-case e (load (string-remove-suffix ".el" doom-autoloads-file) nil 'nomessage) ((debug file-missing) (if (locate-file doom-autoloads-file load-path) (signal 'doom-autoload-error e) (signal 'doom-error (list "Doom is in an incomplete state" "run 'doom sync' on the command line to repair it"))))) (if doom-debug-p (doom-debug-mode 1)) (if (and (or (display-graphic-p) (daemonp)) doom-env-file) (progn (progn (set-default 'process-environment (get 'process-environment 'initial-value))) (doom-load-envvars-file doom-env-file 'noerror))) (require 'core-modules) (autoload 'doom-initialize-packages "core-packages") (eval-after-load 'package #'(lambda nil (require 'core-packages))) (eval-after-load 'straight #'(lambda nil (doom-initialize-packages))) (if noninteractive nil (add-hook 'after-change-major-mode-hook #'doom-run-local-var-hooks-maybe-h 100) (add-hook 'hack-local-variables-hook #'doom-run-local-var-hooks-h) (add-hook 'emacs-startup-hook #'doom-load-packages-incrementally-h) (add-hook 'window-setup-hook #'doom-display-benchmark-h) (doom-run-hook-on 'doom-first-buffer-hook '(find-file-hook doom-switch-buffer-hook)) (doom-run-hook-on 'doom-first-file-hook '(find-file-hook dired-initial-position-hook)) (doom-run-hook-on 'doom-first-input-hook '(pre-command-hook)) (add-hook 'doom-first-buffer-hook #'gcmh-mode))))
  doom-initialize()
  load-with-code-conversion("/Users/rmirelan/.doom.d/doom.emacs.d/init.el" "/Users/rmirelan/.doom.d/doom.emacs.d/init.el" nil nil)
  load("/Users/rmirelan/.doom.d/doom.emacs.d/init.el")
  (let* ((emacs-directory (file-name-as-directory (chemacs-emacs-profile-key 'user-emacs-directory))) (init-file (expand-file-name "init.el" emacs-directory)) (custom-file- (chemacs-emacs-profile-key 'custom-file init-file)) (server-name- (chemacs-emacs-profile-key 'server-name))) (setq user-emacs-directory emacs-directory) (if server-name- (progn (setq server-name server-name-))) (mapcar #'(lambda (env) (setenv (car env) (cdr env))) (chemacs-emacs-profile-key 'env)) (if (chemacs-emacs-profile-key 'straight-p) (progn (chemacs-load-straight))) (load init-file) (if (not custom-file) (progn (setq custom-file custom-file-) (if (equal custom-file init-file) nil (load custom-file)))))
  chemacs-load-profile("default")
  (if args (let ((s (split-string (car args) "="))) (cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda ...))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args))))) (chemacs-load-profile (chemacs-detect-default-profile)))
  chemacs-check-command-line-args(nil)
  (cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda (_)))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args))))
  (let ((s (split-string (car args) "="))) (cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda (_)))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args)))))
  (if args (let ((s (split-string (car args) "="))) (cond ((equal (car args) "--with-profile") (add-to-list 'command-switch-alist '("--with-profile" lambda (_) (pop command-line-args-left))) (chemacs-load-profile (car (cdr args)))) ((equal (car s) "--with-profile") (add-to-list 'command-switch-alist (cons (car args) '(lambda ...))) (chemacs-load-profile (mapconcat 'identity (cdr s) "="))) (t (chemacs-check-command-line-args (cdr args))))) (chemacs-load-profile (chemacs-detect-default-profile)))
  chemacs-check-command-line-args(("/Applications/MacPorts/Emacs.app/Contents/MacOS/Em..."))
  load-with-code-conversion("/Users/rmirelan/.emacs" "/Users/rmirelan/.emacs" t t)
  load("~/.emacs" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode -0x1492e7863b814e7>) #f(compiled-function () #<bytecode -0x1f3c6eaddc0e4835>) t)
  command-line()
  normal-top-level()

Let me know if the latest commit doesn't fix things, or if you have any other trouble.

Hi, this did not work, now I'm getting this error (see the backtrace):

(error "Keyword argument :font-lock not one of (:classify :locate :declare :macro-name)")

(error "Keyword argument %s not one of (:classify :locate :declare :macro-name)" :font-lock)

(#[385 "\300\1\301\"A@\300\2\302\"A@\300\3\303\"A@\300\4\304\"A@\4\211\203D\0\211@\305>\203,\0\211AA\262\1\202\31\0\306\6\6>A@\203;\0\307\262\1\202\31\0\310\311\2@\"\210\202\31\0\210\3\204M\0\310\312!\210\313\314\315\316\317\6\nD\320BB\321\317\6\nDDE\322\4\206k\0\323\324\325\6\f\"!\326\324\327\6\15\211#\330\6\11\205}\0\331\6\nBC\332\333\334\317\6\22D\335BBEC\"BBBBF\207" [plist-member :classify :locate :declare :macro-name (:classify :locate :declare :macro-name :allow-other-keys) :allow-other-keys nil error "Keyword argument %s not one of (:classify :locate :declare :macro-name)" "You must specify `:classify' in calls to `el-patch-deftype'" progn (unless (bound-and-true-p el-patch-deftype-alist) (setq el-patch-deftype-alist nil)) setf alist-get quote (el-patch-deftype-alist) copy-tree defmacro intern format "el-patch-%S" (name &rest args) "Use `el-patch' to override a `%S' form.\nThe ARGS are the same as for `%S'." append declare list #'el-patch--definition cl-list* (name args)] 20 "Allow `el-patch' to patch definitions of the given TYPE.\nTYPE is a symbol like `defun', `define-minor-mode', etc. This\nupdates `el-patch-deftype-alist' (which see for explanations of\nCLASSIFY, LOCATE, and DECLARE) with the provided KWARGS and\ndefines a macro named like `el-patch-defun',\n`el-patch-define-minor-mode', etc. (which can be overridden by\nMACRO-NAME).\n\n(fn TYPE &rest KWARGS &key CLASSIFY LOCATE DECLARE MACRO-NAME)"] cl-defun :classify el-patch-classify-function :locate el-patch-locate-function :font-lock el-patch-fontify-as-defun :declare ((doc-string 3) (indent defun)))

(el-patch-deftype cl-defun :classify el-patch-classify-function :locate el-patch-locate-function :font-lock el-patch-fontify-as-defun :declare ((doc-string 3) (indent defun)))

(load-with-code-conversion "/Users/rmirelan/.doom.d/doom.emacs.d/.local/straight/build-29.0.50/el-patch/el-patch-autoloads.el" "/Users/rmirelan/.doom.d/doom.emacs.d/.local/straight/build-29.0.50/el-patch/el-patch-autoloads.el" nil t)

(load "/Users/rmirelan/.doom.d/doom.emacs.d/.local/straight/build-29.0.50/el-patch/el-patch-autoloads.el" nil nomessage)

(progn (load autoloads-file nil 'nomessage))

Well, el-patch-deftype does have that keyword argument defined. Is it a stale byte-compiled file? What happens if you flush the caches?

I encountered the same issue with my configuration, and deleting the byte-compiled init-file(s) fixed the issue. Sorry for the inconvenience, you likely just have to do the same.

Awesome, thanks for confirming.