I am creating and editing latex source files using AUCTeX. When I use the associated command for compiling the source file (C-c C-a) the file is successfully compiled and the resulting PDF output is displayed in a buffer in a second window that is automatically opened within the current frame.
If I make changes to the LaTeX source file and compile again, these changes do not automatically update the buffer containing the PDF. To display these changes I need to switch to the PDF buffer and execute the "revert buffer" command.
I'm wondering if anyone can suggest some elisp code that I can put into my config file that will automatically compile my latex source file upon any modification which in turn will automatically activate the "revert buffer" command thereby automatically displaying the alterations to the latex source file in the PDF output.
I posted a related question a few days ago on this forum that can be found here which relates to automatically saving a buffer when modified.
I'm sure the elisp code I'm looking for is somewhat similar to the code suggested to me in the previous post but unfortunately I don't have enough experience with programming/elisp to alter this code to suit my needs.
*edit: the code for automatically saving a buffer when modified
(defun savebuf(begin end length) (if (and (buffer-file-name) (buffer-modified-p)) (save-buffer))) (add-hook 'after-change-functions 'savebuf)