MacOS 使用 doom 和 native-comp 后 projectile 报错

Emacs 版本: 28.0.5 Doom 版本: 4.0.0-alpha

表现:

打开文件或者打开项目的时候都会报:

Error running hook "projectile-track-known-projects-find-file-hook" because: (void-function update-projectile-known-projects) 

尝试删除整个所有的包重新下载编译,也会出现相应的问题。

update-projectile-known-projects 函数哪里来的?

尝试添加了 --debug 命令去启动:

Debugger entered--Lisp error: (void-function update-projectile-known-projects)
  (update-projectile-known-projects)
  (lambda nil (update-projectile-known-projects))()
  eval-after-load(magit (lambda nil (update-projectile-known-projects)))
  (progn (eval-after-load 'magit #'(lambda nil (update-projectile-known-projects))))
  (progn (setq compilation-read-command nil) (projectile-register-project-type 'cmake '("CMakeLists.txt") :configure "cmake %s" :compile "cmake --build Debug" :test "ctest") (progn (eval-after-load 'magit #'(lambda nil (update-projectile-known-projects)))))
  (lambda nil (progn (setq compilation-read-command nil) (projectile-register-project-type 'cmake '("CMakeLists.txt") :configure "cmake %s" :compile "cmake --build Debug" :test "ctest") (progn (eval-after-load 'magit #'(lambda nil (update-projectile-known-projects))))))()
  eval-after-load-helper("/Users/pango/.emacs.d/.local/straight/build-28.0....")
  do-after-load-evaluation("/Users/pango/.emacs.d/.local/straight/build-28.0....")
  projectile-project-p()
  projectile-track-known-projects-find-file-hook()
  funcall(projectile-track-known-projects-find-file-hook)
  (condition-case e (funcall hook) ((debug error) (signal 'doom-hook-error (list hook e))))
  doom-run-hook(projectile-track-known-projects-find-file-hook)
  run-hook-wrapped(doom-run-hook projectile-track-known-projects-find-file-hook)
  (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if (symbolp (car (cdr e))) (symbol-name (car (cdr e))) (car (cdr e))) (car (cdr (cdr e))))) (signal 'doom-hook-error (cons hook (cdr e)))))
  (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if (symbolp (car ...)) (symbol-name (car ...)) (car (cdr e))) (car (cdr (cdr e))))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (while --dolist-tail-- (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if (symbolp ...) (symbol-name ...) (car ...)) (car (cdr ...)))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--))))
  (let ((--dolist-tail-- hooks)) (while --dolist-tail-- (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if ... ... ...) (car ...))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  doom-run-hooks(dired-before-readin-hook)
  apply(doom-run-hooks dired-before-readin-hook)
  run-hooks(dired-before-readin-hook)
  apply(run-hooks dired-before-readin-hook)
  #<subr dired-readin>()
  apply(#<subr dired-readin> nil)
  all-the-icons-dired--refresh-advice(#<subr dired-readin>)
  apply(all-the-icons-dired--refresh-advice #<subr dired-readin> nil)
  #f(advice-wrapper :around #<subr dired-readin> all-the-icons-dired--refresh-advice)()
  apply(#f(advice-wrapper :around #<subr dired-readin> all-the-icons-dired--refresh-advice) nil)
  dired-readin()
  #<subr dired-revert>(nil nil)
  apply(#<subr dired-revert> (nil nil))
  all-the-icons-dired--refresh-advice(#<subr dired-revert> nil nil)
  apply(all-the-icons-dired--refresh-advice #<subr dired-revert> (nil nil))
  dired-revert(nil nil)
  revert-buffer()
  dired-internal-noselect("//" nil)
  dired-noselect("//")
  ranger-find-file("//")
  deer()
  ranger-override-dired-fn()
  funcall(ranger-override-dired-fn)
  (condition-case e (funcall hook) ((debug error) (signal 'doom-hook-error (list hook e))))
  doom-run-hook(ranger-override-dired-fn)
  run-hook-wrapped(doom-run-hook ranger-override-dired-fn)
  (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if (symbolp (car (cdr e))) (symbol-name (car (cdr e))) (car (cdr e))) (car (cdr (cdr e))))) (signal 'doom-hook-error (cons hook (cdr e)))))
  (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if (symbolp (car ...)) (symbol-name (car ...)) (car (cdr e))) (car (cdr (cdr e))))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (while --dolist-tail-- (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if (symbolp ...) (symbol-name ...) (car ...)) (car (cdr ...)))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--))))
  (let ((--dolist-tail-- hooks)) (while --dolist-tail-- (let ((hook (car --dolist-tail--))) (condition-case e (run-hook-wrapped hook #'doom-run-hook) ((debug doom-hook-error) (if debug-on-error nil (lwarn hook :error "Error running hook %S because: %s" (if ... ... ...) (car ...))) (signal 'doom-hook-error (cons hook (cdr e))))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  doom-run-hooks(change-major-mode-after-body-hook dired-mode-hook)
  apply(doom-run-hooks (change-major-mode-after-body-hook dired-mode-hook))
  run-hooks(change-major-mode-after-body-hook dired-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook dired-mode-hook))
  run-mode-hooks(dired-mode-hook)
  dired-mode("//" "-alhF")
  dired-internal-noselect("//" nil)
  dired-noselect("//")
  run-hook-with-args-until-success(dired-noselect "//")
  find-file-noselect(#("//" 0 1 (face (completions-first-difference))) nowarn nil)
  #f(compiled-function (&optional name) #<bytecode -0x169bbdf4ba440689>)(#("//" 0 1 (face (completions-first-difference))))
  #f(compiled-function (cand restore) #<bytecode 0x1fb647828f936b68>)(#("//" 0 1 (face (completions-first-difference))) nil)
  #f(compiled-function () #<bytecode -0x25d69f326804034>)()
  consult--preview-post-command()
  completing-read-default("Find recent file: " #f(compiled-function (str pred action) #<bytecode 0xf3c665196c5651e>) nil t nil file-name-history nil nil)
  completing-read("Find recent file: " #f(compiled-function (str pred action) #<bytecode 0xf3c665196c5651e>) nil t nil file-name-history nil nil)
  #f(compiled-function () #<bytecode 0x956fa321f50450a>)()
  consult--with-preview-1(any #f(compiled-function (cand restore) #<bytecode 0x1fb647828f936b68>) #f(compiled-function (input cand) #<bytecode -0x6437dd5592983df>) #f(compiled-function (&rest args2) #<bytecode 0x1ab97c3cae6739c1>) #f(compiled-function () #<bytecode 0x956fa321f50450a>))
  consult--read-1(("//" "~/.doom.d/lisp/" "/" "~/.doom.d/" "~/.Trash/" "~/.SpaceVim/" "~/.ServiceHub/" "/Users/" "~/.IdentityService/" "~/.emacs.d/.local/straight/repos/clue/scripts/" "~/.emacs.d/.local/straight/repos/clue/clue.el" "~/Source/configs/dotfiles/emacs/.doom.d/lisp/bindi..." "~/.emacs.d/.local/straight/repos/citre/citre-core...." "~/.emacs.d/.local/straight/repos/citre/" "~/.emacs.d/.local/straight/repos/" "~/.emacs.d/.local/straight/" "~/.emacs.d/.local/etc/workspaces/autosave" "~/.doom.d/lisp/misc.el" "~/.doom.d/config.el" "~/.doom.d/custom.el" "~/.doom.d/init.el" "~/.doom.d/packages.el" "~/" "~/OneDrive/书籍/03编程语言/C++/多线程/Anthony Williams - C+..." "~/OneDrive/书籍/03编程语言/C++/多线程/" "~/OneDrive/书籍/03编程语言/C++/" "~/OneDrive/书籍/03编程语言/" "~/OneDrive/书籍/" "~/OneDrive/" "~/Source/langs/c++/apollo_msf_cmake/src/include/si..." "~/Source/langs/c++/apollo_msf_cmake/src/msf/local_..." "~/Source/langs/c++/apollo_msf_cmake/src/msf/msf_lo..." "~/Source/langs/c++/apollo_msf_cmake/TAGS" "~/Source/langs/c++/apollo_msf_cmake/src/msf/" "~/Source/langs/c++/apollo_msf_cmake/src/" "~/Source/langs/c++/apollo_msf_cmake/" "~/Source/langs/c++/apollo_msf_cmake/src/msf/msf_lo..." "~/Source/test/just/emacs.d/readme.org" "~/Source/langs/elixir/Actors/hello_actors/hello_ac..." "~/Source/dotfiles/zsh/.zshrc_function" "~/Nextcloud2/org/test.org" "~/Nextcloud2/org/xilinx_notes.org" "~/Nextcloud2/org/work_notes.org" "~/Nextcloud2/org/todo.org" "~/Nextcloud2/org/research_proposal.tmpXuFPPz.org" "~/Nextcloud2/org/research_proposal.org" "~/Nextcloud2/org/python_notes.org" "~/Nextcloud2/org/notes.org" "~/Nextcloud2/org/k8s.org" "~/Nextcloud2/org/golang_notes.org" ...) :prompt "Find recent file: " :sort nil :require-match t :category file :state #f(compiled-function (cand restore) #<bytecode 0x1fb647828f936b68>) :history file-name-history :prompt "Select: " :preview-key any :sort t :lookup #f(compiled-function (input cands x) #<bytecode 0x4aac387ed301287>))
  apply(consult--read-1 ("//" "~/.doom.d/lisp/" "/" "~/.doom.d/" "~/.Trash/" "~/.SpaceVim/" "~/.ServiceHub/" "/Users/" "~/.IdentityService/" "~/.emacs.d/.local/straight/repos/clue/scripts/" "~/.emacs.d/.local/straight/repos/clue/clue.el" "~/Source/configs/dotfiles/emacs/.doom.d/lisp/bindi..." "~/.emacs.d/.local/straight/repos/citre/citre-core...." "~/.emacs.d/.local/straight/repos/citre/" "~/.emacs.d/.local/straight/repos/" "~/.emacs.d/.local/straight/" "~/.emacs.d/.local/etc/workspaces/autosave" "~/.doom.d/lisp/misc.el" "~/.doom.d/config.el" "~/.doom.d/custom.el" "~/.doom.d/init.el" "~/.doom.d/packages.el" "~/" "~/OneDrive/书籍/03编程语言/C++/多线程/Anthony Williams - C+..." "~/OneDrive/书籍/03编程语言/C++/多线程/" "~/OneDrive/书籍/03编程语言/C++/" "~/OneDrive/书籍/03编程语言/" "~/OneDrive/书籍/" "~/OneDrive/" "~/Source/langs/c++/apollo_msf_cmake/src/include/si..." "~/Source/langs/c++/apollo_msf_cmake/src/msf/local_..." "~/Source/langs/c++/apollo_msf_cmake/src/msf/msf_lo..." "~/Source/langs/c++/apollo_msf_cmake/TAGS" "~/Source/langs/c++/apollo_msf_cmake/src/msf/" "~/Source/langs/c++/apollo_msf_cmake/src/" "~/Source/langs/c++/apollo_msf_cmake/" "~/Source/langs/c++/apollo_msf_cmake/src/msf/msf_lo..." "~/Source/test/just/emacs.d/readme.org" "~/Source/langs/elixir/Actors/hello_actors/hello_ac..." "~/Source/dotfiles/zsh/.zshrc_function" "~/Nextcloud2/org/test.org" "~/Nextcloud2/org/xilinx_notes.org" "~/Nextcloud2/org/work_notes.org" "~/Nextcloud2/org/todo.org" "~/Nextcloud2/org/research_proposal.tmpXuFPPz.org" "~/Nextcloud2/org/research_proposal.org" "~/Nextcloud2/org/python_notes.org" "~/Nextcloud2/org/notes.org" "~/Nextcloud2/org/k8s.org" "~/Nextcloud2/org/golang_notes.org" ...) (:prompt "Find recent file: " :sort nil :require-match t :category file :state #f(compiled-function (cand restore) #<bytecode 0x1fb647828f936b68>) :history file-name-history :prompt "Select: " :preview-key any :sort t :lookup #f(compiled-function (input cands x) #<bytecode 0x4aac387ed301287>)))
  consult--read(("//" "~/.doom.d/lisp/" "/" "~/.doom.d/" "~/.Trash/" "~/.SpaceVim/" "~/.ServiceHub/" "/Users/" "~/.IdentityService/" "~/.emacs.d/.local/straight/repos/clue/scripts/" "~/.emacs.d/.local/straight/repos/clue/clue.el" "~/Source/configs/dotfiles/emacs/.doom.d/lisp/bindi..." "~/.emacs.d/.local/straight/repos/citre/citre-core...." "~/.emacs.d/.local/straight/repos/citre/" "~/.emacs.d/.local/straight/repos/" "~/.emacs.d/.local/straight/" "~/.emacs.d/.local/etc/workspaces/autosave" "~/.doom.d/lisp/misc.el" "~/.doom.d/config.el" "~/.doom.d/custom.el" "~/.doom.d/init.el" "~/.doom.d/packages.el" "~/" "~/OneDrive/书籍/03编程语言/C++/多线程/Anthony Williams - C+..." "~/OneDrive/书籍/03编程语言/C++/多线程/" "~/OneDrive/书籍/03编程语言/C++/" "~/OneDrive/书籍/03编程语言/" "~/OneDrive/书籍/" "~/OneDrive/" "~/Source/langs/c++/apollo_msf_cmake/src/include/si..." "~/Source/langs/c++/apollo_msf_cmake/src/msf/local_..." "~/Source/langs/c++/apollo_msf_cmake/src/msf/msf_lo..." "~/Source/langs/c++/apollo_msf_cmake/TAGS" "~/Source/langs/c++/apollo_msf_cmake/src/msf/" "~/Source/langs/c++/apollo_msf_cmake/src/" "~/Source/langs/c++/apollo_msf_cmake/" "~/Source/langs/c++/apollo_msf_cmake/src/msf/msf_lo..." "~/Source/test/just/emacs.d/readme.org" "~/Source/langs/elixir/Actors/hello_actors/hello_ac..." "~/Source/dotfiles/zsh/.zshrc_function" "~/Nextcloud2/org/test.org" "~/Nextcloud2/org/xilinx_notes.org" "~/Nextcloud2/org/work_notes.org" "~/Nextcloud2/org/todo.org" "~/Nextcloud2/org/research_proposal.tmpXuFPPz.org" "~/Nextcloud2/org/research_proposal.org" "~/Nextcloud2/org/python_notes.org" "~/Nextcloud2/org/notes.org" "~/Nextcloud2/org/k8s.org" "~/Nextcloud2/org/golang_notes.org" ...) :prompt "Find recent file: " :sort nil :require-match t :category file :state #f(compiled-function (cand restore) #<bytecode 0x1fb647828f936b68>) :history file-name-history)
  #f(compiled-function () (interactive nil) #<bytecode -0x3a9f14623314ca6>)()
  apply(#f(compiled-function () (interactive nil) #<bytecode -0x3a9f14623314ca6>) nil)
  consult-recent-file()
  funcall-interactively(consult-recent-file)
  call-interactively(consult-recent-file)
  (lambda (_) (call-interactively (or (command-remapping #'recentf-open-files) #'recentf-open-files)))(#<marker (moves after insertion) at 1628 in *doom*>)
  button-activate(#<marker (moves after insertion) at 1628 in *doom*> nil)
  push-button(1628)
  funcall-interactively(push-button 1628)
  command-execute(push-button)

这个函数定义在: doom-config/misc.el at 9c5ce266c941c227508b4f7718f20f6d80595176 · ztlevi/doom-config · GitHub 这里的:

(defun update-projectile-known-projects ()
  (interactive)
  (require 'magit)
  (setq magit-repository-directories '(("~/dev" . 2)))
  ;; Workplace folder has some permission error on macos
  (let ((workspace-dir "~/workplace/"))
    (when (file-directory-p workspace-dir)
      (dolist (dir (directory-files workspace-dir t))
        (when (and
               (file-readable-p dir)
               (not (string-equal ".." (substring dir -2)))
               (not (string-equal "." (substring dir -1))))
          (appendq! magit-repository-directories `((,dir . 2)))))))
  (let (magit-repos
        magit-abs-repos
        (home (expand-file-name "~")))
    ;; append magit repos at root with depth 1
    (dolist (root +my/repo-root-list)
      (setq magit-abs-repos (append magit-abs-repos (magit-list-repos-1 root 1))))
    (setq magit-abs-repos (append magit-abs-repos (magit-list-repos)))

    ;; convert abs path to relative path (HOME)
    (dolist (repo magit-abs-repos)
      (string-match home repo)
      (push (replace-match "~" nil nil repo 0) magit-repos))
    (setq projectile-known-projects magit-repos)
    (dolist (repo +my/user-custom-repos)
      (if (file-directory-p repo)
          (push repo projectile-known-projects)))))