[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/preview-auto e3c991e8ea 09/36: add preview-auto--debug-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/preview-auto e3c991e8ea 09/36: add preview-auto--debug-log, insert debugging statements |
Date: |
Thu, 6 Jun 2024 03:59:52 -0400 (EDT) |
branch: externals/preview-auto
commit e3c991e8eac91a6453c912e9bea2e84bab893852
Author: Paul Nelson <ultrono@gmail.com>
Commit: Paul Nelson <ultrono@gmail.com>
add preview-auto--debug-log, insert debugging statements
---
preview-auto.el | 38 ++++++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/preview-auto.el b/preview-auto.el
index 1ca1b49185..d9b2150cad 100644
--- a/preview-auto.el
+++ b/preview-auto.el
@@ -276,10 +276,19 @@ It can be useful to turn this off when using edebug.")
(defvar preview-auto--debug nil
"If non-nil, print debug messages.")
+(defun preview-auto--debug-log (format-string &rest args)
+ "Print a debug message if `preview-auto--debug' is non-nil."
+ (when preview-auto--debug
+ (with-current-buffer (get-buffer-create "*preview-auto-debug*")
+ (goto-char (point-min))
+ (insert
+ (format-time-string "%Y-%m-%d %H:%M:%S.%6N ")
+ (apply #'format format-string args))
+ (insert "\n"))))
+
(defun preview-auto--region-wrapper (beg end)
"Preview region between BEG and END, possibly inhibiting messages."
- (when preview-auto--debug
- (message "Previewing region %d, %d" beg end))
+ ;; (preview-auto--debug-log "Previewing region %d, %d" beg end)
(let ((inhibit-message preview-auto--inhibit-message))
(preview-region beg end)))
@@ -312,6 +321,7 @@ It can be useful to turn this off when using edebug.")
(and (string= why "$")
(string-match
"[\n\r]" (buffer-substring-no-properties begin end)))
+ (preview-auto--debug-log "Previewing editing region %d, %d"
begin end)
(preview-auto--region-wrapper begin end))))))))))
(defun preview-auto--base-range ()
@@ -352,9 +362,11 @@ group."
(cond
((when-let ((region (preview-auto--last-valid-region
pmin (min pmax (point)))))
+ (preview-auto--debug-log "Previewing above: %d, %d" (car region)
(cdr region))
(preview-auto--region-wrapper (car region) (cdr region))))
((when-let ((region (preview-auto--first-valid-region
(max pmin (point)) pmax)))
+ (preview-auto--debug-log "Previewing below: %d, %d" (car region)
(cdr region))
(preview-auto--region-wrapper (car region) (cdr region))))
((and
(< pmin (point) pmax)
@@ -380,15 +392,29 @@ Check that we are not visiting a bbl file."
(string-match-p "\\.bbl\\'" (buffer-file-name)))
(preview-auto-mode 1)))
-(defun preview-auto--after-change (beg _end _length)
+(defun preview-auto--after-change (beg end length)
"Hook function for `preview-auto-mode'.
BEG is the start of the modified region, END is the end of the region,
and LENGTH is the length of the modification. If the modification
occurs before some region where a preview is being generated, then
cancel the preview, so that the preview is not misplaced."
- (when (and preview-current-region
- (< beg (cdr preview-current-region)))
- (ignore-errors (TeX-kill-job))))
+ (preview-auto--debug-log "After change:")
+ (preview-auto--debug-log " %d, %d, %d" beg end length)
+ (when preview-current-region
+ (preview-auto--debug-log " (%d, %d)"
+ (car preview-current-region)
+ (cdr preview-current-region))
+ (when-let ((proc (get-buffer-process (TeX-process-buffer-name
(TeX-region-file)))))
+ (preview-auto--debug-log " region: %s" proc))
+ (when-let ((proc (get-buffer-process (TeX-process-buffer-name
(TeX-master-file)))))
+ (preview-auto--debug-log " master: %s" proc)))
+ (if (and preview-current-region
+ (< beg (cdr preview-current-region)))
+ (progn
+ (preview-auto--debug-log "Cancelling preview")
+ (ignore-errors (TeX-kill-job))
+ (setq preview-abort-flag t))
+ (preview-auto--debug-log "Not cancelling preview")))
(defun preview-auto--post-command ()
"Function called after each command in `preview-auto-mode'."
- [elpa] branch externals/preview-auto created (now 0d8ccac798), ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto ea23b65582 01/36: Initial commit, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto b97a587d61 02/36: Add files via upload, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 24ae7aa764 03/36: un-break empty regions issue, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 14013d6cca 05/36: tweaks, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 771af1f407 08/36: Add includegraphics to default preview-auto-barriers, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto e3c991e8ea 09/36: add preview-auto--debug-log, insert debugging statements,
ELPA Syncer <=
- [elpa] externals/preview-auto 2227cf9cf8 11/36: Further restrict where previews generate, ELPA Syncer, 2024/06/06
- [elpa] externals/preview-auto 0887964888 12/36: clean up, add readme, ELPA Syncer, 2024/06/06
- [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