From 6c1ff952feabd7ab0051ed200df7b736a691a2d6 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Wed, 2 Aug 2023 08:16:47 +0300 Subject: [PATCH] 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 Link: https://orgmode.org/list/871qgmeleu.fsf@gmail.com --- lisp/org-clock.el | 1 + lisp/org-colview.el | 1 + lisp/org-num.el | 1 + lisp/org-table.el | 2 ++ lisp/org.el | 7 +++++++ 5 files changed, 12 insertions(+) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index d7fe14cd5..b85ce6a63 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -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. diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 92a3b473d..28cfd0d91 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -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.") diff --git a/lisp/org-num.el b/lisp/org-num.el index cbe5e455e..807fa6622 100644 --- a/lisp/org-num.el +++ b/lisp/org-num.el @@ -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. diff --git a/lisp/org-table.el b/lisp/org-table.el index 83bad3f3a..fd10ccf57 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -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." diff --git a/lisp/org.el b/lisp/org.el index 0043c0407..c5c080810 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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."