Skip to content

Instantly share code, notes, and snippets.

@dsjt
Last active June 26, 2018 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsjt/23d342735d8576466a0ef1c05d6f45ba to your computer and use it in GitHub Desktop.
Save dsjt/23d342735d8576466a0ef1c05d6f45ba to your computer and use it in GitHub Desktop.
emacsのorg-agenda活用のための設定の一部
(defvar my/gtd-main-file "hogehoge")
;; agenda
(defvar my/agenda-files-outside '(
;; "hogehoge"
))
(defun my/collect-org-agenda-files ()
(append
(directory-files "hogehoge"
t ".+\.org$")
(directory-files "hogehoge"
t ".+\.org$")
my/agenda-files-outside
))
(defun my/load-org-agendas ()
(interactive)
(setq org-agenda-files (my/collect-org-agenda-files))
)
(my/load-org-agendas)
(setq org-default-notes-file my/gtd-main-file)
;; org-refile-targets
(setq org-refile-targets
(loop for f in org-agenda-files
unless (or (string-match-p (regexp-quote "weekly") f)
(string-match-p (regexp-quote "gcal") f))
collect `(,f :maxlevel . 1)))
;; capture
(setq org-capture-templates
'(("b" "Inbox (active time stamp)" entry (file+headline my/gtd-main-file "Inbox")
"* TODO %?\n\n Captured at %u\n")
;; ;; ("l" "Log" entry (file+headline my/gtd-main-file "Log")
;; ;; "* LOG %?\n %U")
))
(defun my/org-capture ()
(interactive)
(org-capture nil "b"))
(bind-key "C-c c" #'my/org-capture)
(bind-key "C-l C-q" #'my/org-capture)
(bind-key "C-q C-l" #'my/org-capture)
(setq org-agenda-custom-commands
'(("n" "Agenda and all TODO's" ((agenda "") (alltodo "")))
("d" "1 days agenda" (
(agenda "" ((org-agenda-span 1)
(org-agenda-skip-scheduled-if-done t)
(org-agenda-show-log t)
(org-agenda-log-mode-items '(state))
;; (org-agenda-log-mode-items '())
))
(tags "+Inbox/TODO")
(tags-todo "+Action"
((org-agenda-sorting-strategy
'((agenda habit-down time-up priority-down category-keep)
(todo priority-down tsia-up category-keep)
(tags priority-down tsia-up category-keep)
(search category-keep))
)))
(tags-todo "+Project/TODO")
))
("w" "8 days agenda" ((agenda "" ((org-agenda-span 8)
(org-agenda-start-day "-1")
(org-agenda-columns-add-appointments-to-effort-sum t)))
(tags-todo "Inbox")
(todo "TODO")))
("i" "Inbox" ((tags-todo "Inbox")
(tags-todo "Action"
((org-agenda-sorting-strategy
'((agenda habit-down time-up priority-down category-keep)
(todo priority-down tsia-up category-keep)
(tags priority-down tsia-up category-keep)
(search category-keep))
)))))
("o" "1 days outline" ((agenda "" ((org-agenda-span 1)
(org-agenda-skip-scheduled-if-done t)
(org-agenda-show-log nil)
(org-agenda-log-mode-items '())
))
(tags-todo "Action"
((org-agenda-sorting-strategy
'((agenda habit-down time-up priority-down category-keep)
(todo priority-down tsia-up category-keep)
(tags priority-down tsia-up category-keep)
(search category-keep))
)))
(tags-todo "Inbox")))
("p" "project todo" ((tags-todo "Project")))
))
(defvar my/project-directory "hogehoge")
(defvar my/project-template "~/.emacs.d/myconfig/project-template.org")
(defun my/make-project-agenda-file ()
"プロジェクトアジェンダファイルを作成する。"
(interactive)
(let* ((dir my/project-directory)
(file (format "%s/%s.org"
dir
(read-string "(project file name): "))))
(make-directory dir t)
(find-file-other-window file)
(insert-file my/project-template)
(my/load-org-agendas)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment