Reputation: 1186
I'm generating byte-compiled files (*.elc) using the batch-byte-compile
function. This function writes out the *.elc files in the same directory as the *.el files.
How can I have Emacs generate the byte-compiled files in a different directory?
An ideal solution would be operational system agnostic.
Upvotes: 1
Views: 209
Reputation: 42094
Emacs uses byte-compile-dest-file
to generate a compiled file name from a source file name. That function delegates to customizable variable byte-compile-dest-file-function
if non-nil.
So you can simply define it. Something like this:
(defun my-byte-compile-dest-file (source-file)
(concat (file-name-directory source-file)
"prefix-"
(file-name-base source-file)
"-compiled"))
(setq byte-compile-dest-file-function 'my-byte-compile-dest-file)
Upvotes: 2