I wrote a script that reads the .aux and .log files after some replacements in the ·tex file (LaTeX). To achieve this i did:

(read-string "Wait to tex-file to complete, then press ENTER:")

So I wait for tex-file to complete and then I press ENTER to make the script go on in reading the (re)genereted files.

I'd like to obtain the same result without the read-string command, with the script automatically waits for tex-file to compleate.

I read about sentinels but I'm not able to use them. I can't figure out how they works.

  • Here are a few examples using process sentinels -- one is for AUCTeX, and two are for without the AUCTeX library (one is for Windows, and one is for OSX): tex.stackexchange.com/a/156617/26911 The non-AUCTeX example was designed to use in conjunction with a latexmk.rc file. For some nested examples of process sentinels see: stackoverflow.com/questions/24548536/…
    – lawlist
    Commented Apr 21, 2017 at 23:15
  • @ShreevatsaR I see it in the log buffer...
    – Gabriele
    Commented Apr 21, 2017 at 23:22

1 Answer 1


I found a solution to my problem here: https://stackoverflow.com/questions/23021875/wait-on-shell-command-to-finish-before-executing-another-elisp-command

I resolved by using:

(call-process-shell-command  (concat "latex " (buffer-file-name)) nil nil)

that does almost the same and that doesn't use sentinels.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.