[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] auctex Digest, Vol 129, Issue 18: Setup for new PDF-Tools

From: Tassilo Horn
Subject: Re: [AUCTeX] auctex Digest, Vol 129, Issue 18: Setup for new PDF-Tools
Date: Sat, 21 Nov 2015 08:15:36 +0100
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

AW <address@hidden> writes:

> (require 'subr-x)
> (defun th/pdf-view-revert-buffer-maybe (file)
> (when-let ((buf (find-buffer-visiting file)))
> (with-current-buffer buf
> (when (derived-mode-p 'pdf-view-mode)
> (pdf-view-revert-buffer nil t)))))
> (add-hook 'TeX-after-TeX-LaTeX-command-finished-hook
> #'th/pdf-view-revert-buffer-maybe)

Note that this private function of mine is now included in AUCTeX in a
slightly different version that works for doc-view and pdf-tools.  The
manual describes the setup.

,----[ (info "(auctex)Modes and Hooks") ]
|  -- Variable: TeX-after-TeX-LaTeX-command-finished-hook
|      Hook which is run after the TeX/LaTeX processor has successfully
|      finished compiling your document.  (*Note Processing::, for finding
|      out how to compile your document).  Each function in the hook is
|      run with the compiled output document as its argument.
|      This is useful for automatically refreshing the viewer after
|      re-compilation especially when using Emacs viewers such as DocView
|      or PDF Tools.  The function 'TeX-revert-document-buffer' can be
|      added to the hook for this purpose.

,----[ C-h f TeX-revert-document-buffer RET ]
| TeX-revert-document-buffer is a compiled Lisp function in ‘tex-buf.el’.
| (TeX-revert-document-buffer FILE)
| Revert the buffer visiting FILE.
| This function is intended to be used in
| ‘TeX-after-TeX-LaTeX-command-finished-hook’ for users that view
| their compiled document with an emacs viewer such as
| ‘doc-view-mode’ or ‘pdf-view-mode’.  (Note that this function
| just calls ‘revert-buffer’ in the respective buffer and thus
| requires that the corresponding mode defines a sensible
| ‘revert-buffer-function’.)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]