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 the addition ~. However, at the point where the file is supposed to be renamed, this gives me an error:
let: Renaming: No such file or directory, /pathtofile/mypdf.pdf~, /pathtofile/mypdf.pdfalthough it is obvious that both of these files exist. After that, I can separately evaluate the rename file, and it works fine. Maybe he is trying to rename the file ~before creating it? In this case, how can I make it wait until the process is complete? (and maybe check for errors?)
source
share