我没有看到你描述的问题:当我编译 haxe-mode 文件时,我只看到一个关于几个 c-mode 函数的警告,说它们可能在运行时未定义,因为 haxe-mode.el 调用了这些函数但是仅加载eval-when-compile
.
顺便说一句,这些警告似乎是由于一些奇怪的代码,可能是从臭名昭著的 cc-bytecomp 复制而来的。下面的补丁似乎导致了一个干净的编译:
=== modified file 'haxe-help.el'
--- haxe-help.el 2012-10-16 14:41:06 +0000
+++ haxe-help.el 2012-10-16 15:11:37 +0000
@@ -33,7 +33,6 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'cl)
(defcustom haxe-help-location
=== modified file 'haxe-mode.el'
--- haxe-mode.el 2012-10-16 14:41:06 +0000
+++ haxe-mode.el 2012-10-16 15:21:23 +0000
@@ -77,7 +77,6 @@
(require 'cc-bytecomp)
(require 'cc-mode)
(require 'cc-fonts)
-;; (cc-require-when-compile 'cc-langs)
(require 'cc-langs)
(require 'compile)
@@ -91,18 +90,6 @@
(require 'haxe-log)
;; ------------------- my change -------------------------------------
-;; The language constants are needed when compiling.
-(eval-when-compile
- (let ((load-path
- (if (and (boundp 'byte-compile-dest-file)
- (stringp byte-compile-dest-file))
- (cons (file-name-directory byte-compile-dest-file) load-path)
- load-path)))
- (load "cc-mode" nil t)
- (load "cc-fonts" nil t)
- (load "cc-langs" nil t)
- (load "cc-bytecomp" nil t)))
-
(eval-and-compile
;; Tell the language constant system about haXe and base it on Java.
(c-add-language 'haxe-mode 'java-mode))
@@ -387,7 +374,7 @@
(c-fontify-types-and-refs
((c-promote-possible-types t)
(parse-sexp-lookup-properties
- (cc-eval-when-compile
+ (eval-when-compile
(boundp 'parse-sexp-lookup-properties))))
(save-restriction
(narrow-to-region (point) limit)