From e76a49fd30773b544b216c8e313ec064cfa27cc9 Mon Sep 17 00:00:00 2001 From: Emmet Date: Thu, 22 Feb 2024 08:13:19 -0600 Subject: [PATCH] Speed up my emacs start time :P --- user/app/doom-emacs/config.el | 16 ++++++++++++++-- user/app/doom-emacs/doom.org | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index ca6c34d..c1c0043 100644 --- a/user/app/doom-emacs/config.el +++ b/user/app/doom-emacs/config.el @@ -777,6 +777,7 @@ same directory as the org-buffer and insert a link to this file." (setq org-agenda-files (append org-agenda-files (org-roam-list-notes-by-tag "todos"))) ) +;; Refreshing org roam agenda (defun org-roam-refresh-agenda-list () (interactive) (setq prev-org-roam-db-choice org-roam-db-choice) @@ -788,8 +789,19 @@ same directory as the org-buffer and insert a link to this file." (org-roam-switch-db prev-org-roam-db-choice 1) ) -;; Build agenda for first time during this session -(org-roam-refresh-agenda-list) +;; Build agenda only when org agenda first opened for session +(setq org-roam-agenda-initialized nil) +(defun org-roam-refresh-agenda-list-init () + (if (not org-roam-agenda-initialized) + (funcall + (lambda () + (org-roam-refresh-agenda-list) + (setq org-roam-agenda-initialized t) + ) + ) + ) +) +(add-hook 'org-agenda-mode-hook 'org-roam-refresh-agenda-list-init) (map! :leader :prefix ("o a") diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index d3bb5aa..9ef8c35 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -910,6 +910,7 @@ exit (setq org-agenda-files (append org-agenda-files (org-roam-list-notes-by-tag "todos"))) ) +;; Refreshing org roam agenda (defun org-roam-refresh-agenda-list () (interactive) (setq prev-org-roam-db-choice org-roam-db-choice) @@ -921,8 +922,19 @@ exit (org-roam-switch-db prev-org-roam-db-choice 1) ) -;; Build agenda for first time during this session -(org-roam-refresh-agenda-list) +;; Build agenda only when org agenda first opened for session +(setq org-roam-agenda-initialized nil) +(defun org-roam-refresh-agenda-list-init () + (if (not org-roam-agenda-initialized) + (funcall + (lambda () + (org-roam-refresh-agenda-list) + (setq org-roam-agenda-initialized t) + ) + ) + ) +) +(add-hook 'org-agenda-mode-hook 'org-roam-refresh-agenda-list-init) (map! :leader :prefix ("o a")