0

我想使用相对路径设置 emacs lisp 字节编译的目标目录,例如../foo. 我想我应该使用byte-compile-dest-file-function,但不知道如何设置它。我该如何设置?

4

2 回答 2

1

要设置byte-compile-dest-function变量,您可以customize-variable交互使用,也可以setq在您的 init 文件中使用。因为无论哪种方式,您都必须编写一个函数来完成这项工作,我建议使用后者,以便所有内容都在您的 init 文件中的同一个位置。

例如:

(defun my-dest-function (filename)
  (concat (file-name-directory filename)
          "../"
          (file-name-sans-extension (file-name-nondirectory filename))
          ".elc"))
(setq byte-compile-dest-file-function 'my-dest-function)
于 2012-12-19T18:38:11.610 回答
0

您可以使用 Ch v 后跟该变量名找到它。

(defcustom byte-compile-dest-file-function nil
  "Function for the function `byte-compile-dest-file' to call.
It should take one argument, the name of an Emacs Lisp source
file name, and return the name of the compiled file."
  :group 'bytecomp
  :type '(choice (const nil) function)
  :version "23.2")

您可以看到它是一个可自定义的变量,因此您可以将其值更改为“函数”。

编辑:我不太确定这是您要更改的变量。事实上,你可以看到它经常处理变量目录,我看不到如何设置所有.elc应该去的某个目录。

于 2012-12-19T17:27:27.777 回答