I'm looking to add some elisp to my init file that will execute a number of additional functions when I call a particular command.
More specifically, when I execute the compile and view command using AUCTeX I have added the following code to automatically revert-buffer
on the PDF output buffer (suggested to me in another post on this forum).
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
The problem is after the execution of this function the active window is the PDF output buffer rather than the buffer containing the LaTeX source file. I'm using the ACE-windows
package for window navigation and I notice that within this package there is a noninteractive function for switching to the previous active window called aw-flip-window
.
How can I edit my code so that I can add this function to the list of functions executed when I called the compile and view command?
**edit: the eventual solution utilised the majority of the code suggested in the reply highlighted as the solution with one alteration. Namely, that the native Ace Windows function aw-flip-window
was replaced with PDFview major mode command as part of the PDFtools package pdf-outline
as can be seen in the code below.
(defun my-TeX-revert-document-buffer (file)
(TeX-revert-document-buffer file)
(pdf-outline))
(add-hook 'TeX-after-compilation-finished-functions #'My-TeX-revert-document-buffer)
However I don't know why this particular solution works and I would be interested to hear any ideas why this may be the case.
Tex-revert-*
but that puts things back the way you want.Tex-whatever
, and put your function on the hook instead. Just a thought - no idea what's really needed.