Hi, I have a function to compress my pdf file using pdftk:
(defun compresspdf (filename)
(interactive)
(let ((tmpfile (concat filename "~")))
(start-process-shell-command "pdftk" nil
(format "pdftk %s cat output %s compress dont_ask"
filename tmpfile))
(rename-file tmpfile filename t)))
It compresses the file and saves it as the same name with ~
appended. However, at the point where it's supposed to rename the file, it gives me an error:
let: Renaming: No such file or directory, /pathtofile/mypdf.pdf~, /pathtofile/mypdf.pdf
, though clearly, both of these files exist. I can separately evaluate rename-file afterwards and it works fine. Maybe it's trying to rename the ~
file before it's actually created? In that case, how can I make it wait until the process is finished? (and possibly check for errors?)