Hi Al and Arash,

Arash Esbati <[email protected]> writes:
> @Paul: Do you have any comments?  Otherwise, would you like to merge
> this?

Thanks, looks good to me, so I've pushed to master.

I've attached here the promised "compatibility shim" patch, discussed
earlier in this thread, for helping older configs transition to the new
setup.  Any comments would be welcome.

If it looks good, then I'll push and we can proceed to automatic
previewing.

Thanks, best,

Paul


>From 6eca08a186a2b9acd94e79cd934a413faaf94842 Mon Sep 17 00:00:00 2001
From: Paul Nelson <[email protected]>
Date: Wed, 11 Mar 2026 02:46:28 +0100
Subject: [PATCH] Add compatibility shim for obsolete preview option

When 'preview-leave-open-previews-visible' is set, automatically
configure 'preview-visibility-style' and
'preview-keep-stale-images' to match the old behavior (bug#79708).

* preview.el (preview-leave-open-previews-visible): Update
docstring.
(preview--obsolete-leave-open-previews-visible-apply)
(preview--obsolete-leave-open-previews-visible-watcher): New
helper functions.  Install watcher and apply any pre-load value.
---
 preview.el | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/preview.el b/preview.el
index b253ef88..490cb7f1 100644
--- a/preview.el
+++ b/preview.el
@@ -1343,23 +1343,42 @@ is located."
   (cons 'image (cdr icon)))
 
 (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.
-If non-nil, then the preview image remains visible.  In either case, the
-TeX code appears either below or to the right of the displayed graphic.
-
-If you enable this option, the preview image doesn't turn into
-construction sign temporarily when you edit the underlying LaTeX code
-and regenerate the preview; it is just replaced by updated image when
-ready.  This behavior suppresses flicker in the appearance."
+  "Obsolete option; whether to leave previews visible when they are opened.
+This option is obsolete.  When set to non-nil, it configures
+`preview-visibility-style' to \\='always and `preview-keep-stale-images'
+to t.  When set to nil, it does not change those variables."
   :group 'preview-appearance
   :type 'boolean)
 
+(defun preview--obsolete-leave-open-previews-visible-apply (value)
+  "Apply obsolete `preview-leave-open-previews-visible' VALUE.
+When VALUE is non-nil, configure `preview-visibility-style' and
+`preview-keep-stale-images' to match the old behavior."
+  (when value
+    (set-default 'preview-visibility-style 'always)
+    (set-default 'preview-keep-stale-images t)))
+
+(defun preview--obsolete-leave-open-previews-visible-watcher
+    (_symbol newval operation where)
+  (when (and (eq operation 'set)
+             ;; Ignore buffer-local bindings.
+             (null where))
+    (preview--obsolete-leave-open-previews-visible-apply newval)))
+
 (make-obsolete-variable
  'preview-leave-open-previews-visible
  "Use `preview-visibility-style' and `preview-keep-stale-images' instead."
  "14.2.0")
 
+(add-variable-watcher
+ 'preview-leave-open-previews-visible
+ #'preview--obsolete-leave-open-previews-visible-watcher)
+
+;; Handle `setq' from before preview.el is loaded.
+(when (default-value 'preview-leave-open-previews-visible)
+  (preview--obsolete-leave-open-previews-visible-apply
+   (default-value 'preview-leave-open-previews-visible)))
+
 (defsubst preview-replace-active-icon (ov replacement)
   "Replace the active Icon in OV by REPLACEMENT, another icon."
   (let ((img (overlay-get ov 'preview-image)))
-- 
2.50.1 (Apple Git-155)

_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to