Add org module

This commit is contained in:
Wojciech Kozlowski 2022-08-13 22:38:19 +02:00
parent 1d2176fc01
commit 1f6f4d911e
3 changed files with 101 additions and 7 deletions

View File

@ -117,11 +117,86 @@
;; Remove background from `avy'.
(after! avy (setq avy-background t))
;; Remove org-agenda from dashboard.
(let ((org-agenda-section
(seq-find (lambda (item) (string= (nth 0 item) "Open org-agenda"))
+doom-dashboard-menu-sections)))
(delete org-agenda-section +doom-dashboard-menu-sections))
(after! org
(defvar +x/org-capture-inbox-file "inbox.org")
(defvar +x/org-capture-reading-list-file "reading.org")
(add-to-list 'org-capture-templates
`("r" "Reading list" entry
(file+headline ,+x/org-capture-reading-list-file "Inbox")
"* %?"))
(add-to-list 'org-capture-templates
`("i" "Inbox" entry
(file ,+x/org-capture-inbox-file)
"* HOLD [#C] %?" :prepend t))
(setq org-todo-keywords
'((sequence
"HOLD(h)" ; This task needs doing eventually, but not yet
"NEXT(n)" ; A task that needs doing and is ready to do
"WEEK(w)" ; A task that is scheduled to work on this week
"TODO(d)" ; A task that is currently getting done
"WAIT(t)" ; Something external is holding up this task
"|"
"DONE(x)")); Task successfully completed
org-todo-keyword-faces
'(("HOLD" . +org-todo-onhold)
("NEXT" . +org-todo-active)
("WEEK" . org-todo)
("WAIT" . +org-todo-cancel)))
(add-to-list 'org-after-todo-state-change-hook
(lambda ()
(when (equal org-state "DONE")
(org-archive-to-archive-sibling)))))
(after! org-agenda
(setq org-agenda-custom-commands
'(("d" "Agenda and tasklist for the day"
((agenda "")
(todo "TODO"))
((org-agenda-span 'day)
(org-agenda-start-day "")
(org-deadline-warning-days 0)))
("w" "Agenda and tasklist for the week"
((agenda "")
(todo "TODO")
(todo "WEEK"))
((org-agenda-start-on-weekday 1)
(org-agenda-span 'week)
(org-agenda-start-day "")
(org-deadline-warning-days 0)))
("p" . "Planning lists")
("pd" "Agenda and tasklist for daily planning"
((agenda "")
(todo "WEEK")
(todo "TODO"))
((org-agenda-start-on-weekday 1)
(org-agenda-span 'week)
(org-agenda-start-day "")
(org-deadline-warning-days 0)))
("pw" "Agenda and tasklist for weekly planning"
((agenda "")
(todo "NEXT")
(todo "HOLD")
(todo "WEEK")
(todo "TODO"))
((org-agenda-start-on-weekday 1)
(org-agenda-span 'fortnight)
(org-agenda-start-day "")
(org-deadline-warning-days 0)))
("r" . "Weekly review lists")
("rl" "Tasklist of leftover work"
((todo "TODO")
(todo "WEEK")))
("rn" "Agenda and tasklist of upcoming tasks"
((agenda "")
(todo "WAIT")
(todo "NEXT")
(todo "HOLD"))
((org-agenda-start-on-weekday 1)
(org-agenda-span 'month)
(org-agenda-start-day "")
(org-deadline-warning-days 0))))))
;; Remove the silly doom newline advice.
(advice-remove 'newline-and-indent
@ -133,7 +208,9 @@
"Add some extra whitespace highlights to doom's opinion"
:after #'doom-highlight-non-default-indentation-h
(when (bound-and-true-p whitespace-mode)
(appendq! whitespace-style '(trailing lines-tail empty))
(appendq! whitespace-style '(trailing empty))
(when (not (eq major-mode 'org-mode))
(appendq! whitespace-style '(lines-tail)))
(whitespace-mode +1)))
;; I actually like it when Emacs recenters the screen while scrolling. This may
@ -360,6 +437,8 @@
"C-<" #'+x/scroll-down-one
"C->" #'+x/scroll-up-one
"M-Q" #'+x/unfill-paragraph
(:map org-mode-map
"C-c C-;" #'+x/org-insert-link-with-title)
;; Faster navigation with avy.
"M-g M-c" #'avy-goto-char
"M-g M-v" #'avy-goto-char-2

View File

@ -151,7 +151,7 @@
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
;;org ; organize your plain life in plain text
(org +dragndrop +pretty); organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional

View File

@ -3,6 +3,8 @@
;;
;;; Code:
(require 'subr-x)
;;;###autoload
(defun +x/indent-region-or-buffer ()
"Indent a region if selected, otherwise the whole buffer."
@ -40,5 +42,18 @@
(emacs-lisp-docstring-fill-column t))
(fill-paragraph nil region)))
;;;###autoload
(defun +x/org-insert-link-with-title (url)
"Insert a link to URL with the title provided by the site itself."
(interactive "sURL for which to insert link: ")
(let ((title
(string-trim
(shell-command-to-string
(concat "curl -sL " url
" | "
"xmllint --html --xpath '//head/title/text()' - "
"2>/dev/null")))))
(insert "[[" url "][" title "]]")))
(provide 'x-lib)
;;; x-lib.el ends here