diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.emacs.d/init.el | 21 | ||||
-rw-r--r-- | emacs/.emacs.d/org-mode.el | 71 |
2 files changed, 89 insertions, 3 deletions
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index a554a64..b5df141 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -1,3 +1,7 @@ +;; --- FUNCTIONS --- +(defun load-if-exists (filename) + (when (file-exists-p filename) (load-file filename))) + ;; --- BUG WORKAROUNDS --- ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=34341 @@ -17,7 +21,7 @@ ;; --- PACKAGE REPOSITORIES --- (require 'package) (setq package-archives - '(("gnu" . "https://elpa.gnu.org/packages/") + '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/"))) (package-initialize) @@ -40,6 +44,19 @@ enable-recursive-minibuffers t) (ivy-mode 1)) +;; --- ORG MODE --- +(use-package org + :mode + (("\\.org$" . org-mode)) + :init + (add-to-list 'auto-mode-alist `(,(expand-file-name "~/org/") . org-mode)) + :bind + (("C-c a" . org-agenda)) + :config + (load-file "~/.emacs.d/org-mode.el") + (load-if-exists "~/.emacs.d/org-mode.local.el") + ) + ;; --- PROJECTS --- (use-package projectile :demand t @@ -181,8 +198,6 @@ (dolist (face faces) (set-face-attribute face nil :foreground fg :background bg))) -(defun load-if-exists (filename) - (when (file-exists-p filename) (load-file filename))) (load-if-exists "~/.emacs.d/local.el") (setq custom-file "~/.emacs.d/custom.el") diff --git a/emacs/.emacs.d/org-mode.el b/emacs/.emacs.d/org-mode.el new file mode 100644 index 0000000..45af255 --- /dev/null +++ b/emacs/.emacs.d/org-mode.el @@ -0,0 +1,71 @@ +;; --- CUSTOM DEFINITIONS AND FUNCTIONS --- +(setq + ;; list of TODO statuses that are actionable + bab/org/todos-actionable '("TODO" "IN-PROGRESS") + ) + +(defun bab/org/get-todo (entry) + (org-entry-get (get-text-property 0 'org-marker entry) "TODO" nil)) + +(defun bab/org/todo-is-actionable (todo) + (if (member todo bab/org/todos-actionable) t nil)) + +(defun bab/org/todo-is-not-actionable (todo) + (not (bab/org/todo-is-actionable todo))) + +(defun bab/org/cmp-actionable (a b) + (let* ((a-is-actionable (bab/org/todo-is-actionable (bab/org/get-todo a))) + (b-is-actionable (bab/org/todo-is-actionable (bab/org/get-todo b)))) + (if (equal a-is-actionable b-is-actionable) nil (if a-is-actionable -1 1)))) + +;; --- CONFIGURATION --- +(setq + org-capture-templates () + ) + +(define-key global-map "\C-cc" 'org-capture) + +(setq org-agenda-custom-commands + '(("a" "Agenda" + ((agenda "" + ((org-agenda-cmp-user-defined 'bab/org/cmp-actionable) + (org-agenda-sorting-strategy '(time-up scheduled-down user-defined-up priority-down deadline-up)))) + (alltodo "" + ((org-agenda-skip-function '(org-agenda-skip-if nil '(scheduled deadline))) + (org-agenda-overriding-header "Some day:"))))))) + +(setq + ;; Use priorities A-E, default priority is C + org-highest-priority ?A + org-lowest-priority ?E + org-default-priority ?C + + ;; TODO states and sequences + org-todo-keywords + '((sequence "TODO(t)" "IN-PROGRESS(p)" "WAIT(w)" "|" "DONE(d)") + (sequence "|" "CANCELED(x)")) + org-todo-keyword-faces + '(("WAIT" . (:foreground "DodgerBlue1")) + ("IN-PROGRESS" . "magenta1") + ("CANCELED" . (:foreground "snow4"))) + + ;; Agenda + org-agenda-files '("~/org/agenda") + org-agenda-overriding-columns-format "%1PRIORITY %DEADLINE %TODO %CLOCKSUM %80ITEM" + org-agenda-dim-blocked-tasks 'invisible + org-agenda-span 7 + org-agenda-show-all-dates t + org-agenda-skip-deadline-if-done t + org-agenda-skip-deadline-prewarning-if-scheduled t + org-agenda-skip-scheduled-if-done t + org-agenda-start-on-weekday nil + + ;; Misc configuration + org-deadline-warning-days 7 + org-default-notes-file "~/org/notes" + org-enforce-todo-dependencies t + org-fast-tag-selection-single-key (quote expert) + org-return-follows-link t + org-reverse-note-order t + org-use-property-inheritance t + ) |