Make transient overlay lists permanent-local

* lisp/org-clock.el (org-clock-overlays):
* lisp/org-colview.el (org-columns-overlays):
* lisp/org-num.el (org-num--overlays):
* lisp/org-table.el (org-table-header-overlay):
(org-table-coordinate-overlays):
* lisp/org.el (org-custom-properties-overlays):
(org-occur-highlights):
(org-inline-image-overlays): Mark as permanent-local to not lose track
of the overlays when changing major modes.

Reported-by: Eli Qian <eli.q.qian@gmail.com>
Link: https://orgmode.org/list/871qgmeleu.fsf@gmail.com
This commit is contained in:
Ihor Radchenko 2023-08-02 08:16:47 +03:00
parent d1d0c30e65
commit 6c1ff952fe
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
5 changed files with 12 additions and 0 deletions

View File

@ -2069,6 +2069,7 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times."
h m))))
(defvar-local org-clock-overlays nil)
(put 'org-clock-overlays 'permanent-local t)
(defun org-clock-put-overlay (time)
"Put an overlay on the headline at point, displaying TIME.

View File

@ -116,6 +116,7 @@ in `org-columns-summary-types-default', which see."
(defvar-local org-columns-overlays nil
"Holds the list of current column overlays.")
(put 'org-columns-overlays 'permanent-local t)
(defvar-local org-columns-current-fmt nil
"Local variable, holds the currently active column format.")

View File

@ -156,6 +156,7 @@ control tag inheritance."
(defvar-local org-num--overlays nil
"Ordered list of overlays used for numbering outlines.")
(put 'org-num--overlays 'permanent-local t)
(defvar-local org-num--skip-level nil
"Level below which headlines from current tree are not numbered.

View File

@ -477,6 +477,7 @@ This may be useful when columns have been shrunk."
(format "|%s" (mapconcat #'identity (reverse str) "")))))
(defvar-local org-table-header-overlay nil)
(put 'org-table-header-overlay 'permanent-local t)
(defun org-table-header-set-header ()
"Display the header of the table at point."
(let ((gcol temporary-goal-column))
@ -3812,6 +3813,7 @@ FACE, when non-nil, for the highlight."
(defvar-local org-table-coordinate-overlays nil
"Collects the coordinate grid overlays, so that they can be removed.")
(put 'org-table-coordinate-overlays 'permanent-local t)
(defun org-table-overlay-coordinates ()
"Add overlays to the table at point, to show row/column coordinates."

View File

@ -5893,6 +5893,8 @@ needs to be inserted at a specific position in the font-lock sequence.")
(defvar-local org-custom-properties-overlays nil
"List of overlays used for custom properties.")
;; Preserve when switching modes or when restarting Org.
(put 'org-custom-properties-overlays 'permanent-local t)
(defun org-toggle-custom-properties-visibility ()
"Display or hide properties in `org-custom-properties'."
@ -10673,6 +10675,7 @@ D Show deadlines and scheduled items between a date range."
(defvar-local org-occur-highlights nil
"List of overlays used for occur matches.")
(put 'org-occur-highlights 'permanent-local t)
(defvar-local org-occur-parameters nil
"Parameters of the active org-occur calls.
This is a list, each call to org-occur pushes as cons cell,
@ -16159,6 +16162,10 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML."
;; Image display
(defvar-local org-inline-image-overlays nil)
;; Preserve when switching modes or when restarting Org.
;; If we clear the overlay list and later enable Or mode, the existing
;; image overlays will never be cleared by `org-toggle-inline-images'.
(put 'org-inline-image-overlays 'permanent-local t)
(defun org--inline-image-overlays (&optional beg end)
"Return image overlays between BEG and END."