2016-06-07 2 views
0

사용자 정의 디렉토리에 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 코드를 어떻게 수정할 수 있습니까? elisp 코드의 작은 따옴표가 쉘 및 Makefile을 사용하여 쉽게 작동하지 않도록하고 싶습니다.

내 이맥스 버전은 24.5.1입니다.

+0

[바이트 컴파일 대상 파일 설정 기능] (http://stackoverflow.com/questions/13957049/setting-byte-compile-dest-file-function) –

+0

'batch-byte-compile'을 호출하려고합니다. '-f'와 함께. 나는 이것을 위해 다른 컴파일 기능을 사용해야한다고 생각한다. – tripleee

+0

@tripleee이 사용법은 합법적입니다. 실제 문제에 대한 Brian의 대답을 참조하십시오. –

답변

1

당신은 progn에서 모든 일을 마무리해야합니다

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

하기 전에, 당신은 단지 자체에 아무것도하지 않는 첫 번째 문, defun을 실행했다.

+0

아아, 나는 너무 가까웠다! ;) 이것은 정확히 내가 알 필요가있는 것입니다, 정말 고마워요! –

관련 문제