Introduce dedicated variable for main Org Mode file

The shortcut in the frequently-used menu now points there, and not anymore to
the dedicated home and work files.  If only a single main Org Mode file is used,
this variable should be sufficient.
This commit is contained in:
Daniel - 2020-08-27 12:16:54 +02:00
parent 77ca64de3b
commit 1ba91b3271
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
3 changed files with 15 additions and 7 deletions

View File

@ -297,6 +297,7 @@
org-break-task-id
org-home-task-id
db/org-clock-current-task-file
db/org-default-org-file
db/org-default-work-file
db/org-default-home-file
db/org-default-notes-file

View File

@ -97,6 +97,12 @@ If this path is not set, i.e., is null, no automatic download will happen."
;; custom setters. Thus, the only reasonable thing to do is to not update
;; `org-agenda-files' automatically and leave it to the user to update it.
(defcustom db/org-default-org-file nil
"Path to default org-mode file for general use.
You may also want to add this file to `org-agenda-files'."
:group 'personal-settings
:type '(choice (const nil) file))
(defcustom db/org-default-work-file nil
"Path to default org-mode file at work.
You may also want to add this file to `org-agenda-files'."
@ -134,8 +140,7 @@ in the main agenda view."
'(("Mail" ?m db/gnus)
("Agenda" ?a db/org-agenda)
("Init File" ?i db/find-user-init-file)
("Home Org File" ?h #'(lambda () (interactive) (find-file db/org-default-home-file)))
("Work Org File" ?w #'(lambda () (interactive) (find-file db/org-default-work-file)))
("Main Org File" ?o #'(lambda () (interactive) (find-file db/org-default-org-file)))
("EMMS" ?M emms)
("Shell" ?s db/run-or-hide-shell)
("EShell" ?e db/run-or-hide-eshell)

View File

@ -26,13 +26,14 @@
(defun db/check-special-org-files-in-agenda (&rest args)
"Check whether the special org-mode files are part of `org-agenda-files', ignoring ARGS.
The special org-mode files are `db/org-default-work-file',
`db/org-default-home-file', `db/org-default-notes-files', and
`db/org-default-refile-file'."
The special org-mode files are `db/org-default-org-file',
`db/org-default-work-file', `db/org-default-home-file',
`db/org-default-notes-files', and `db/org-default-refile-file'."
(ignore args)
(require 'org)
(let ((agenda-files (mapcar #'file-truename (org-agenda-files t))))
(dolist (file '(db/org-default-home-file
(dolist (file '(db/org-default-org-file
db/org-default-home-file
db/org-default-work-file
db/org-default-notes-file
db/org-default-refile-file))
@ -562,7 +563,8 @@ This is done only if the value of this variable is not null."
(progn
(org-save-all-org-buffers)
(let ((org-agenda-files (cl-remove-if #'null
(list db/org-default-home-file
(list db/org-default-org-file
db/org-default-home-file
db/org-default-work-file)))
(org-agenda-new-buffers nil))
;; check whether we need to do something