org-colview: Do not remap faces repeatedly

* lisp/org-colview.el (org-columns--display-here):
(org-columns-remove-overlays): Do not call `face-remap-add-relative'
after it is already called.  For large files,
`face-remap-add-relative' can take more than 90% CPU time.  Set
`org-columns-header-line-remap' to nil when we remove the temporary
remapping.
This commit is contained in:
Ihor Radchenko 2022-01-17 20:12:32 +08:00
parent 8d9ca0eac1
commit f41ba23689
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 2 deletions

View File

@ -377,7 +377,8 @@ This is needed to later remove this relative remapping.")
COLUMNS is an alist (SPEC VALUE DISPLAYED). Optional argument
DATELINE is non-nil when the face used should be
`org-agenda-column-dateline'."
(when (ignore-errors (require 'face-remap))
(when (and (ignore-errors (require 'face-remap))
org-columns-header-line-remap)
(setq org-columns-header-line-remap
(face-remap-add-relative 'header-line '(:inherit default))))
(save-excursion
@ -514,7 +515,8 @@ for the duration of the command.")
(interactive)
(when (and (fboundp 'face-remap-remove-relative)
org-columns-header-line-remap)
(face-remap-remove-relative org-columns-header-line-remap))
(face-remap-remove-relative org-columns-header-line-remap)
(setq org-columns-header-line-remap nil))
(when org-columns-overlays
(when (local-variable-p 'org-previous-header-line-format)
(setq header-line-format org-previous-header-line-format)