[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
main 26807f1c 2/3: Flush preview images when leaving previews visible
From: |
Arash Esbati |
Subject: |
main 26807f1c 2/3: Flush preview images when leaving previews visible |
Date: |
Sun, 1 Jun 2025 14:25:22 -0400 (EDT) |
branch: main
commit 26807f1cfdb8573bad60765b47ca2b70723d5262
Author: Paul Nelson <ultrono@gmail.com>
Commit: Arash Esbati <arash@gnu.org>
Flush preview images when leaving previews visible
* preview.el (preview-replace-active-icon): When
`preview-leave-open-previews-visible' is t, flush the current
image spec before mutating it in place. Without this flush,
Emacs might still show the cached previous image (see Emacs
bug#59902 for related discussion). (bug#78627)
---
preview.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/preview.el b/preview.el
index 7f1027dc..3b3f63ac 100644
--- a/preview.el
+++ b/preview.el
@@ -1,6 +1,6 @@
;;; preview.el --- embed preview LaTeX images in source buffer -*-
lexical-binding: t; -*-
-;; Copyright (C) 2001-2024 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2025 Free Software Foundation, Inc.
;; Author: David Kastrup
;; Keywords: tex, text, convenience
@@ -1204,12 +1204,6 @@ is located."
(cons 'image (cdr icon)))
-(defsubst preview-replace-active-icon (ov replacement)
- "Replace the active Icon in OV by REPLACEMENT, another icon."
- (let ((img (overlay-get ov 'preview-image)))
- (setcdr (car img) (cdar replacement))
- (setcdr img (cdr replacement))))
-
(defcustom preview-leave-open-previews-visible nil
"Whether to leave previews visible when they are opened.
If nil, then the TeX preview icon is used when the preview is opened.
@@ -1223,6 +1217,16 @@ ready. This behavior suppresses flicker in the
appearance."
:group 'preview-appearance
:type 'boolean)
+(defsubst preview-replace-active-icon (ov replacement)
+ "Replace the active Icon in OV by REPLACEMENT, another icon."
+ (let ((img (overlay-get ov 'preview-image)))
+ (when (and preview-leave-open-previews-visible
+ (consp img))
+ ;; No "TeX icon" has been shown, so we flush manually.
+ (image-flush (car img) t))
+ (setcdr (car img) (cdar replacement))
+ (setcdr img (cdr replacement))))
+
(defun preview-gs-place (ov snippet box run-buffer tempdir ps-file _imagetype)
"Generate an image placeholder rendered over by Ghostscript.
This enters OV into all proper queues in order to make it render
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- main 26807f1c 2/3: Flush preview images when leaving previews visible,
Arash Esbati <=