Hi Tassilo and others,
On Mon, Nov 23 2015, Tassilo Horn <[email protected]> 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
`TeX-after-compilation-finished-functions'?
--
Joost Kremers
Life has its moments
_______________________________________________
auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex