emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex b3153ec 16/26: Add function for reverting docume


From: Tassilo Horn
Subject: [elpa] externals/auctex b3153ec 16/26: Add function for reverting document buffer
Date: Fri, 13 Nov 2015 17:00:37 +0000

branch: externals/auctex
commit b3153ec5dcdd4ea3b79fe710f32ea6bd49ce8bc1
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Add function for reverting document buffer
    
    * tex-buf.el (TeX-revert-document-buffer): New function.
    (TeX-after-TeX-LaTeX-command-finished-hook): Mention it in docstring.
    * doc/auctex.texi (Modes and Hooks): Mention it in manual.
---
 doc/auctex.texi |    4 +++-
 tex-buf.el      |   19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/doc/auctex.texi b/doc/auctex.texi
index 4b0f001..8c02499 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -3599,9 +3599,11 @@ 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.
+PDF Tools.  The function @code{TeX-revert-document-buffer} can be added
+to the hook for this purpose.
 @end defvr
 @vindex TeX-after-TeX-LaTeX-command-finished-hook
address@hidden TeX-revert-document-buffer
 
 @node Multifile
 @section Multifile Documents
diff --git a/tex-buf.el b/tex-buf.el
index 61a61ad..bc19f7d 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -889,7 +889,24 @@ the current style options."
   "Hook being run after TeX/LaTeX finished successfully.
 The functions in this hook are run with the DVI/PDF output file
 given as argument.  Using this hook can be useful for updating
-the viewer automatically after re-compilation of the document.")
+the viewer automatically after re-compilation of the document.
+
+If you use an emacs-internal viewer such as `doc-view-mode' or
+`pdf-view-mode', add `TeX-revert-document-buffer' to this hook.")
+
+(defun 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'.)"
+  (let ((buf (find-buffer-visiting file)))
+    (when buf
+      (with-current-buffer buf
+       (revert-buffer nil t t)))))
 
 (defvar TeX-after-start-process-function nil
   "Hooks to run after starting an asynchronous process.



reply via email to

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