[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/preview-auto f07b210e05 10/36: Allow automatic refresh
From: |
ELPA Syncer |
Subject: |
[elpa] externals/preview-auto f07b210e05 10/36: Allow automatic refresh of previews after compilation |
Date: |
Thu, 6 Jun 2024 03:59:52 -0400 (EDT) |
branch: externals/preview-auto
commit f07b210e05c7378d39e38947f91e2e70d14c9f8f
Author: Paul Nelson <ultrono@gmail.com>
Commit: Paul Nelson <ultrono@gmail.com>
Allow automatic refresh of previews after compilation
* preview-auto.el (preview-auto-refresh-after-compilation): New
variable.
(preview-auto--already-previewed-at): Use it.
This combines well with the tex-numbers and tex-continuous package to
give live updates of equation numbers in previews.
---
preview-auto.el | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/preview-auto.el b/preview-auto.el
index d9b2150cad..dc5d1f8096 100644
--- a/preview-auto.el
+++ b/preview-auto.el
@@ -136,12 +136,33 @@ Ignore comments and verbatim environments."
(when (not (preview-auto--cheap-comment))
(throw 'found (point))))))
-(defun preview-auto--already-previewed-at (pos)
- "Return non-nil when there a non-disabled preview overlay at POS."
- (cl-intersection (mapcar (lambda (ov)
- (overlay-get ov 'preview-state))
- (overlays-at (or pos (point))))
- '(active inactive)))
+(defcustom preview-auto-refresh-after-compilation t
+ "If non-nil, refresh previews after each compilation.
+This plays well with the packages `tex-numbers' and `tex-continuous':
+the result is that preview equation numbers are updated automatically to
+the correct form."
+ :type 'boolean)
+
+(defun preview-auto--already-previewed-at (&optional pos)
+ "Return non-nil when there is a non-disabled preview overlay at POS.
+A preview is considered non-disabled if it is active or inactive
+according to `preview.el'. If `preview-auto-refresh-after-compilation'
+is non-nil, then we further require that the preview has been generated
+more recently than the aux file."
+ (cl-some
+ (lambda (ov)
+ (and
+ (memq (overlay-get ov 'preview-state) '(active inactive))
+ (or (null preview-auto-refresh-after-compilation)
+ (let* ((image (overlay-get ov 'preview-image))
+ (image-file (nth 1 image))
+ (image-time (nth 5 (file-attributes image-file)))
+ (aux-file (TeX-master-file "aux"))
+ (aux-time (nth 5 (file-attributes aux-file))))
+ (or (null image-time)
+ (null aux-time)
+ (time-less-p aux-time image-time))))))
+ (overlays-at (or pos (point)))))
(defcustom preview-auto-predicate nil
"Additional predicate for determining preview validity.
- [elpa] externals/preview-auto 7cd2a48cbd 17/36: remove cl-lib dependency, (continued)
- [elpa] externals/preview-auto 7cd2a48cbd 17/36: remove cl-lib dependency, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 17f845637d 16/36: Fix weird capitalization bug, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 0123c04c53 19/36: clean-up docstring, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 0e0f015a9b 23/36: indentation, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 712c8c078a 24/36: Check for math faces only with "$" delimiters, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 49851857d1 26/36: fix, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 8d3b46acd2 27/36: Add "%" to list of barriers, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto f2b404cc96 28/36: Make sure preview-move-point is in post-command-hook, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 305341df9d 29/36: Make delimiter inclusion checking customizable, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 3b0dc96643 34/36: add missing :type, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto f07b210e05 10/36: Allow automatic refresh of previews after compilation,
ELPA Syncer <=
- [elpa] externals/preview-auto 596c902166 18/36: correct docstring, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto dc7d7aa450 30/36: Configure font-lock to detect math regions, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 67121ad1c5 33/36: tweak readme, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 0d8ccac798 36/36: fix typo, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 7d7207a4dd 14/36: fix bug involving editing region updates, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto a9e0fd5de9 06/36: tidy, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto e3315721e1 04/36: simplifications, optimizations, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 2806a42660 07/36: reduce default preview-auto-interval to 0.1, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 55404b8599 13/36: correct version number, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto f7190d7678 15/36: delete irrelevant comments, ELPA Syncer, 2024/06/06