I want to write a macro that makes a diffpdf
before and after some changes in my LaTeX
file (that would be compiled twice by pdflatex
).
I tried:
(defmacro with-diffpdf-after-changes (&rest body)
"DOCSTRING"
(declare (indent 1))
(let* ((FILE_NAME (file-name-sans-extension (buffer-name)))
(PDF_FILE (concat FILE_NAME ".pdf")))
`(progn
(save-buffer)
(call-process-shell-command
(concat "pdflatex \"\\let\\oldExecuteOptions\\ExecuteOptions\"\\\n"
"\"\\def\\ExecuteOptions#1{\\oldExecuteOptions{#1,draft}}\"\\\n"
"\"\\nonstopmode\\input{" (buffer-name) "}\";"
"mv " ,PDF_FILE " /tmp/" )
nil nil)
,@body
(save-buffer)
(call-process-shell-command
(concat "pdflatex \"\\let\\oldExecuteOptions\\ExecuteOptions\"\\\n"
"\"\\def\\ExecuteOptions#1{\\oldExecuteOptions{#1,draft}}\"\\\n"
"\"\\nonstopmode\\input{" (buffer-name) "}\";"
"diffpdf -a " ,PDF_FILE " /tmp/" ,PDF_FILE )
nil nil)
)
))
But something's wrong with my code. PDF_FILE
is named by the file that calls the macro while I need it to be named by the buffer of my LaTeX file.
E.g. my LaTeX file is paper.tex
, the macro is called by a function in the file replacements.el
I get that the macro makes diffpdf
look for ./replacements.pdf
and /tmp/replacements.pdf
I need diffpdf paper.pdf /tmp/paper.pdf
.
let
bindings are happening outside of that.(info "(elisp) Problems with Macros")
.