From 2583d4f206222f385949a676498d9b6296c261ab Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 9 Dec 2018 16:26:22 -0500 Subject: agenda: Restructure notes directory Set org-agenda-files to a file with a list of agenda files rather than setting org-agenda-files to a directory with symlinked org files. --- init.el | 6 +++--- lisp/km-org-agenda.el | 24 ------------------------ 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/init.el b/init.el index ff8da8e..742131c 100644 --- a/init.el +++ b/init.el @@ -138,7 +138,7 @@ org-goto-interface 'outline-path-completionp org-goto-max-level 3) - (setq org-default-notes-file "~/notes/agenda/tasks.org") + (setq org-default-notes-file "~/notes/tasks.org") (setq org-agenda-text-search-extra-files (file-expand-wildcards "~/notes/extra/*.org")) @@ -385,8 +385,8 @@ #'km/org-agenda-set-restriction-lock)) :config - (setq km/org-agenda-file-directory "~/notes/agenda/" - org-agenda-files (list km/org-agenda-file-directory)) + (setq org-directory "~/notes/") + (setq org-agenda-files "~/notes/agenda-files") (add-hook 'org-agenda-finalize-hook #'km/org-agenda-cd-and-read-dir-locals) (add-hook 'org-agenda-finalize-hook #'km/org-agenda-store-current-span) diff --git a/lisp/km-org-agenda.el b/lisp/km-org-agenda.el index 30b6c49..dbbcabd 100644 --- a/lisp/km-org-agenda.el +++ b/lisp/km-org-agenda.el @@ -23,8 +23,6 @@ (require 'org-agenda) (require 'km-org) -(defvar km/org-agenda-file-directory nil) - (defun km/org-agenda-cd-and-read-dir-locals () (unless (get 'org-agenda-files 'org-restrict) (setq default-directory (expand-file-name "~/notes/")) @@ -37,28 +35,6 @@ killed." (when org-agenda-current-span (setq org-agenda-span org-agenda-current-span))) -;;;###autoload -(defun km/org-agenda-add-or-remove-file (file) - "Add or remove link to FILE in `km/org-agenda-file-directory'. -If a link for FILE does not exist, create it. Otherwise, remove -it. Like `org-agenda-file-to-front', this results in FILE being -displayed in the agenda." - (interactive (list (cl-case major-mode - (org-mode (buffer-file-name)) - (dired-mode (dired-get-filename)) - (org-agenda-mode (ignore-errors (save-window-excursion - (org-agenda-goto) - (buffer-file-name)))) - (t (read-file-name "Link file: "))))) - (let ((agenda-file (expand-file-name (file-name-nondirectory file) - km/org-agenda-file-directory))) - (if (file-equal-p (file-truename agenda-file) file) - (progn - (when (called-interactively-p) (message "Deleting %s" agenda-file)) - (delete-file agenda-file)) - (when (called-interactively-p) (message "Adding %s" agenda-file)) - (make-symbolic-link file agenda-file)))) - ;;;###autoload (defun km/org-open-default-notes-file-inbox () "Open \"Inbox\" heading of `org-default-notes-file'." -- cgit v1.2.3