[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 4080938d60 1/2: org-agenda-prepare-buffers: Avoid r
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 4080938d60 1/2: org-agenda-prepare-buffers: Avoid repetitive updates of agenda menu |
Date: |
Thu, 18 Aug 2022 07:57:59 -0400 (EDT) |
branch: externals/org
commit 4080938d60e89fd38d2e0c4fe351bc9909c607c5
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-agenda-prepare-buffers: Avoid repetitive updates of agenda menu
* lisp/org.el (org-agenda-file-menu-enabled): New variable controlling
whether `org-mode' updates the agenda file list in the menu.
(org-mode): Honor the new variable.
(org-agenda-prepare-buffers): Suppress `org-install-agenda-files-menu'
when opening the agenda files. Run it once at the end.
This commit reduces performance overheads when the number of agenda
files is large.
---
lisp/org.el | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 9e8155391f..fd3f417df9 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4713,7 +4713,8 @@ The following commands are available:
\\{org-mode-map}"
(setq-local org-mode-loading t)
(org-load-modules-maybe)
- (org-install-agenda-files-menu)
+ (when org-agenda-file-menu-enabled
+ (org-install-agenda-files-menu))
(when (and org-link-descriptive
(eq org-fold-core-style 'overlays))
(add-to-invisibility-spec '(org-link)))
@@ -15167,7 +15168,10 @@ When a buffer is unmodified, it is just killed. When
modified, it is saved
"Create buffers for all agenda files, protect archived trees and comments."
(interactive)
(let ((inhibit-read-only t)
- (org-inhibit-startup org-agenda-inhibit-startup))
+ (org-inhibit-startup org-agenda-inhibit-startup)
+ ;; Do not refresh list of agenda files in the menu when
+ ;; opening every new file.
+ (org-agenda-file-menu-enabled nil))
(setq org-tag-alist-for-agenda nil
org-tag-groups-alist-for-agenda nil)
(dolist (file files)
@@ -15210,6 +15214,9 @@ When a buffer is unmodified, it is just killed. When
modified, it is saved
(org-uniquify org-todo-keywords-for-agenda))
(setq org-todo-keyword-alist-for-agenda
(org-uniquify org-todo-keyword-alist-for-agenda))))
+ ;; Refresh the menu once after loading all the agenda buffers.
+ (when org-agenda-file-menu-enabled
+ (org-install-agenda-files-menu))))
;;;; CDLaTeX minor mode
@@ -18000,6 +18007,8 @@ Your bug report will be posted to the Org mailing list.
(when (re-search-backward "^\\(Subject: \\)Org mode version \\(.*?\\);[
\t]*\\(.*\\)" nil t)
(replace-match "\\1[BUG] \\3 [\\2]")))))
+(defvar org-agenda-file-menu-enabled t
+ "When non-nil, refresh Agenda files in Org menu when loading Org.")
(defun org-install-agenda-files-menu ()
"Install agenda file menu."