[Top][All Lists]

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

[AUCTeX] Notification at end of TeX run (was: auctex Digest, Vol 129, I

From: Joost Kremers
Subject: [AUCTeX] Notification at end of TeX run (was: auctex Digest, Vol 129, Issue 18: Setup for new PDF-Tools)
Date: Tue, 24 Nov 2015 00:48:01 +0100
User-agent: mu4e 0.9.15; emacs 24.5.2

Hi Tassilo and others,

On Mon, Nov 23 2015, Tassilo Horn <address@hidden> wrote:
> Ok, I've renamed it now in the code and the docs, and the old name is
> now an obsolete variable alias.  

Cool, I just started (ab)using this hook as follows:

(require 'notifications)
(defun jk-notify-TeX-run-finish (file)
  "Display a notification when a TeX run is finished."
  (notifications-notify :title "AUCTeX"
                        :body (format "Finished: %s\n%s" 
(file-name-nondirectory file) (current-message))))
(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook #'jk-notify-TeX-run-finish)

Running LaTeX can take a long time (large project, many pictures, slow
computer sometimes) and I tend to switch to something else while LaTeX
is doing its thing. Now I get a notification when it's done. :)

BTW, regarding the `hook' part of the name
TeX-after-TeX-LaTeX-command-finished-hook, (or the new
TeX-after-compilation-finished-hook), the Elisp manual, section "Hooks"
mentions that a name ending in `-hook' indicates that the functions in
the hook don't take any arguments:

|    Most of the hooks in Emacs are "normal hooks".  These variables
| contain lists of functions to be called with no arguments.  By
| convention, whenever the hook name ends in ‘-hook’, that tells you it is
| normal.  We try to make all hooks normal, as much as possible, so that
| you can use them in a uniform way.
| [...]
|    If the hook variable’s name does not end with ‘-hook’, that indicates
| it is probably an "abnormal hook".  That means the hook functions are
| called with arguments, or their return values are used in some way.  The
| hook’s documentation says how the functions are called.  You can use
| ‘add-hook’ to add a function to an abnormal hook, but you must write the
| function to follow the hook’s calling convention.  By convention,
| abnormal hook names end in ‘-functions’.

So perhaps, for consistency's sake, the name should be

Joost Kremers
Life has its moments

reply via email to

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