From e509cf6adc66d18cf632fd6b2e73a94b675fe4ee Mon Sep 17 00:00:00 2001 From: Karthik Chikmagalur Date: Sat, 15 Apr 2023 23:02:26 -0700 Subject: [PATCH] org-latex-preview: non-buffer-local auto-marker bug * lisp/org-latex-preview.el (org-latex-preview-auto--marker, org-latex-preview-auto-mode): `org-latex-preview-auto--marker' is initialized to a marker, which can cause it to not be buffer-local. Instead, initialize it to nil and explicitly set it to a marker when running `org-latex-preview-auto-mode'. --- lisp/org-latex-preview.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-latex-preview.el b/lisp/org-latex-preview.el index caec678e2..ea25ed77b 100644 --- a/lisp/org-latex-preview.el +++ b/lisp/org-latex-preview.el @@ -502,7 +502,7 @@ Faces in `org-latex-preview--ignored-faces' are ignored." (defvar-local org-latex-preview-auto--from-overlay nil "Whether the cursor if starting from within a preview overlay.") -(defvar-local org-latex-preview-auto--marker (make-marker) +(defvar-local org-latex-preview-auto--marker nil "Marker to keep track of the previous cursor position. This helps with tracking cursor movement into and out of preview overlays.") (defvar-local org-latex-preview-auto--inhibit nil @@ -742,6 +742,7 @@ them or vice-versa, customize the variable `org-latex-preview-auto-generate'." :global nil (if org-latex-preview-auto-mode (progn + (setq org-latex-preview-auto--marker (make-marker)) (add-hook 'pre-command-hook #'org-latex-preview-auto--handle-pre-cursor nil 'local) (org-latex-preview-auto--handle-pre-cursor) ; Invoke setup before the hook even fires. (add-hook 'post-command-hook #'org-latex-preview-auto--handle-post-cursor nil 'local)