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'.
This commit is contained in:
Karthik Chikmagalur 2023-04-15 23:02:26 -07:00 committed by TEC
parent 2835c96dcf
commit e509cf6adc
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 2 additions and 1 deletions

View File

@ -502,7 +502,7 @@ Faces in `org-latex-preview--ignored-faces' are ignored."
(defvar-local org-latex-preview-auto--from-overlay nil (defvar-local org-latex-preview-auto--from-overlay nil
"Whether the cursor if starting from within a preview overlay.") "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. "Marker to keep track of the previous cursor position.
This helps with tracking cursor movement into and out of preview overlays.") This helps with tracking cursor movement into and out of preview overlays.")
(defvar-local org-latex-preview-auto--inhibit nil (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 :global nil
(if org-latex-preview-auto-mode (if org-latex-preview-auto-mode
(progn (progn
(setq org-latex-preview-auto--marker (make-marker))
(add-hook 'pre-command-hook #'org-latex-preview-auto--handle-pre-cursor nil 'local) (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. (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) (add-hook 'post-command-hook #'org-latex-preview-auto--handle-post-cursor nil 'local)