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

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

[elpa] externals/auctex a2a4777 25/35: Add TeX-after-TeX-LaTeX-command-f


From: Tassilo Horn
Subject: [elpa] externals/auctex a2a4777 25/35: Add TeX-after-TeX-LaTeX-command-finished-hook
Date: Sun, 22 Mar 2015 09:27:06 +0000

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

    Add TeX-after-TeX-LaTeX-command-finished-hook
    
    * doc/auctex.texi (Modes and Hooks): Document
    TeX-after-TeX-LaTeX-command-finished-hook.
    
    * tex-buf.el (TeX-after-TeX-LaTeX-command-finished-hook): New
    hook.
    (TeX-LaTeX-sentinel): Call it.
---
 ChangeLog       |    9 +++++++++
 doc/auctex.texi |   14 ++++++++++++++
 tex-buf.el      |   17 ++++++++++++++---
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 826ca12..704ad0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-03-10  Tassilo Horn  <address@hidden>
+
+       * doc/auctex.texi (Modes and Hooks): Document
+       TeX-after-TeX-LaTeX-command-finished-hook.
+
+       * tex-buf.el (TeX-after-TeX-LaTeX-command-finished-hook): New
+       hook.
+       (TeX-LaTeX-sentinel): Call it.
+
 2015-03-09  Mos� Giordano  <address@hidden>
 
        * tex-buf.el (TeX-find-display-help): Display the help also when
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 3f4ba91..6fb6d71 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -3488,6 +3488,20 @@ if it is relevant for any @AUCTeX{} mode, add it to 
@code{TeX-mode-hook}
 and if it is relevant for all text modes, append it to
 @code{text-mode-hook}.
 
+Other useful hooks are listed below.
+
address@hidden Variable TeX-after-TeX-LaTeX-command-finished-hook
+Hook which is run after the @TeX{}/@LaTeX{} processor has successfully
+finished compiling your document.  (@xref{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.
address@hidden defvr
address@hidden TeX-after-TeX-LaTeX-command-finished-hook
+
 @node Multifile
 @section Multifile Documents
 @cindex Multifile Documents
diff --git a/tex-buf.el b/tex-buf.el
index 1385f48..c61ffaf 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -557,8 +557,8 @@ QUEUE is non-nil when we are checking for the printer 
queue."
   (if (listp TeX-output-extension)
       (car TeX-output-extension)
     (or (TeX-process-get-variable (TeX-active-master)
-                               'TeX-output-extension
-                               TeX-output-extension)
+                                 'TeX-output-extension
+                                 TeX-output-extension)
        TeX-output-extension)))
 
 (defun TeX-view-mouse (event)
@@ -603,6 +603,12 @@ the current style options."
 
 ;;; Command Hooks
 
+(defvar TeX-after-TeX-LaTeX-command-finished-hook nil
+  "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.")
+
 (defvar TeX-after-start-process-function nil
   "Hooks to run after starting an asynchronous process.
 Used by Japanese TeX to set the coding system.")
@@ -1110,7 +1116,12 @@ changed\\. Rerun LaTeX\\." nil t)
         (setq TeX-command-next TeX-command-Show))
        (t
         (message "%s%s%s" name ": problems after " (TeX-current-pages))
-        (setq TeX-command-next TeX-command-default))))
+        (setq TeX-command-next TeX-command-default)))
+  (unless TeX-error-list
+    (run-hook-with-args 'TeX-after-TeX-LaTeX-command-finished-hook
+                       (with-current-buffer TeX-command-buffer
+                         (expand-file-name
+                          (TeX-active-master (TeX-output-extension)))))))
 
 ;; should go into latex.el? --pg
 (defun TeX-BibTeX-sentinel (process name)



reply via email to

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