循环引用要怎么处理比较好呢?

比如说我有一个 a-util.el 里面写了

(a-mode -1)

这个 a-mode 定义在了 a.el 里面。

如果我在 a.el 里面因为用到其它函数引用了 a-util.el, 我的 a-util 里面似乎就不能再引用 a 了。 但是如果不引用的话,编译时就会有

reference to free variable ‘a-mode’

这个情况要怎么处理比较好呢?

declare-function is a Lisp macro in ‘subr.el’.

(declare-function FN FILE &optional ARGLIST FILEONLY)

Tell the byte-compiler that function FN is defined, in FILE.
The FILE argument is not used by the byte-compiler, but by the
‘check-declare’ package, which checks that FILE contains a
definition for FN.
defvar is a special form defined in eval.c.

(defvar SYMBOL &optional INITVALUE DOCSTRING)
The defvar form also declares the variable as "special",
so that it is always dynamically bound even if lexical-binding is t.
If INITVALUE is missing,
SYMBOL's value is not set.

Examples: helm/helm-grep.el at master · emacs-helm/helm · GitHub

使用 declare-function 解决了问题