我需要输出由batch-compile
生成的elisp字节码到自定义目录。定制值byte-compile-dest-file-function
似乎这是相关的:如何将elisp字节码输出到自定义目录?
(defun my-dest-file-function (filename)
(let ((pwd (expand-file-name "."))
(basename (replace-regexp-in-string ".*/" "" filename)))
(concat (file-name-as-directory pwd) basename "c")))
(setq byte-compile-dest-file-function (quote my-dest-file-function))
(batch-byte-compile)
的:
(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")
我尽可能/opt/local/bin/emacs -batch --eval '(defun my-dest-file-function (filename) (let ((pwd (expand-file-name ".")) (basename (replace-regexp-in-string ".*/" "" filename))) (concat (file-name-as-directory pwd) basename "c"))) (setq byte-compile-dest-file-function (quote my-dest-file-function)) (batch-byte-compile)' /Users/michael/Workshop/project/example/elisp/example1.el
的elisp的代码更容易在其展开的形式读去函数my-dest-file-function
计算正确的文件名,但它似乎根本没有被使用,也没有使用(batch-byte-compile)
函数。
如何纠正上述elisp代码以产生所需的效果?我想避免在代码中使用任何单引号来轻松地使用shell和Makefiles。
我的emacs版本是24.5.1。
请参阅[设置字节编译目标文件函数](http://stackoverflow.com/questions/13957049/setting-byte-compile-dest-file-function) –
'batch-byte-compile'旨在被调用用'-f'。我猜你应该使用不同的编译功能。 – tripleee
@tripleee这个用法是合法的,请参阅Brian对实际问题的回答。 –