起因:想抄 citre/citre-ctags.el at master · universal-ctags/citre · GitHub , 先生成一个临时的 tag 文件,处理好后再把 citre 默认用的 tags 文件替换为临时文件。当运行到 :sentinel 时,会报下面的错误,和 citre 的 citre-update-updatable-tags-file
比较了好久,始终没找出差别,烦请各位赐教
error in process sentinel: let: Symbol’s value as variable is void: after-process
error in process sentinel: Symbol’s value as variable is void: after-process
报错代码如下:
(defun citre-auto-update-updatable-tags-file (&optional tagsfile sync)
" copy from `citre-upate-updateale-tas-file'
Update TAGSFILE that contains recipe for updating itself.
If the recipe can't be found, throw an error.
When SYNC is non-nil, update TAGSFILE synchronously.
Return t if the ctags process starts successfully (when updating
asynchronously), or the updating is finished (when updating
synchronously). Otherwise return nil."
(when-let* ((tagsfile
(or tagsfile (citre-read-tags-file-name)))
(cmd-ptag (citre--get-pseudo-tag-value "CITRE_CMD" tagsfile))
(cmd (citre--ctags-cmd-ptag-to-exec cmd-ptag tagsfile))
(cwd-ptag (citre--get-pseudo-tag-value "TAG_PROC_CWD" tagsfile))
(cwd (if-let ((remote-id (file-remote-p tagsfile)))
(concat remote-id cwd-ptag) cwd-ptag))
(proc-name (concat tagsfile "." "proc"))
(after-process (lambda ()
(citre--write-ctags-recipe
tagsfile cmd-ptag cwd-ptag)
(sit-for 1)
(rename-file tagsfile (string-replace ".auto-update" "" tagsfile ) t)
(citre-clear-tags-file-cache)
(remhash (funcall citre-project-root-function) citre-auto-update-process-table)
))
)
;; Workaround: If we put this let into the above `if-let*' spec, even
;; if it stops before let-binding `default-directory', later there'll
;; be some timer errors.
(let ((default-directory cwd))
;; (puthash (funcall citre-project-root-function) proc-name citre-auto-update-process-table)
(if sync
(progn (apply #'process-file (car cmd) nil
(get-buffer-create "*citre-ctags*") nil (cdr cmd))
(funcall after-process))
(make-process
:name proc-name
:buffer (get-buffer-create "*citre-ctags*")
:command cmd
:connection-type 'pipe
:stderr nil
:sentinel
(lambda (proc _msg)
(pcase (process-status proc)
('exit
(pcase (process-exit-status proc)
(0 (funcall after-process)
(message "Finished updating %s" tagsfile))
(s (user-error "Ctags exits %s. See *citre-ctags* buffer"
s))))
(s (user-error "Abnormal status of ctags: %s. \
See *citre-ctags* buffer" s))))
:file-handler t)
(message "Auto-updating %s..." tagsfile))
t)))