emacs.d/bundle/bundle--org.el
2021-12-16 14:39:13 +01:00

201 lines
6.8 KiB
EmacsLisp

(use-package ob-go)
(use-package ob-http)
(use-package ob-rust)
(use-package ob-typescript)
(use-package ox-reveal)
(use-package org
:init
(org-babel-lob-ingest "~/.emacs.d/library-of-babel.org")
:custom
(org-hide-emphasis-markers t)
(org-default-notes-file "notes.org")
(org-insert-mode-line-in-empty-file t)
(org-adapt-indentation nil)
(org-agenda-prefix-format
'((agenda . " %i %-12:c%?-12t%-6e% s")
(todo . " %i %-12:c %-6e")
(tags . " %i %-12:c")
(search . " %i %-12:c")))
(org-agenda-dim-blocked-tasks nil)
(org-agenda-inhibit-startup nil)
(org-agenda-span 7)
(org-agenda-start-on-weekday 1)
(org-agenda-include-diary t)
(org-capture-templates
'(
;; Just make a note
("n" "Note" entry
(file+headline "notes.org" "Notes") "* %k\n%U\n- %l\n- %K\n%i\n%?")
;; Task driven life
("t" "Task" entry
(file+headline "planning.org" "Tasks") "* TODO %?\n%u\n%a")
;; Recurring appointments
("a" "Appointment" entry
(file+headline "planning.org" "Appointments") "* %?\n%T\n")
;; Capture a meeting
("m" "Meeting" entry
(file+headline "planning.org" "Meetings") "* %? :MEETING:\n%T" :clock-in t)
;; Log my activities
("j" "Journal" entry
(file+olp+datetree "journal.org" "Journal") "* %^{Activity}\nEntered on %U\n%i\n%?" :tree-type week)
;; Log my activities
("l" "Log" entry
(file+olp+datetree "journal.org" "Logbook") "* %U - %^{Activity} :LOG:")
;; Record general hours
("A" "Allgemein" table-line (file+olp "journal.org" "Stunden" "Allgemein") "| %u | %^{Stunden} | %? |")))
(org-clock-out-remove-zero-time-clocks t)
(org-clock-persist t)
(org-clock-rounding-minutes 30)
(org-confirm-babel-evaluate nil)
(org-duration-format (quote h:mm))
(org-export-with-sub-superscripts nil)
(org-export-dispatch-use-expert-ui nil)
(org-export-backends
'(ascii beamer html icalendar latex md odt))
(org-global-properties
'(("EFFORT_ALL" . "0:30 1:00 2:00 3:00 5:00 8:00")))
(org-html-doctype "html5")
(org-html-html5-fancy t)
(org-html-htmlize-output-type nil)
(org-latex-pdf-process
'("latexmk -xelatex -shell-escape -quiet -f %f"))
(org-latex-compiler "xelatex")
(org-latex-listings t)
(org-log-done (quote time))
(org-refile-targets '((nil :maxlevel . 3)))
(org-startup-folded t)
(org-startup-truncated nil)
(org-src-fontify-natively t)
(org-src-tab-acts-natively t)
(org-src-window-setup 'other-window)
(org-src-lang-modes
'(("bash" . sh)
("elisp" . emacs-lisp)
("beamer" . latex)
("calc" . fundamental)
("dot" . fundamental)
("screen" . shell-script)
("shell" . sh)
("C" . c)
("sqlite" . sql)
("scheme" . racket)
("plantuml" . plantuml)))
(org-time-stamp-rounding-minutes '(30 30))
(org-todo-keywords
'((sequence "TODO" "DOING(!)" "DONE(!)")))
(org-use-property-inheritance nil)
:config
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(js . t)
(lisp . t)
(python . t)
(sqlite . t)
(shell . t)
(plantuml . t)
(typescript . t)
(http . t))))
(use-package org-roam
:init
(setq org-roam-v2-ack t)
(setq org-roam-db-location "~/org-roam.db")
(require 'org-roam-dailies)
:bind (("C-c r l" . org-roam-buffer-toggle)
("C-c r f" . org-roam-node-find)
("C-c r g" . org-roam-graph)
("C-c r i" . org-roam-node-insert)
("C-c r c" . org-roam-capture)
("C-c r j" . org-roam-dailies-map)
:map org-roam-dailies-map
("t" . org-roam-dailies-capture-today)
("y" . org-roam-dailies-capture-yesterday)
("T" . org-roam-dailies-capture-tomorrow)
:map org-mode-map
("C-M-i" . completion-at-point))
:custom
(org-roam-completion-everywhere t)
(org-roam-dailies-capture-templates
'(("d" "default" entry "* %<%R> %?"
:if-new (file+head "%<%F>.org" "#+title: %<%F>\n"))))
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+date: %U\n")
:unnarrowed t)
("n" "Note" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+date: %U\n%l\n\n%i")
:unnarrowed t)
("p" "personas" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+date: %U\n* Personality\n* Behaviors\n* Needs & Goals\n")
:unnarrowed t))))
(use-package org-tree-slide
:custom
(org-image-actual-width nil))
(use-package org-web-tools
:custom (org-web-tools-pandoc-sleep-time 0.4))
;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks.
(defun org-agenda-log-mode-colorize-block ()
"Set different line spacing based on clock time duration."
(save-excursion
(let* ((colors (cl-case (alist-get 'background-mode (frame-parameters))
('light (list "#d8dee9" "#e5e9f0" "#eceff4"))
('dark (list "#bf616a" "#d08770" "#ebcb8b" "#a3be8c" "#b48ead"))))
pos
duration)
(nconc colors colors)
(goto-char (point-min))
(while (setq pos (next-single-property-change (point) 'duration))
(goto-char pos)
(when (and (not (equal pos (point-at-eol)))
(setq duration (org-get-at-bol 'duration)))
;; larger duration bar height
(let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30))))
(ov (make-overlay (point-at-bol) (1+ (point-at-eol)))))
(overlay-put ov 'face `(:background ,(car colors) :foreground "black"))
(setq colors (cdr colors))
(overlay-put ov 'line-height line-height)
(overlay-put ov 'line-spacing (1- line-height))))))))
(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block)
(defun me/org-copy-subtree-contents ()
"Get the content text of the subtree at point and add it to the `kill-ring'.
Excludes the heading and any child subtrees."
(interactive)
(if (org-before-first-heading-p)
(message "Not in or on an org heading")
(save-excursion
;; If inside heading contents, move the point back to the heading
;; otherwise `org-agenda-get-some-entry-text' won't work.
(unless (org-on-heading-p) (org-previous-visible-heading 1))
(let ((contents (substring-no-properties
(org-agenda-get-some-entry-text
(point-marker)
most-positive-fixnum))))
(message "Copied: %s" contents)
(kill-new contents)))))
(add-hook 'org-mode-hook 'turn-on-auto-fill)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c b") 'org-switchb)
(org-clock-persistence-insinuate)