From 7e547fd3b65f0df734ef1177a8ba63f157e81bca Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sun, 11 Feb 2024 16:25:37 +0100 Subject: [PATCH] org-columns--display-here: Cache result of `substitute-command-keys' * lisp/org-colview.el (org-columns--read-only-string): (org-columns--display-here): Cache return value of `substitede-command-keys' in a variable. It is otherwise slow to call it every time a row is displayed. --- lisp/org-colview.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 3e6336a05..15e051377 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -365,6 +365,7 @@ ORIGINAL is the real string, i.e., before it is modified by "Store the relative remapping of column header-line. This is needed to later remove this relative remapping.") +(defvar org-columns--read-only-string nil) (defun org-columns--display-here (columns &optional dateline) "Overlay the current line with column display. COLUMNS is an alist (SPEC VALUE DISPLAYED). Optional argument @@ -439,9 +440,11 @@ DATELINE is non-nil when the face used should be (line-end-position 0) (line-beginning-position 2) 'read-only - (substitute-command-keys - "Type \\`\\[org-columns-edit-value]' \ -to edit property"))))))) + (or org-columns--read-only-string + (setq org-columns--read-only-string + (substitute-command-keys + "Type \\`\\[org-columns-edit-value]' \ +to edit property"))))))))) (defun org-columns--truncate-below-width (string width) "Return a substring of STRING no wider than WIDTH.