* core-spacemacs-buffer.el: avoid to call functions from org-mode at startup

This commit is contained in:
Lin Sun 2022-12-23 23:29:25 +00:00 committed by Maxi Wolff
parent 025e9f7e32
commit 7991003a08
1 changed files with 28 additions and 18 deletions

View File

@ -1275,24 +1275,34 @@ SEQ, START and END are the same arguments as for `cl-subseq'"
(defun spacemacs-buffer//insert-recent-files (list-size) (defun spacemacs-buffer//insert-recent-files (list-size)
(unless recentf-mode (recentf-mode)) (unless recentf-mode (recentf-mode))
(setq spacemacs-buffer//recent-files-list (let ((agenda-files
(let ((agenda-files (if (fboundp 'org-agenda-files) (let ((default-directory
(mapcar #'expand-file-name (org-agenda-files)) (or (bound-and-true-p org-directory) default-directory))
nil))) (files
(cl-delete-if (lambda (x) (if (or (not (fboundp 'org-agenda-files))
(or (when (and (bound-and-true-p org-directory) (file-exists-p org-directory)) (eq 'autoload (car (symbol-function 'org-agenda-files))))
(member x (directory-files org-directory t))) (bound-and-true-p org-agenda-files)
(member x agenda-files))) (org-agenda-files))))
recentf-list))) (mapcar #'expand-file-name files)))
(setq spacemacs-buffer//recent-files-list (ignore-directory (or (and (boundp 'org-directory)
(spacemacs//subseq spacemacs-buffer//recent-files-list 0 list-size)) (expand-file-name org-directory))
(when (spacemacs-buffer//insert-file-list ""))
(spacemacs-buffer||propertize-heading (recent-files-list))
(when dotspacemacs-startup-buffer-show-icons (cl-loop for rfile in recentf-list
(all-the-icons-octicon "history" :face 'font-lock-keyword-face :v-adjust -0.05)) while (length< recent-files-list list-size)
"Recent Files:" "r") collect (let ((full-path (expand-file-name rfile)))
spacemacs-buffer//recent-files-list) (unless (or (string-prefix-p ignore-directory full-path)
(spacemacs-buffer||add-shortcut "r" "Recent Files:")) (member full-path agenda-files))
(add-to-list 'recent-files-list rfile t))))
(when (spacemacs-buffer//insert-file-list
(spacemacs-buffer||propertize-heading
(when dotspacemacs-startup-buffer-show-icons
(all-the-icons-octicon
"history" :face 'font-lock-keyword-face :v-adjust -0.05))
"Recent Files:" "r")
recent-files-list)
(spacemacs-buffer||add-shortcut "r" "Recent Files:")))
(insert spacemacs-buffer-list-separator)) (insert spacemacs-buffer-list-separator))
(defun spacemacs-buffer//insert-recent-files-by-project (list-size) (defun spacemacs-buffer//insert-recent-files-by-project (list-size)