Setting byte-compile-dest-file-function

烈酒焚心 提交于 2019-12-02 07:43:35

To set the byte-compile-dest-function variable, you can use either customize-variable interactively, or setq in your init file. Since you'll have to write a function doing the job either way, I would recommand the latter, so that everything is in the same place in your init file.

For example:

(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)

You can find it using C-h v followed by that variable name.

(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")

You can see that it is a customizable variable, so you can change it's value to "function".

EDIT: I am not so sure this is the variable you want to change. In fact, you can see that it deals with the variable directories often, I don't see how to set a certain directory where all the .elc's should go.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!