2017-12-08 22:59:42 -05:00
|
|
|
;;; lang/org/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2019-10-25 20:00:06 -04:00
|
|
|
(defvar +org-babel-mode-alist
|
|
|
|
'((cpp . C)
|
|
|
|
(C++ . C)
|
|
|
|
(D . C)
|
2020-05-06 02:49:00 -04:00
|
|
|
(elisp . emacs-lisp)
|
2019-10-25 20:00:06 -04:00
|
|
|
(sh . shell)
|
|
|
|
(bash . shell)
|
2020-02-16 00:49:01 -05:00
|
|
|
(matlab . octave)
|
2020-05-17 21:28:31 +02:00
|
|
|
(rust . rustic-babel)
|
2020-02-16 00:49:01 -05:00
|
|
|
(amm . ammonite))
|
2019-10-25 20:00:06 -04:00
|
|
|
"An alist mapping languages to babel libraries. This is necessary for babel
|
|
|
|
libraries (ob-*.el) that don't match the name of the language.
|
|
|
|
|
2020-04-08 15:29:29 -04:00
|
|
|
For example, (fish . shell) will cause #+BEGIN_SRC fish blocks to load
|
|
|
|
ob-shell.el when executed.")
|
2019-10-25 20:00:06 -04:00
|
|
|
|
|
|
|
(defvar +org-babel-load-functions ()
|
|
|
|
"A list of functions executed to load the current executing src block. They
|
|
|
|
take one argument (the language specified in the src block, as a string). Stops
|
|
|
|
at the first function to return non-nil.")
|
|
|
|
|
|
|
|
(defvar +org-capture-todo-file "todo.org"
|
|
|
|
"Default target for todo entries.
|
|
|
|
|
|
|
|
Is relative to `org-directory', unless it is absolute. Is used in Doom's default
|
|
|
|
`org-capture-templates'.")
|
|
|
|
|
|
|
|
(defvar +org-capture-changelog-file "changelog.org"
|
|
|
|
"Default target for changelog entries.
|
|
|
|
|
|
|
|
Is relative to `org-directory' unless it is absolute. Is used in Doom's default
|
|
|
|
`org-capture-templates'.")
|
|
|
|
|
|
|
|
(defvar +org-capture-notes-file "notes.org"
|
|
|
|
"Default target for storing notes.
|
|
|
|
|
|
|
|
Used as a fall back file for org-capture.el, for templates that do not specify a
|
|
|
|
target file.
|
|
|
|
|
|
|
|
Is relative to `org-directory', unless it is absolute. Is used in Doom's default
|
|
|
|
`org-capture-templates'.")
|
|
|
|
|
2019-10-31 23:09:26 -04:00
|
|
|
(defvar +org-capture-journal-file "journal.org"
|
|
|
|
"Default target for storing timestamped journal entries.
|
|
|
|
|
|
|
|
Is relative to `org-directory', unless it is absolute. Is used in Doom's default
|
|
|
|
`org-capture-templates'.")
|
|
|
|
|
2019-10-31 22:45:59 -04:00
|
|
|
(defvar +org-capture-projects-file "projects.org"
|
|
|
|
"Default, centralized target for org-capture templates.")
|
|
|
|
|
2019-10-25 20:00:06 -04:00
|
|
|
(defvar +org-habit-graph-padding 2
|
|
|
|
"The padding added to the end of the consistency graph")
|
|
|
|
|
|
|
|
(defvar +org-habit-min-width 30
|
|
|
|
"Hides the consistency graph if the `org-habit-graph-column' is less than this value")
|
|
|
|
|
|
|
|
(defvar +org-habit-graph-window-ratio 0.3
|
|
|
|
"The ratio of the consistency graphs relative to the window width")
|
|
|
|
|
|
|
|
|
2017-07-05 02:33:41 +02:00
|
|
|
;;
|
2019-03-07 00:15:15 -05:00
|
|
|
;;; `org-load' hooks
|
2018-01-08 20:38:46 -05:00
|
|
|
|
2020-04-25 15:40:24 -04:00
|
|
|
(defun +org-init-org-directory-h ()
|
|
|
|
(unless org-directory
|
|
|
|
(setq org-directory "~/org"))
|
|
|
|
(setq org-id-locations-file (expand-file-name ".orgids" org-directory)))
|
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-agenda-h ()
|
2018-09-30 15:14:01 -04:00
|
|
|
(unless org-agenda-files
|
|
|
|
(setq org-agenda-files (list org-directory)))
|
2017-07-05 02:33:41 +02:00
|
|
|
(setq-default
|
2019-09-10 14:54:13 -04:00
|
|
|
;; Don't monopolize the whole frame just for the agenda
|
|
|
|
org-agenda-window-setup 'current-window
|
2018-06-10 01:32:19 +02:00
|
|
|
org-agenda-skip-unavailable-files t
|
|
|
|
;; Move the agenda to show the previous 3 days and the next 7 days for a bit
|
|
|
|
;; better context instead of just the current week which is a bit confusing
|
|
|
|
;; on, for example, a sunday
|
|
|
|
org-agenda-span 10
|
|
|
|
org-agenda-start-on-weekday nil
|
|
|
|
org-agenda-start-day "-3d"))
|
2018-01-08 20:38:46 -05:00
|
|
|
|
2019-03-07 00:15:15 -05:00
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-appearance-h ()
|
2018-01-08 20:38:46 -05:00
|
|
|
"Configures the UI for `org-mode'."
|
2019-10-28 02:02:45 -04:00
|
|
|
(setq org-indirect-buffer-display 'current-window
|
|
|
|
org-eldoc-breadcrumb-separator " → "
|
|
|
|
org-enforce-todo-dependencies t
|
|
|
|
org-entities-user
|
|
|
|
'(("flat" "\\flat" nil "" "" "266D" "♭")
|
|
|
|
("sharp" "\\sharp" nil "" "" "266F" "♯"))
|
|
|
|
org-fontify-quote-and-verse-blocks t
|
|
|
|
org-fontify-whole-heading-line t
|
|
|
|
org-footnote-auto-label 'plain
|
|
|
|
org-hide-leading-stars t
|
|
|
|
org-image-actual-width nil
|
|
|
|
org-priority-faces
|
|
|
|
'((?A . error)
|
|
|
|
(?B . warning)
|
|
|
|
(?C . success))
|
|
|
|
org-startup-indented t
|
2019-11-29 21:55:18 -05:00
|
|
|
org-tags-column 0
|
2019-10-28 02:02:45 -04:00
|
|
|
org-use-sub-superscripts '{})
|
2019-10-27 17:23:22 -04:00
|
|
|
|
2019-10-28 00:49:10 -04:00
|
|
|
(setq org-refile-targets
|
|
|
|
'((nil :maxlevel . 3)
|
|
|
|
(org-agenda-files :maxlevel . 3))
|
|
|
|
;; Without this, completers like ivy/helm are only given the first level of
|
|
|
|
;; each outline candidates. i.e. all the candidates under the "Tasks" heading
|
|
|
|
;; are just "Tasks/". This is unhelpful. We want the full path to each refile
|
2019-10-31 14:35:07 -04:00
|
|
|
;; target! e.g. FILE/Tasks/heading/subheading
|
2019-10-28 00:49:10 -04:00
|
|
|
org-refile-use-outline-path 'file
|
|
|
|
org-outline-path-complete-in-steps nil)
|
|
|
|
|
2020-04-14 15:34:20 -04:00
|
|
|
(plist-put org-format-latex-options :scale 1.5) ; larger previews
|
|
|
|
(add-hook! 'doom-load-theme-hook
|
|
|
|
(defun +org-refresh-latex-background-h ()
|
|
|
|
"Previews are rendered with the incorrect background.
|
|
|
|
This forces it to read the background before rendering."
|
|
|
|
(plist-put! org-format-latex-options
|
|
|
|
:background
|
|
|
|
(face-attribute (if-let (remap (cadr (assq 'default face-remapping-alist)))
|
|
|
|
(if (keywordp (car-safe remap))
|
|
|
|
(plist-get remap :background)
|
|
|
|
remap)
|
|
|
|
'default)
|
|
|
|
:background nil t))))
|
2019-10-25 20:00:06 -04:00
|
|
|
|
2019-10-27 14:05:31 -04:00
|
|
|
;; HACK Face specs fed directly to `org-todo-keyword-faces' don't respect
|
|
|
|
;; underlying faces like the `org-todo' face does, so we define our own
|
|
|
|
;; intermediary faces that extend from org-todo.
|
2019-11-23 00:52:36 -05:00
|
|
|
(with-no-warnings
|
2020-03-27 01:25:30 -04:00
|
|
|
(custom-declare-face '+org-todo-active '((t (:inherit (bold font-lock-constant-face org-todo)))) "")
|
2019-11-23 00:52:36 -05:00
|
|
|
(custom-declare-face '+org-todo-project '((t (:inherit (bold font-lock-doc-face org-todo)))) "")
|
2020-03-27 01:25:30 -04:00
|
|
|
(custom-declare-face '+org-todo-onhold '((t (:inherit (bold warning org-todo)))) ""))
|
2019-10-27 14:05:31 -04:00
|
|
|
(setq org-todo-keywords
|
|
|
|
'((sequence
|
|
|
|
"TODO(t)" ; A task that needs doing & is ready to do
|
2020-04-17 14:49:58 -04:00
|
|
|
"PROJ(p)" ; A project, which usually contains other tasks
|
2019-10-29 11:36:22 -04:00
|
|
|
"STRT(s)" ; A task that is in progress
|
2020-04-17 14:49:58 -04:00
|
|
|
"WAIT(w)" ; Something external is holding up this task
|
|
|
|
"HOLD(h)" ; This task is paused/on hold because of me
|
2019-10-27 14:05:31 -04:00
|
|
|
"|"
|
2019-10-28 12:57:11 -04:00
|
|
|
"DONE(d)" ; Task successfully completed
|
2019-10-27 14:05:31 -04:00
|
|
|
"KILL(k)") ; Task was cancelled, aborted or is no longer applicable
|
|
|
|
(sequence
|
|
|
|
"[ ](T)" ; A task that needs doing
|
2019-10-28 12:57:11 -04:00
|
|
|
"[-](S)" ; Task is in progress
|
2019-10-27 14:05:31 -04:00
|
|
|
"[?](W)" ; Task is being held up or paused
|
|
|
|
"|"
|
2019-10-28 12:57:11 -04:00
|
|
|
"[X](D)")) ; Task was completed
|
2019-10-27 14:05:31 -04:00
|
|
|
org-todo-keyword-faces
|
|
|
|
'(("[-]" . +org-todo-active)
|
2019-10-28 12:57:11 -04:00
|
|
|
("STRT" . +org-todo-active)
|
2019-10-27 14:05:31 -04:00
|
|
|
("[?]" . +org-todo-onhold)
|
|
|
|
("WAIT" . +org-todo-onhold)
|
2020-04-17 14:49:58 -04:00
|
|
|
("HOLD" . +org-todo-onhold)
|
2019-10-27 14:05:31 -04:00
|
|
|
("PROJ" . +org-todo-project)))
|
|
|
|
|
2020-05-15 01:44:53 -04:00
|
|
|
(defadvice! +org-display-link-in-eldoc-a (&rest _)
|
2019-10-25 20:00:06 -04:00
|
|
|
"Display full link in minibuffer when cursor/mouse is over it."
|
2020-04-27 17:43:29 -04:00
|
|
|
:before-until #'org-eldoc-documentation-function
|
|
|
|
(when-let (link (org-element-property :raw-link (org-element-context)))
|
|
|
|
(format "Link: %s" link)))
|
2019-02-22 02:07:44 -05:00
|
|
|
|
2019-10-31 14:35:07 -04:00
|
|
|
;; Automatic indent detection in org files is meaningless
|
2020-03-27 01:25:30 -04:00
|
|
|
(add-to-list 'doom-detect-indentation-excluded-modes 'org-mode)
|
2018-07-29 02:54:19 +02:00
|
|
|
|
2019-06-28 16:53:26 +02:00
|
|
|
(set-pretty-symbols! 'org-mode
|
|
|
|
:name "#+NAME:"
|
2020-04-03 12:01:34 +02:00
|
|
|
:name "#+name:"
|
2019-06-28 16:53:26 +02:00
|
|
|
:src_block "#+BEGIN_SRC"
|
2020-04-03 12:01:34 +02:00
|
|
|
:src_block "#+begin_src"
|
|
|
|
:src_block_end "#+END_SRC"
|
|
|
|
:src_block_end "#+end_src"
|
|
|
|
:quote "#+BEGIN_QUOTE"
|
|
|
|
:quote "#+begin_quote"
|
|
|
|
:quote_end "#+END_QUOTE"
|
|
|
|
:quote_end "#+end_quote"))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-babel-h ()
|
2019-09-05 13:12:44 -04:00
|
|
|
(setq org-src-preserve-indentation t ; use native major-mode indentation
|
2020-01-01 20:59:58 -05:00
|
|
|
org-src-tab-acts-natively t ; we do this ourselves
|
2019-10-31 23:13:03 -04:00
|
|
|
;; You don't need my permission (just be careful, mkay?)
|
|
|
|
org-confirm-babel-evaluate nil
|
|
|
|
org-link-elisp-confirm-function nil
|
2019-09-10 14:54:13 -04:00
|
|
|
;; Show src buffer in popup, and don't monopolize the frame
|
2019-12-02 19:55:05 -05:00
|
|
|
org-src-window-setup 'other-window
|
|
|
|
;; Our :lang common-lisp module uses sly, so...
|
|
|
|
org-babel-lisp-eval-fn #'sly-eval)
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
;; I prefer C-c C-c over C-c ' (more consistent)
|
|
|
|
(define-key org-src-mode-map (kbd "C-c C-c") #'org-edit-src-exit)
|
|
|
|
|
2020-05-15 01:44:53 -04:00
|
|
|
(defadvice! +org-fix-newline-and-indent-in-src-blocks-a (&optional indent _arg _interactive)
|
2019-10-25 20:00:06 -04:00
|
|
|
"Mimic `newline-and-indent' in src blocks w/ lang-appropriate indentation."
|
2020-05-15 01:44:53 -04:00
|
|
|
:after #'org-return
|
|
|
|
(when (and indent (org-in-src-block-p t))
|
2019-10-25 20:00:06 -04:00
|
|
|
(org-babel-do-in-edit-buffer
|
|
|
|
(call-interactively #'indent-for-tab-command))))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2019-10-22 17:58:30 -04:00
|
|
|
;; Refresh inline images after executing src blocks (useful for plantuml or
|
|
|
|
;; ipython, where the result could be an image)
|
|
|
|
(add-hook 'org-babel-after-execute-hook #'org-redisplay-inline-images)
|
|
|
|
|
2020-02-28 18:52:50 +01:00
|
|
|
(after! python
|
|
|
|
(setq org-babel-python-command python-shell-interpreter)))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-babel-lazy-loader-h ()
|
2019-06-28 16:53:26 +02:00
|
|
|
"Load babel libraries lazily when babel blocks are executed."
|
2020-04-13 15:23:16 -04:00
|
|
|
(defun +org--babel-lazy-load (lang &optional async)
|
|
|
|
(cl-check-type lang (or symbol null))
|
|
|
|
(unless (cdr (assq lang org-babel-load-languages))
|
|
|
|
(when async
|
|
|
|
;; ob-async has its own agenda for lazy loading packages (in the child
|
|
|
|
;; process), so we only need to make sure it's loaded.
|
|
|
|
(require 'ob-async nil t))
|
|
|
|
(prog1 (or (run-hook-with-args-until-success '+org-babel-load-functions lang)
|
|
|
|
(require (intern (format "ob-%s" lang)) nil t)
|
|
|
|
(require lang nil t))
|
|
|
|
(add-to-list 'org-babel-load-languages (cons lang t)))))
|
|
|
|
|
2020-04-14 01:29:27 -04:00
|
|
|
(defadvice! +org--export-lazy-load-library-h ()
|
2020-04-14 15:37:00 -04:00
|
|
|
"Lazy load a babel package when a block is executed during exporting."
|
2020-04-14 01:29:27 -04:00
|
|
|
:before #'org-babel-exp-src-block
|
|
|
|
(+org--babel-lazy-load-library-a (org-babel-get-src-block-info)))
|
2019-12-18 10:18:58 -05:00
|
|
|
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +org--src-lazy-load-library-a (lang)
|
2019-07-10 19:30:56 +02:00
|
|
|
"Lazy load a babel package to ensure syntax highlighting."
|
2019-07-21 02:38:42 +02:00
|
|
|
:before #'org-src--get-lang-mode
|
2019-07-10 19:30:56 +02:00
|
|
|
(or (cdr (assoc lang org-src-lang-modes))
|
2019-12-18 10:18:58 -05:00
|
|
|
(+org--babel-lazy-load lang)))
|
2019-07-10 19:30:56 +02:00
|
|
|
|
2020-04-13 15:23:16 -04:00
|
|
|
;; This also works for tangling
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +org--babel-lazy-load-library-a (info)
|
2019-06-28 16:53:26 +02:00
|
|
|
"Load babel libraries lazily when babel blocks are executed."
|
2019-07-21 02:38:42 +02:00
|
|
|
:after-while #'org-babel-confirm-evaluate
|
2019-06-28 16:53:26 +02:00
|
|
|
(let* ((lang (nth 0 info))
|
2019-09-08 20:55:21 -04:00
|
|
|
(lang (cond ((symbolp lang) lang)
|
|
|
|
((stringp lang) (intern lang))))
|
2019-06-28 16:53:26 +02:00
|
|
|
(lang (or (cdr (assq lang +org-babel-mode-alist))
|
|
|
|
lang)))
|
2020-04-13 15:23:16 -04:00
|
|
|
(+org--babel-lazy-load lang (assq :async (nth 2 info)))
|
2019-12-16 16:48:02 -05:00
|
|
|
t))
|
|
|
|
|
2020-03-27 18:06:31 -04:00
|
|
|
(advice-add #'org-babel-do-load-languages :override #'ignore))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-capture-defaults-h ()
|
2019-06-28 16:53:26 +02:00
|
|
|
"Sets up some reasonable defaults, as well as two `org-capture' workflows that
|
|
|
|
I like:
|
|
|
|
|
|
|
|
1. The traditional way: invoking `org-capture' directly, via SPC X, or through
|
|
|
|
the :cap ex command.
|
|
|
|
2. Through a org-capture popup frame that is invoked from outside Emacs (the
|
|
|
|
~/.emacs.d/bin/org-capture script). This can be invoked from qutebrowser,
|
|
|
|
vimperator, dmenu or a global keybinding."
|
|
|
|
(setq org-default-notes-file
|
|
|
|
(expand-file-name +org-capture-notes-file org-directory)
|
2020-01-12 15:03:24 +00:00
|
|
|
+org-capture-journal-file
|
|
|
|
(expand-file-name +org-capture-journal-file org-directory)
|
2019-06-28 16:53:26 +02:00
|
|
|
org-capture-templates
|
|
|
|
'(("t" "Personal todo" entry
|
|
|
|
(file+headline +org-capture-todo-file "Inbox")
|
2019-10-31 23:12:02 -04:00
|
|
|
"* [ ] %?\n%i\n%a" :prepend t)
|
2019-06-28 16:53:26 +02:00
|
|
|
("n" "Personal notes" entry
|
|
|
|
(file+headline +org-capture-notes-file "Inbox")
|
2019-10-31 22:45:59 -04:00
|
|
|
"* %u %?\n%i\n%a" :prepend t)
|
2019-10-31 23:09:26 -04:00
|
|
|
("j" "Journal" entry
|
2020-01-25 17:07:31 -05:00
|
|
|
(file+olp+datetree +org-capture-journal-file)
|
2019-10-31 23:09:26 -04:00
|
|
|
"* %U %?\n%i\n%a" :prepend t)
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
;; Will use {project-root}/{todo,notes,changelog}.org, unless a
|
|
|
|
;; {todo,notes,changelog}.org file is found in a parent directory.
|
|
|
|
;; Uses the basename from `+org-capture-todo-file',
|
|
|
|
;; `+org-capture-changelog-file' and `+org-capture-notes-file'.
|
|
|
|
("p" "Templates for projects")
|
2019-10-31 22:45:59 -04:00
|
|
|
("pt" "Project-local todo" entry ; {project-root}/todo.org
|
2019-06-28 16:53:26 +02:00
|
|
|
(file+headline +org-capture-project-todo-file "Inbox")
|
2019-10-31 22:45:59 -04:00
|
|
|
"* TODO %?\n%i\n%a" :prepend t)
|
|
|
|
("pn" "Project-local notes" entry ; {project-root}/notes.org
|
2019-06-28 16:53:26 +02:00
|
|
|
(file+headline +org-capture-project-notes-file "Inbox")
|
2019-10-31 23:12:35 -04:00
|
|
|
"* %U %?\n%i\n%a" :prepend t)
|
2019-10-31 22:45:59 -04:00
|
|
|
("pc" "Project-local changelog" entry ; {project-root}/changelog.org
|
2019-10-29 12:18:19 -04:00
|
|
|
(file+headline +org-capture-project-changelog-file "Unreleased")
|
2019-10-31 23:12:35 -04:00
|
|
|
"* %U %?\n%i\n%a" :prepend t)
|
2019-10-31 22:45:59 -04:00
|
|
|
|
|
|
|
;; Will use {org-directory}/{+org-capture-projects-file} and store
|
|
|
|
;; these under {ProjectName}/{Tasks,Notes,Changelog} headings. They
|
|
|
|
;; support `:parents' to specify what headings to put them under, e.g.
|
|
|
|
;; :parents ("Projects")
|
|
|
|
("o" "Centralized templates for projects")
|
|
|
|
("ot" "Project todo" entry
|
|
|
|
(function +org-capture-central-project-todo-file)
|
|
|
|
"* TODO %?\n %i\n %a"
|
|
|
|
:heading "Tasks"
|
|
|
|
:prepend nil)
|
|
|
|
("on" "Project notes" entry
|
|
|
|
(function +org-capture-central-project-notes-file)
|
2019-10-31 23:12:35 -04:00
|
|
|
"* %U %?\n %i\n %a"
|
2019-10-31 22:45:59 -04:00
|
|
|
:heading "Notes"
|
|
|
|
:prepend t)
|
|
|
|
("oc" "Project changelog" entry
|
|
|
|
(function +org-capture-central-project-changelog-file)
|
2019-10-31 23:12:35 -04:00
|
|
|
"* %U %?\n %i\n %a"
|
2019-10-31 22:45:59 -04:00
|
|
|
:heading "Changelog"
|
|
|
|
:prepend t)))
|
|
|
|
|
|
|
|
;; Kill capture buffers by default (unless they've been visited)
|
|
|
|
(after! org-capture
|
|
|
|
(org-capture-put :kill-buffer t))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2020-05-11 03:08:37 -04:00
|
|
|
;; Fix #462: when refiling from org-capture, Emacs prompts to kill the
|
|
|
|
;; underlying, modified buffer. This fixes that.
|
|
|
|
(add-hook 'org-after-refile-insert-hook #'save-buffer)
|
|
|
|
|
2020-02-27 00:47:30 -05:00
|
|
|
;; HACK Doom doesn't support `customize'. Best not to advertise it as an
|
|
|
|
;; option in `org-capture's menu.
|
|
|
|
(defadvice! +org--remove-customize-option-a (orig-fn table title &optional prompt specials)
|
|
|
|
:around #'org-mks
|
2020-05-11 03:08:37 -04:00
|
|
|
(funcall orig-fn table title prompt
|
|
|
|
(remove '("C" "Customize org-capture-templates")
|
|
|
|
specials)))
|
2020-02-27 00:47:30 -05:00
|
|
|
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +org--capture-expand-variable-file-a (file)
|
2019-06-28 16:53:26 +02:00
|
|
|
"If a variable is used for a file path in `org-capture-template', it is used
|
|
|
|
as is, and expanded relative to `default-directory'. This changes it to be
|
|
|
|
relative to `org-directory', unless it is an absolute path."
|
2019-07-21 02:38:42 +02:00
|
|
|
:filter-args #'org-capture-expand-file
|
2019-06-28 16:53:26 +02:00
|
|
|
(if (and (symbolp file) (boundp file))
|
|
|
|
(expand-file-name (symbol-value file) org-directory)
|
|
|
|
file))
|
|
|
|
|
2019-07-26 22:46:05 +02:00
|
|
|
(add-hook! 'org-capture-mode-hook
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-show-target-in-capture-header-h ()
|
|
|
|
(setq header-line-format
|
|
|
|
(format "%s%s%s"
|
|
|
|
(propertize (abbreviate-file-name (buffer-file-name (buffer-base-buffer)))
|
|
|
|
'face 'font-lock-string-face)
|
|
|
|
org-eldoc-breadcrumb-separator
|
|
|
|
header-line-format))))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
(when (featurep! :editor evil)
|
|
|
|
(add-hook 'org-capture-mode-hook #'evil-insert-state)))
|
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-capture-frame-h ()
|
|
|
|
(add-hook 'org-capture-after-finalize-hook #'+org-capture-cleanup-frame-h)
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2020-06-04 20:02:46 -04:00
|
|
|
(defadvice! +org-capture-refile-cleanup-frame-a (&rest _)
|
2020-05-24 23:29:35 +07:00
|
|
|
:after #'org-capture-refile
|
|
|
|
(+org-capture-cleanup-frame-h))
|
|
|
|
|
2019-06-28 16:53:26 +02:00
|
|
|
(when (featurep! :ui doom-dashboard)
|
|
|
|
(add-hook '+doom-dashboard-inhibit-functions #'+org-capture-frame-p)))
|
|
|
|
|
|
|
|
|
2019-12-29 16:31:25 -05:00
|
|
|
(defun +org-init-attachments-h ()
|
|
|
|
"Sets up org's attachment system."
|
2020-04-25 15:40:24 -04:00
|
|
|
(setq org-attach-store-link-p t ; store link after attaching files
|
|
|
|
org-attach-use-inheritance t) ; inherit properties from parent nodes
|
|
|
|
|
2020-05-20 01:07:18 -04:00
|
|
|
;; Autoload all these commands that org-attach doesn't autoload itself
|
|
|
|
(use-package! org-attach
|
|
|
|
:commands (org-attach-new
|
|
|
|
org-attach-open
|
|
|
|
org-attach-open-in-emacs
|
|
|
|
org-attach-reveal-in-emacs
|
|
|
|
org-attach-url
|
|
|
|
org-attach-set-directory
|
|
|
|
org-attach-sync)
|
|
|
|
:config
|
2020-04-25 15:40:24 -04:00
|
|
|
(unless org-attach-id-dir
|
2020-05-20 01:07:18 -04:00
|
|
|
;; Centralized attachments directory by default
|
2020-04-25 15:40:24 -04:00
|
|
|
(setq org-attach-id-dir (expand-file-name ".attach/" org-directory)))
|
|
|
|
(after! projectile
|
2020-05-07 00:54:41 -04:00
|
|
|
(add-to-list 'projectile-globally-ignored-directories org-attach-id-dir)))
|
|
|
|
|
|
|
|
;; Add inline image previews for attachment links
|
|
|
|
(org-link-set-parameters "attachment" :image-data-fun #'+org-inline-image-data-fn))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-custom-links-h ()
|
2019-06-28 16:53:26 +02:00
|
|
|
;; Highlight broken file links
|
|
|
|
(org-link-set-parameters
|
|
|
|
"file"
|
|
|
|
:face (lambda (path)
|
|
|
|
(if (or (file-remote-p path)
|
|
|
|
(file-exists-p path))
|
|
|
|
'org-link
|
|
|
|
'error)))
|
|
|
|
|
|
|
|
;; Add custom link types
|
2019-07-23 18:05:28 +02:00
|
|
|
(pushnew! org-link-abbrev-alist
|
|
|
|
'("github" . "https://github.com/%s")
|
|
|
|
'("youtube" . "https://youtube.com/watch?v=%s")
|
|
|
|
'("google" . "https://google.com/search?q=")
|
|
|
|
'("gimages" . "https://google.com/images?q=%s")
|
|
|
|
'("gmap" . "https://maps.google.com/maps?q=%s")
|
|
|
|
'("duckduckgo" . "https://duckduckgo.com/?q=%s")
|
|
|
|
'("wolfram" . "https://wolframalpha.com/input/?i=%s")
|
|
|
|
'("doom-repo" . "https://github.com/hlissner/doom-emacs/%s"))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2020-04-24 20:41:56 -04:00
|
|
|
(+org-define-basic-link "org" 'org-directory)
|
|
|
|
(+org-define-basic-link "doom" 'doom-emacs-dir)
|
|
|
|
(+org-define-basic-link "doom-docs" 'doom-docs-dir)
|
|
|
|
(+org-define-basic-link "doom-modules" 'doom-modules-dir)
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
;; Allow inline image previews of http(s)? urls or data uris
|
2020-04-24 20:41:56 -04:00
|
|
|
(org-link-set-parameters "http" :image-data-fun #'+org-http-image-data-fn)
|
|
|
|
(org-link-set-parameters "https" :image-data-fun #'+org-http-image-data-fn)
|
|
|
|
(org-link-set-parameters "img" :image-data-fun #'+org-inline-image-data-fn)
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
;; Add support for youtube links + previews
|
2019-10-25 20:00:06 -04:00
|
|
|
(require 'org-yt nil t))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-export-h ()
|
2019-10-25 20:00:06 -04:00
|
|
|
"TODO"
|
2019-10-20 12:28:38 -04:00
|
|
|
(setq org-export-with-smart-quotes t
|
|
|
|
org-html-validation-link nil)
|
2019-07-28 22:55:40 +02:00
|
|
|
|
2019-06-28 16:53:26 +02:00
|
|
|
(when (featurep! :lang markdown)
|
|
|
|
(add-to-list 'org-export-backends 'md))
|
|
|
|
|
2019-10-11 15:04:51 -04:00
|
|
|
(use-package! ox-hugo
|
|
|
|
:when (featurep! +hugo)
|
|
|
|
:after ox)
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! ox-pandoc
|
2019-09-15 19:23:06 -04:00
|
|
|
:when (featurep! +pandoc)
|
|
|
|
:when (executable-find "pandoc")
|
2019-06-28 16:53:26 +02:00
|
|
|
:after ox
|
|
|
|
:init
|
|
|
|
(add-to-list 'org-export-backends 'pandoc)
|
|
|
|
(setq org-pandoc-options
|
|
|
|
'((standalone . t)
|
|
|
|
(mathjax . t)
|
Backport bits of CLI rewrite
The rewrite for Doom's CLI is taking a while, so I've backported a few
important changes in order to ease the transition and fix a couple bugs
sooner.
Fixes #2802, #2737, #2386
The big highlights are:
- Fix #2802: We now update recipe repos *before* updating/installing any
new packages. No more "Could not find package X in recipe repositories".
- Fix #2737: An edge case where straight couldn't reach a pinned
commit (particularly with agda).
- Doom is now smarter about what option it recommends when straight
prompts you to make a choice.
- Introduces a new init path for Doom. The old way:
- Launch in "minimal" CLI mode in non-interactive sessions
- Launch a "full" interactive mode otherwise.
The new way
- Launch in "minimal" CLI mode *only* for bin/doom
- Launch is a simple mode for non-interactive sessions that still need
access to your interactive config (like async org export/babel).
- Launch a "full" interactive mode otherwise.
This should fix compatibility issues with plugins that use the
async.el library or spawn child Emacs processes to fake
parallelization (like org's async export and babel functionality).
- Your private init.el is now loaded more reliably when running any
bin/doom command. This gives you an opportunity to configure its
settings.
- Added doom-first-{input,buffer,file}-hook hooks, which we use to queue
deferred activation of a number of packages. Users can remove these
modes from these hooks; altogether preventing them from loading,
rather than waiting for them to load to then disable them,
e.g. (after! smartparens (smartparens-global-mode -1)) -> (remove-hook
'doom-first-buffer #'smartparens-global-mode)
Hooks added to doom-first-*-hook variables will be removed once they
run.
This should also indirectly fix #2386, by preventing interactive modes
from running in non-interactive session.
- Added `doom/bump-*` commands to make bumping modules and packages
easier, and `doom/bumpify-*` commands for converting package!
statements into user/repo@sha1hash format for bump commits.
- straight.el is now commit-pinned, like all other packages. We also
more reliably install straight.el by cloning it ourselves, rather than
relying on its bootstrap.el.
This should prevent infinite "straight has diverged from master"
prompts whenever we change branches (though, you might have to put up
with it one more after this update -- see #2937 for workaround).
All the other minor changes:
- Moved core/autoload/cli.el to core/autoload/process.el
- The package manager will log attempts to check out pinned commits
- If package state is incomplete while rebuilding packages, emit a
simpler error message instead of an obscure one!
- Added -u switch to 'doom sync' to make it run 'doom update' afterwards
- Added -p switch to 'doom sync' to make it run 'doom purge' afterwards
- Replace doom-modules function with doom-modules-list
- The `with-plist!` macro was removed, since `cl-destructuring-bind`
already serves that purpose well enough.
- core/autoload/packages.el was moved into core-packages.el
- bin/doom will no longer die if DOOMDIR or DOOMLOCALDIR don't have a
trailing slash
- Introduces doom-debug-variables; a list of variables to toggle on
doom/toggle-debug-mode.
- The sandbox has been updated to reflect the above changes, also:
1. Child instances will no longer inherit the process environment of
the host instance,
2. It will no longer produce an auto-save-list directory in ~/.emacs.d
2020-05-14 15:00:23 -04:00
|
|
|
(variable . "revealjs-url=https://revealjs.com"))))
|
|
|
|
|
|
|
|
(defadvice! +org--fix-async-export-a (orig-fn &rest args)
|
|
|
|
:around #'org-export-to-file
|
|
|
|
(if (not org-export-in-background)
|
|
|
|
(apply orig-fn args)
|
|
|
|
(setq org-export-async-init-file (make-temp-file "doom-org-async-export"))
|
|
|
|
(with-temp-file org-export-async-init-file
|
|
|
|
(prin1 `(progn (setq org-export-async-debug ,debug-on-error
|
|
|
|
load-path ',load-path)
|
|
|
|
(load ,user-init-file nil t))
|
|
|
|
(current-buffer)))
|
|
|
|
(apply orig-fn args))))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2020-05-12 05:15:55 -04:00
|
|
|
(defun +org-init-habit-h ()
|
|
|
|
(add-hook! 'org-agenda-mode-hook
|
|
|
|
(defun +org-habit-resize-graph-h ()
|
|
|
|
"Right align and resize the consistency graphs based on
|
|
|
|
`+org-habit-graph-window-ratio'"
|
|
|
|
(when (featurep 'org-habit)
|
|
|
|
(let* ((total-days (float (+ org-habit-preceding-days org-habit-following-days)))
|
|
|
|
(preceding-days-ratio (/ org-habit-preceding-days total-days))
|
|
|
|
(graph-width (floor (* (window-width) +org-habit-graph-window-ratio)))
|
|
|
|
(preceding-days (floor (* graph-width preceding-days-ratio)))
|
|
|
|
(following-days (- graph-width preceding-days))
|
|
|
|
(graph-column (- (window-width) (+ preceding-days following-days)))
|
|
|
|
(graph-column-adjusted (if (> graph-column +org-habit-min-width)
|
|
|
|
(- graph-column +org-habit-graph-padding)
|
|
|
|
nil)))
|
|
|
|
(setq-local org-habit-preceding-days preceding-days)
|
|
|
|
(setq-local org-habit-following-days following-days)
|
|
|
|
(setq-local org-habit-graph-column graph-column-adjusted))))))
|
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-hacks-h ()
|
2019-06-28 16:53:26 +02:00
|
|
|
"Getting org to behave."
|
2020-04-25 15:40:24 -04:00
|
|
|
;; Open file links in current window, rather than new ones
|
2019-06-28 16:53:26 +02:00
|
|
|
(setf (alist-get 'file org-link-frame-setup) #'find-file)
|
2020-04-25 15:40:24 -04:00
|
|
|
;; Open directory links in dired
|
2019-06-28 16:53:26 +02:00
|
|
|
(add-to-list 'org-file-apps '(directory . emacs))
|
|
|
|
|
2020-05-12 19:59:14 -04:00
|
|
|
;; HACK Org is known to use a lot of unicode symbols (and large org files tend
|
|
|
|
;; to be especially memory hungry). Compounded with
|
|
|
|
;; `inhibit-compacting-font-caches' being non-nil, org needs more memory
|
|
|
|
;; to be performant.
|
|
|
|
(setq-hook! 'org-mode-hook gcmh-high-cons-threshold (* 2 gcmh-high-cons-threshold))
|
|
|
|
|
2019-07-26 22:46:05 +02:00
|
|
|
(add-hook! 'org-follow-link-hook
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-delayed-recenter-h ()
|
|
|
|
"`recenter', but after a tiny delay. Necessary to prevent certain race
|
2019-06-28 16:53:26 +02:00
|
|
|
conditions where a window's buffer hasn't changed at the time this hook is run."
|
2019-07-21 02:38:42 +02:00
|
|
|
(run-at-time 0.1 nil #'recenter)))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +org--strip-properties-from-outline-a (orig-fn path &optional width prefix separator)
|
2019-06-28 16:53:26 +02:00
|
|
|
"Remove link syntax and fix variable height text (e.g. org headings) in the
|
|
|
|
eldoc string."
|
2019-07-21 02:38:42 +02:00
|
|
|
:around #'org-format-outline-path
|
2019-12-02 20:28:55 -05:00
|
|
|
(funcall orig-fn
|
|
|
|
(cl-loop for part in path
|
|
|
|
;; Remove full link syntax
|
2020-02-16 00:49:01 -05:00
|
|
|
for fixedpart = (replace-regexp-in-string org-link-any-re "\\4" part)
|
2019-12-02 20:28:55 -05:00
|
|
|
for n from 0
|
|
|
|
for face = (nth (% n org-n-level-faces) org-level-faces)
|
|
|
|
collect
|
2020-02-16 00:49:01 -05:00
|
|
|
(org-add-props fixedpart
|
2019-12-02 20:28:55 -05:00
|
|
|
nil 'face `(:foreground ,(face-foreground face nil t) :weight bold)))
|
|
|
|
width prefix separator))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2020-04-28 18:43:15 -04:00
|
|
|
(after! org-eldoc
|
|
|
|
;; HACK Fix #2972: infinite recursion when eldoc kicks in in 'org' or
|
|
|
|
;; 'python' src blocks.
|
|
|
|
;; TODO Should be reported upstream!
|
|
|
|
(puthash "org" #'ignore org-eldoc-local-functions-cache)
|
|
|
|
(puthash "python" #'python-eldoc-function org-eldoc-local-functions-cache))
|
|
|
|
|
2019-10-07 23:20:23 -04:00
|
|
|
(defun +org--restart-mode-h ()
|
|
|
|
"Restart `org-mode', but only once."
|
|
|
|
(quiet! (org-mode-restart))
|
|
|
|
(delq! (current-buffer) org-agenda-new-buffers)
|
|
|
|
(remove-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
|
|
|
|
'local))
|
|
|
|
|
2019-07-26 22:46:05 +02:00
|
|
|
(add-hook! 'org-agenda-finalize-hook
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-exclude-agenda-buffers-from-workspace-h ()
|
2019-08-27 00:13:04 -04:00
|
|
|
"Prevent temporarily-opened agenda buffers from being associated with the
|
2019-10-04 13:57:20 -04:00
|
|
|
current workspace (and clean them up)."
|
2019-07-21 02:38:42 +02:00
|
|
|
(when (and org-agenda-new-buffers (bound-and-true-p persp-mode))
|
2019-11-29 21:54:51 -05:00
|
|
|
(unless org-agenda-sticky
|
|
|
|
(let (persp-autokill-buffer-on-remove)
|
|
|
|
(persp-remove-buffer org-agenda-new-buffers
|
|
|
|
(get-current-persp)
|
|
|
|
nil)))
|
2019-10-07 23:20:23 -04:00
|
|
|
(dolist (buffer org-agenda-new-buffers)
|
|
|
|
(with-current-buffer buffer
|
|
|
|
;; HACK Org agenda opens temporary agenda incomplete org-mode
|
2019-10-20 13:29:29 -04:00
|
|
|
;; buffers. These are great for extracting agenda information
|
|
|
|
;; from, but what if the user tries to visit one of these
|
|
|
|
;; buffers? Then we remove it from the to-be-cleaned queue and
|
|
|
|
;; restart `org-mode' so they can grow up to be full-fledged
|
|
|
|
;; org-mode buffers.
|
2019-10-07 23:20:23 -04:00
|
|
|
(add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
|
|
|
|
nil 'local))))))
|
2019-07-21 02:38:42 +02:00
|
|
|
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +org--exclude-agenda-buffers-from-recentf-a (orig-fn file)
|
2019-06-28 16:53:26 +02:00
|
|
|
"Prevent temporarily opened agenda buffers from polluting recentf."
|
2019-07-21 02:38:42 +02:00
|
|
|
:around #'org-get-agenda-file-buffer
|
2019-06-28 16:53:26 +02:00
|
|
|
(let ((recentf-exclude (list (lambda (_file) t))))
|
2019-09-26 15:29:09 -04:00
|
|
|
(funcall orig-fn file)))
|
|
|
|
|
|
|
|
;; HACK With https://code.orgmode.org/bzg/org-mode/commit/48da60f4, inline
|
2019-10-20 13:29:29 -04:00
|
|
|
;; image previews broke for users with imagemagick support built in. This
|
|
|
|
;; reverses the problem, but should be removed once it is addressed
|
|
|
|
;; upstream (if ever).
|
2019-09-26 15:29:09 -04:00
|
|
|
(defadvice! +org--fix-inline-images-for-imagemagick-users-a (orig-fn &rest args)
|
|
|
|
:around #'org-display-inline-images
|
2020-04-29 21:08:17 -04:00
|
|
|
(letf! (defun create-image (file-or-data &optional type data-p &rest props)
|
|
|
|
(let ((type (if (plist-get props :width) type)))
|
|
|
|
(apply create-image file-or-data type data-p props)))
|
2020-03-31 12:33:16 +01:00
|
|
|
(apply orig-fn args)))
|
|
|
|
|
2020-04-07 10:22:05 +01:00
|
|
|
(defadvice! +org--fix-inconsistent-uuidgen-case-a (uuid)
|
2020-03-31 12:33:16 +01:00
|
|
|
"Ensure uuidgen always produces lowercase output regardless of system."
|
2020-04-07 10:22:05 +01:00
|
|
|
:filter-return #'org-id-new
|
|
|
|
(if (eq org-id-method 'uuid)
|
|
|
|
(downcase uuid)
|
|
|
|
uuid)))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-keybinds-h ()
|
2017-07-05 02:33:41 +02:00
|
|
|
"Sets up org-mode and evil keybindings. Tries to fix the idiosyncrasies
|
|
|
|
between the two."
|
2019-07-21 02:38:42 +02:00
|
|
|
(add-hook 'doom-escape-hook #'+org-remove-occur-highlights-h)
|
2018-07-09 15:33:31 +02:00
|
|
|
|
2018-02-18 00:26:27 -05:00
|
|
|
;; C-a & C-e act like `doom/backward-to-bol-or-indent' and
|
|
|
|
;; `doom/forward-to-last-non-comment-or-eol', but with more org awareness.
|
|
|
|
(setq org-special-ctrl-a/e t)
|
2018-07-09 15:33:31 +02:00
|
|
|
|
2018-07-04 13:16:11 +02:00
|
|
|
(setq org-M-RET-may-split-line nil
|
|
|
|
;; insert new headings after current subtree rather than inside it
|
|
|
|
org-insert-heading-respect-content t)
|
2018-07-09 15:33:31 +02:00
|
|
|
|
2019-07-26 19:57:13 +02:00
|
|
|
(add-hook! 'org-tab-first-hook
|
2020-01-01 20:59:58 -05:00
|
|
|
#'+org-yas-expand-maybe-h
|
|
|
|
#'+org-indent-maybe-h)
|
2019-07-26 19:57:13 +02:00
|
|
|
|
|
|
|
(add-hook 'doom-delete-backward-functions
|
|
|
|
#'+org-delete-backward-char-and-realign-table-maybe-h)
|
2018-07-09 15:33:31 +02:00
|
|
|
|
2019-01-22 18:51:45 -05:00
|
|
|
(map! :map org-mode-map
|
2019-10-25 20:00:06 -04:00
|
|
|
"C-c C-S-l" #'+org/remove-link
|
|
|
|
"C-c C-i" #'org-toggle-inline-images
|
2019-01-22 18:51:45 -05:00
|
|
|
;; textmate-esque newline insertion
|
2020-04-27 17:30:23 -04:00
|
|
|
"C-RET" #'+org/insert-item-below
|
|
|
|
"C-S-RET" #'+org/insert-item-above
|
|
|
|
"C-M-RET" #'org-insert-subheading
|
2019-06-28 16:53:26 +02:00
|
|
|
[C-return] #'+org/insert-item-below
|
|
|
|
[C-S-return] #'+org/insert-item-above
|
2020-01-06 16:21:22 -05:00
|
|
|
[C-M-return] #'org-insert-subheading
|
2020-01-10 05:00:08 -05:00
|
|
|
(:when IS-MAC
|
2020-05-24 21:54:37 -05:00
|
|
|
[s-return] #'+org/insert-item-below
|
|
|
|
[s-S-return] #'+org/insert-item-above
|
|
|
|
[s-M-return] #'org-insert-subheading)
|
2019-10-25 20:00:06 -04:00
|
|
|
;; Org-aware C-a/C-e
|
2019-01-22 18:51:45 -05:00
|
|
|
[remap doom/backward-to-bol-or-indent] #'org-beginning-of-line
|
2019-04-04 18:47:40 -04:00
|
|
|
[remap doom/forward-to-last-non-comment-or-eol] #'org-end-of-line
|
|
|
|
|
|
|
|
:localleader
|
2020-04-24 02:08:09 -04:00
|
|
|
"#" #'org-update-statistics-cookies
|
2019-05-12 01:46:29 -04:00
|
|
|
"'" #'org-edit-special
|
2020-04-24 02:08:09 -04:00
|
|
|
"*" #'org-ctrl-c-star
|
|
|
|
"+" #'org-ctrl-c-minus
|
2019-04-05 04:12:56 -04:00
|
|
|
"," #'org-switchb
|
2019-04-05 04:33:26 -04:00
|
|
|
"." #'org-goto
|
|
|
|
(:when (featurep! :completion ivy)
|
2020-05-24 21:54:37 -05:00
|
|
|
"." #'counsel-org-goto
|
|
|
|
"/" #'counsel-org-goto-all)
|
2019-04-05 04:33:26 -04:00
|
|
|
(:when (featurep! :completion helm)
|
2020-05-24 21:54:37 -05:00
|
|
|
"." #'helm-org-in-buffer-headings
|
|
|
|
"/" #'helm-org-agenda-files-headings)
|
2019-11-04 10:48:06 +00:00
|
|
|
"A" #'org-archive-subtree
|
2019-10-11 14:49:21 -04:00
|
|
|
"e" #'org-export-dispatch
|
2019-04-04 18:47:40 -04:00
|
|
|
"f" #'org-footnote-new
|
2019-05-12 01:46:29 -04:00
|
|
|
"h" #'org-toggle-heading
|
|
|
|
"i" #'org-toggle-item
|
|
|
|
"I" #'org-toggle-inline-images
|
2019-10-25 20:00:06 -04:00
|
|
|
"n" #'org-store-link
|
|
|
|
"o" #'org-set-property
|
|
|
|
"p" #'org-priority
|
2019-05-13 10:40:43 +02:00
|
|
|
"q" #'org-set-tags-command
|
2019-05-12 01:46:29 -04:00
|
|
|
"t" #'org-todo
|
|
|
|
"T" #'org-todo-list
|
2019-10-25 20:00:06 -04:00
|
|
|
(:prefix ("a" . "attachments")
|
2020-05-24 21:54:37 -05:00
|
|
|
"a" #'org-attach
|
|
|
|
"d" #'org-attach-delete-one
|
|
|
|
"D" #'org-attach-delete-all
|
|
|
|
"f" #'+org/find-file-in-attachments
|
|
|
|
"l" #'+org/attach-file-and-insert-link
|
|
|
|
"n" #'org-attach-new
|
|
|
|
"o" #'org-attach-open
|
|
|
|
"O" #'org-attach-open-in-emacs
|
|
|
|
"r" #'org-attach-reveal
|
|
|
|
"R" #'org-attach-reveal-in-emacs
|
|
|
|
"u" #'org-attach-url
|
|
|
|
"s" #'org-attach-set-directory
|
|
|
|
"S" #'org-attach-sync
|
|
|
|
(:when (featurep! +dragndrop)
|
|
|
|
"c" #'org-download-screenshot
|
|
|
|
"y" #'org-download-yank))
|
2019-11-11 00:19:55 -05:00
|
|
|
(:prefix ("b" . "tables")
|
2020-05-24 21:54:37 -05:00
|
|
|
"-" #'org-table-insert-hline
|
|
|
|
"a" #'org-table-align
|
|
|
|
"b" #'org-table-blank-field
|
|
|
|
"c" #'org-table-create-or-convert-from-region
|
|
|
|
"e" #'org-table-edit-field
|
|
|
|
"f" #'org-table-edit-formulas
|
|
|
|
"h" #'org-table-field-info
|
|
|
|
"s" #'org-table-sort-lines
|
|
|
|
"r" #'org-table-recalculate
|
|
|
|
"R" #'org-table-recalculate-buffer-tables
|
|
|
|
(:prefix ("d" . "delete")
|
|
|
|
"c" #'org-table-delete-column
|
|
|
|
"r" #'org-table-kill-row)
|
|
|
|
(:prefix ("i" . "insert")
|
|
|
|
"c" #'org-table-insert-column
|
|
|
|
"h" #'org-table-insert-hline
|
|
|
|
"r" #'org-table-insert-row
|
|
|
|
"H" #'org-table-hline-and-move)
|
|
|
|
(:prefix ("t" . "toggle")
|
|
|
|
"f" #'org-table-toggle-formula-debugger
|
|
|
|
"o" #'org-table-toggle-coordinate-overlays)
|
|
|
|
(:when (featurep! +gnuplot)
|
|
|
|
"p" #'org-plot/gnuplot))
|
2019-04-04 18:47:40 -04:00
|
|
|
(:prefix ("c" . "clock")
|
2020-05-24 21:54:37 -05:00
|
|
|
"c" #'org-clock-cancel
|
|
|
|
"d" #'org-clock-mark-default-task
|
|
|
|
"e" #'org-clock-modify-effort-estimate
|
|
|
|
"E" #'org-set-effort
|
|
|
|
"g" #'org-clock-goto
|
|
|
|
"G" (λ! (org-clock-goto 'select))
|
|
|
|
"i" #'org-clock-in
|
|
|
|
"I" #'org-clock-in-last
|
|
|
|
"o" #'org-clock-out
|
|
|
|
"r" #'org-resolve-clocks
|
|
|
|
"R" #'org-clock-report
|
|
|
|
"t" #'org-evaluate-time-range
|
|
|
|
"=" #'org-clock-timestamps-up
|
|
|
|
"-" #'org-clock-timestamps-down)
|
2020-04-24 02:05:35 -04:00
|
|
|
(:prefix ("d" . "date/deadline")
|
2020-05-24 21:54:37 -05:00
|
|
|
"d" #'org-deadline
|
|
|
|
"s" #'org-schedule
|
|
|
|
"t" #'org-time-stamp
|
|
|
|
"T" #'org-time-stamp-inactive)
|
2019-04-05 04:12:56 -04:00
|
|
|
(:prefix ("g" . "goto")
|
2020-05-24 21:54:37 -05:00
|
|
|
"g" #'org-goto
|
|
|
|
(:when (featurep! :completion ivy)
|
|
|
|
"g" #'counsel-org-goto
|
|
|
|
"G" #'counsel-org-goto-all)
|
|
|
|
(:when (featurep! :completion helm)
|
|
|
|
"g" #'helm-org-in-buffer-headings
|
|
|
|
"G" #'helm-org-agenda-files-headings)
|
|
|
|
"c" #'org-clock-goto
|
|
|
|
"C" (λ! (org-clock-goto 'select))
|
|
|
|
"i" #'org-id-goto
|
|
|
|
"r" #'org-refile-goto-last-stored
|
|
|
|
"v" #'+org/goto-visible
|
|
|
|
"x" #'org-capture-goto-last-stored)
|
2019-11-21 17:13:21 -05:00
|
|
|
(:prefix ("l" . "links")
|
2020-05-24 21:54:37 -05:00
|
|
|
"c" #'org-cliplink
|
|
|
|
"d" #'+org/remove-link
|
|
|
|
"i" #'org-id-store-link
|
|
|
|
"l" #'org-insert-link
|
|
|
|
"L" #'org-insert-all-links
|
|
|
|
"s" #'org-store-link
|
|
|
|
"S" #'org-insert-last-stored-link
|
|
|
|
"t" #'org-toggle-link-display)
|
2019-11-11 00:19:55 -05:00
|
|
|
(:prefix ("r" . "refile")
|
2020-05-24 21:54:37 -05:00
|
|
|
"." #'+org/refile-to-current-file
|
|
|
|
"c" #'+org/refile-to-running-clock
|
|
|
|
"l" #'+org/refile-to-last-location
|
|
|
|
"f" #'+org/refile-to-file
|
|
|
|
"o" #'+org/refile-to-other-window
|
|
|
|
"O" #'+org/refile-to-other-buffer
|
|
|
|
"v" #'+org/refile-to-visible
|
|
|
|
"r" #'org-refile) ; to all `org-refile-targets'
|
|
|
|
(:prefix ("s" . "Tree/Subtree")
|
|
|
|
"a" #'org-toggle-archive-tag
|
|
|
|
"b" #'org-tree-to-indirect-buffer
|
|
|
|
"d" #'org-cut-subtree
|
|
|
|
"h" #'org-promote-subtree
|
|
|
|
"j" #'org-move-subtree-down
|
|
|
|
"k" #'org-move-subtree-up
|
|
|
|
"l" #'org-demote-subtree
|
|
|
|
"n" #'org-narrow-to-subtree
|
|
|
|
"r" #'org-refile
|
|
|
|
"s" #'org-sparse-tree
|
|
|
|
"A" #'org-archive-subtree
|
|
|
|
"N" #'widen
|
|
|
|
"S" #'org-sort
|
|
|
|
(:prefix ("p" . "Org Priority")
|
|
|
|
"d" #'org-priority-down
|
|
|
|
"p" #'org-priority
|
|
|
|
"u" #'org-priority-up)))
|
|
|
|
|
2019-05-10 08:16:09 +02:00
|
|
|
|
2019-10-23 17:36:30 -04:00
|
|
|
(map! :after org-agenda
|
2019-11-30 14:45:41 -05:00
|
|
|
:map org-agenda-mode-map
|
2019-12-03 11:33:18 -05:00
|
|
|
:m "C-SPC" #'org-agenda-show-and-scroll-up
|
2019-05-10 08:16:09 +02:00
|
|
|
:localleader
|
2020-05-26 22:11:58 +02:00
|
|
|
(:prefix ("d" . "date/deadline")
|
|
|
|
"d" #'org-agenda-deadline
|
|
|
|
"s" #'org-agenda-schedule)
|
2019-11-10 19:10:49 +09:00
|
|
|
(:prefix ("c" . "clock")
|
2020-05-26 22:08:11 +02:00
|
|
|
"c" #'org-agenda-clock-cancel
|
2020-05-24 21:54:37 -05:00
|
|
|
"g" #'org-agenda-clock-goto
|
2020-05-26 22:08:11 +02:00
|
|
|
"i" #'org-agenda-clock-in
|
|
|
|
"o" #'org-agenda-clock-out
|
2020-05-24 21:54:37 -05:00
|
|
|
"r" #'org-agenda-clockreport-mode
|
2020-05-26 22:08:11 +02:00
|
|
|
"s" #'org-agenda-show-clocking-issues)
|
2019-05-10 15:03:29 +02:00
|
|
|
"q" #'org-agenda-set-tags
|
2019-05-10 08:16:09 +02:00
|
|
|
"r" #'org-agenda-refile
|
|
|
|
"t" #'org-agenda-todo))
|
2019-03-07 00:15:15 -05:00
|
|
|
|
2018-07-09 15:33:31 +02:00
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-popup-rules-h ()
|
2019-06-28 16:53:26 +02:00
|
|
|
(set-popup-rules!
|
|
|
|
'(("^\\*Org Links" :slot -1 :vslot -1 :size 2 :ttl 0)
|
2020-02-29 00:33:58 -05:00
|
|
|
("^ ?\\*\\(?:Agenda Com\\|Calendar\\|Org Export Dispatcher\\)"
|
2019-06-28 16:53:26 +02:00
|
|
|
:slot -1 :vslot -1 :size #'+popup-shrink-to-fit :ttl 0)
|
2020-02-29 00:33:58 -05:00
|
|
|
("^\\*Org \\(?:Select\\|Attach\\)" :slot -1 :vslot -2 :ttl 0 :size 0.25)
|
2020-04-13 14:18:11 -04:00
|
|
|
("^\\*Org Agenda" :ignore t)
|
|
|
|
("^\\*Org Src" :size 0.4 :quit nil :select t :autosave t :modeline t :ttl nil)
|
|
|
|
("^\\*Org-Babel")
|
2020-02-27 20:10:48 +01:00
|
|
|
("^CAPTURE-.*\\.org$" :size 0.25 :quit nil :select t :autosave t))))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-protocol-lazy-loader-h ()
|
2019-06-28 16:53:26 +02:00
|
|
|
"Brings lazy-loaded support for org-protocol, so external programs (like
|
|
|
|
browsers) can invoke specialized behavior from Emacs. Normally you'd simply
|
|
|
|
require `org-protocol' and use it, but the package loads all of org for no
|
|
|
|
compelling reason, so..."
|
2019-07-23 17:24:56 +02:00
|
|
|
(defadvice! +org--server-visit-files-a (args)
|
2019-06-28 16:53:26 +02:00
|
|
|
"Advise `server-visit-flist' to invoke `org-protocol' lazily."
|
2019-07-21 02:38:42 +02:00
|
|
|
:filter-args #'server-visit-files
|
2019-06-28 16:53:26 +02:00
|
|
|
(cl-destructuring-bind (files proc &optional nowait) args
|
|
|
|
(catch 'greedy
|
|
|
|
(let ((flist (reverse files)))
|
|
|
|
(dolist (var flist)
|
|
|
|
(when (string-match-p ":/+" (car var))
|
|
|
|
(require 'server)
|
|
|
|
(require 'org-protocol)
|
|
|
|
;; `\' to `/' on windows
|
|
|
|
(let ((fname (org-protocol-check-filename-for-protocol
|
|
|
|
(expand-file-name (car var))
|
|
|
|
(member var flist)
|
|
|
|
proc)))
|
|
|
|
(cond ((eq fname t) ; greedy? We need the t return value.
|
|
|
|
(setq files nil)
|
|
|
|
(throw 'greedy t))
|
|
|
|
((stringp fname) ; probably filename
|
|
|
|
(setcar var fname))
|
|
|
|
((setq files (delq var files)))))))))
|
|
|
|
(list files proc nowait)))
|
|
|
|
|
|
|
|
;; Disable built-in, clumsy advice
|
|
|
|
(after! org-protocol
|
|
|
|
(ad-disable-advice 'server-visit-files 'before 'org-protocol-detect-protocol-server)))
|
|
|
|
|
|
|
|
|
2019-07-21 02:38:42 +02:00
|
|
|
(defun +org-init-protocol-h ()
|
2019-06-28 16:53:26 +02:00
|
|
|
;; TODO org-board or better link grabbing support
|
|
|
|
;; TODO org-capture + org-protocol instead of bin/org-capture
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-05-13 22:48:42 -04:00
|
|
|
(defun +org-init-smartparens-h ()
|
|
|
|
;; Disable the slow defaults
|
|
|
|
(provide 'smartparens-org))
|
|
|
|
|
|
|
|
|
2019-10-25 20:00:06 -04:00
|
|
|
;;
|
|
|
|
;;; Packages
|
|
|
|
|
|
|
|
(use-package! toc-org ; auto-table of contents
|
|
|
|
:hook (org-mode . toc-org-enable)
|
2020-04-04 00:30:14 -04:00
|
|
|
:config
|
|
|
|
(setq toc-org-hrefify-default "gh")
|
|
|
|
|
|
|
|
(defadvice! +org-inhibit-scrolling-a (orig-fn &rest args)
|
|
|
|
"Prevent the jarring scrolling that occurs when the-ToC is regenerated."
|
|
|
|
:around #'toc-org-insert-toc
|
|
|
|
(let ((p (set-marker (make-marker) (point)))
|
|
|
|
(s (window-start)))
|
|
|
|
(prog1 (apply orig-fn args)
|
|
|
|
(goto-char p)
|
|
|
|
(set-window-start nil s t)
|
|
|
|
(set-marker p nil)))))
|
2019-10-25 20:00:06 -04:00
|
|
|
|
|
|
|
|
2020-04-14 17:55:06 -04:00
|
|
|
(use-package! org-superstar ; "prettier" bullets
|
|
|
|
:hook (org-mode . org-superstar-mode)
|
|
|
|
:config
|
|
|
|
;; Make leading stars truly invisible, by rendering them as spaces!
|
|
|
|
(setq org-superstar-leading-bullet ?\s
|
2020-05-05 21:45:19 -04:00
|
|
|
org-superstar-leading-fallback ?\s
|
2020-04-14 17:55:06 -04:00
|
|
|
org-hide-leading-stars nil)
|
|
|
|
;; Don't do anything special for item bullets or TODOs by default; these slow
|
|
|
|
;; down larger org buffers.
|
|
|
|
(setq org-superstar-prettify-item-bullets nil
|
|
|
|
org-superstar-special-todo-items nil
|
|
|
|
;; ...but configure it in case the user wants it later
|
|
|
|
org-superstar-todo-bullet-alist
|
|
|
|
'(("TODO" . 9744)
|
|
|
|
("[ ]" . 9744)
|
|
|
|
("DONE" . 9745)
|
|
|
|
("[X]" . 9745))))
|
2019-10-25 20:00:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
(use-package! org-crypt ; built-in
|
2020-04-17 12:08:08 +02:00
|
|
|
:commands org-encrypt-entries org-encrypt-entry org-decrypt-entries org-decrypt-entry
|
2019-10-25 20:00:06 -04:00
|
|
|
:hook (org-reveal-start . org-decrypt-entry)
|
2020-04-30 14:37:06 -04:00
|
|
|
:preface
|
|
|
|
;; org-crypt falls back to CRYPTKEY property then `epa-file-encrypt-to', which
|
|
|
|
;; is a better default than the empty string `org-crypt-key' defaults to.
|
|
|
|
(defvar org-crypt-key nil)
|
2020-05-02 17:52:22 -04:00
|
|
|
(after! org
|
|
|
|
(add-to-list 'org-tags-exclude-from-inheritance "crypt")
|
|
|
|
(add-hook! 'org-mode-hook
|
2020-05-16 05:13:46 -04:00
|
|
|
(add-hook 'before-save-hook 'org-encrypt-entries nil t))))
|
2019-10-25 20:00:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
(use-package! org-clock ; built-in
|
|
|
|
:commands org-clock-save
|
|
|
|
:init
|
|
|
|
(setq org-clock-persist-file (concat doom-etc-dir "org-clock-save.el"))
|
|
|
|
(defadvice! +org--clock-load-a (&rest _)
|
|
|
|
"Lazy load org-clock until its commands are used."
|
|
|
|
:before '(org-clock-in
|
|
|
|
org-clock-out
|
|
|
|
org-clock-in-last
|
|
|
|
org-clock-goto
|
|
|
|
org-clock-cancel)
|
|
|
|
(org-clock-load))
|
|
|
|
:config
|
2019-11-01 14:45:14 -04:00
|
|
|
(setq org-clock-persist 'history
|
2019-10-25 20:00:06 -04:00
|
|
|
;; Resume when clocking into task with open clock
|
|
|
|
org-clock-in-resume t)
|
|
|
|
(add-hook 'kill-emacs-hook #'org-clock-save))
|
|
|
|
|
|
|
|
|
2020-04-14 15:31:39 -04:00
|
|
|
(use-package! org-pdftools
|
2019-10-25 20:00:06 -04:00
|
|
|
:when (featurep! :tools pdf)
|
2020-04-14 15:31:39 -04:00
|
|
|
:commands org-pdftools-export
|
2019-10-25 20:00:06 -04:00
|
|
|
:init
|
|
|
|
(after! org
|
2020-04-17 14:05:15 -04:00
|
|
|
(org-link-set-parameters (or (bound-and-true-p org-pdftools-link-prefix) "pdf")
|
2020-04-14 15:31:39 -04:00
|
|
|
:follow #'org-pdftools-open
|
|
|
|
:complete #'org-pdftools-complete-link
|
|
|
|
:store #'org-pdftools-store-link
|
|
|
|
:export #'org-pdftools-export)
|
2020-04-15 23:46:58 -04:00
|
|
|
(add-hook! 'org-open-link-functions
|
2020-04-17 22:45:16 -04:00
|
|
|
(defun +org-open-legacy-pdf-links-fn (link)
|
|
|
|
"Open pdftools:* and pdfviews:* links as if they were pdf:* links."
|
2020-04-16 19:10:28 -04:00
|
|
|
(let ((regexp "^pdf\\(?:tools\\|view\\):"))
|
2020-04-16 14:51:26 -04:00
|
|
|
(when (string-match-p regexp link)
|
2020-04-16 19:10:28 -04:00
|
|
|
(org-pdftools-open (replace-regexp-in-string regexp "" link))
|
2020-04-17 14:05:15 -04:00
|
|
|
t))))))
|
2019-10-25 20:00:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
(use-package! evil-org
|
|
|
|
:when (featurep! :editor evil +everywhere)
|
|
|
|
:hook (org-mode . evil-org-mode)
|
|
|
|
:init
|
|
|
|
(defvar evil-org-retain-visual-state-on-shift t)
|
|
|
|
(defvar evil-org-special-o/O '(table-row))
|
|
|
|
(defvar evil-org-use-additional-insert t)
|
|
|
|
:config
|
|
|
|
(evil-org-set-key-theme)
|
2019-12-30 00:07:19 -05:00
|
|
|
(add-hook! 'org-tab-first-hook :append
|
|
|
|
;; Only fold the current tree, rather than recursively
|
|
|
|
#'+org-cycle-only-current-subtree-h
|
|
|
|
;; Clear babel results if point is inside a src block
|
|
|
|
#'+org-clear-babel-results-h)
|
2019-10-25 20:00:06 -04:00
|
|
|
(map! :map evil-org-mode-map
|
|
|
|
:ni [C-return] #'+org/insert-item-below
|
|
|
|
:ni [C-S-return] #'+org/insert-item-above
|
|
|
|
;; navigate table cells (from insert-mode)
|
|
|
|
:i "C-l" (general-predicate-dispatch 'org-end-of-line
|
|
|
|
(org-at-table-p) 'org-table-next-field)
|
|
|
|
:i "C-h" (general-predicate-dispatch 'org-beginning-of-line
|
|
|
|
(org-at-table-p) 'org-table-previous-field)
|
|
|
|
:i "C-k" (general-predicate-dispatch 'org-up-element
|
|
|
|
(org-at-table-p) '+org/table-previous-row)
|
|
|
|
:i "C-j" (general-predicate-dispatch 'org-down-element
|
|
|
|
(org-at-table-p) 'org-table-next-row)
|
|
|
|
;; moving/(de|pro)moting subtress & expanding tables (prepend/append columns/rows)
|
|
|
|
:ni "C-S-l" #'org-shiftright
|
|
|
|
:ni "C-S-h" #'org-shiftleft
|
|
|
|
:ni "C-S-k" #'org-shiftup
|
|
|
|
:ni "C-S-j" #'org-shiftdown
|
|
|
|
;; more intuitive RET keybinds
|
2020-05-15 01:44:53 -04:00
|
|
|
:i [return] (λ! (org-return t))
|
|
|
|
:i "RET" (λ! (org-return t))
|
2019-10-25 20:00:06 -04:00
|
|
|
:n [return] #'+org/dwim-at-point
|
|
|
|
:n "RET" #'+org/dwim-at-point
|
|
|
|
;; more vim-esque org motion keys (not covered by evil-org-mode)
|
|
|
|
:m "]h" #'org-forward-heading-same-level
|
|
|
|
:m "[h" #'org-backward-heading-same-level
|
|
|
|
:m "]l" #'org-next-link
|
|
|
|
:m "[l" #'org-previous-link
|
|
|
|
:m "]c" #'org-babel-next-src-block
|
|
|
|
:m "[c" #'org-babel-previous-src-block
|
|
|
|
:n "gQ" #'org-fill-paragraph
|
|
|
|
:n "gr" #'org-ctrl-c-ctrl-c
|
|
|
|
:n "gR" #'org-babel-execute-buffer
|
|
|
|
;; sensible vim-esque folding keybinds
|
|
|
|
:n "za" #'+org/toggle-fold
|
|
|
|
:n "zA" #'org-shifttab
|
|
|
|
:n "zc" #'+org/close-fold
|
|
|
|
:n "zC" #'outline-hide-subtree
|
|
|
|
:n "zm" #'+org/hide-next-fold-level
|
2020-05-13 19:29:10 -04:00
|
|
|
:n "zM" #'+org/close-all-folds
|
2019-10-25 20:00:06 -04:00
|
|
|
:n "zn" #'org-tree-to-indirect-buffer
|
|
|
|
:n "zo" #'+org/open-fold
|
|
|
|
:n "zO" #'outline-show-subtree
|
|
|
|
:n "zr" #'+org/show-next-fold-level
|
2020-05-13 19:29:10 -04:00
|
|
|
:n "zR" #'+org/open-all-folds
|
2019-10-25 20:00:06 -04:00
|
|
|
:n "zi" #'org-toggle-inline-images
|
|
|
|
|
|
|
|
:map org-read-date-minibuffer-local-map
|
2020-06-04 20:02:46 -04:00
|
|
|
"C-h" (cmd! (org-eval-in-calendar '(calendar-backward-day 1)))
|
|
|
|
"C-l" (cmd! (org-eval-in-calendar '(calendar-forward-day 1)))
|
|
|
|
"C-k" (cmd! (org-eval-in-calendar '(calendar-backward-week 1)))
|
|
|
|
"C-j" (cmd! (org-eval-in-calendar '(calendar-forward-week 1)))
|
|
|
|
"C-S-h" (cmd! (org-eval-in-calendar '(calendar-backward-month 1)))
|
|
|
|
"C-S-l" (cmd! (org-eval-in-calendar '(calendar-forward-month 1)))
|
|
|
|
"C-S-k" (cmd! (org-eval-in-calendar '(calendar-backward-year 1)))
|
|
|
|
"C-S-j" (cmd! (org-eval-in-calendar '(calendar-forward-year 1)))))
|
2019-10-25 20:00:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
(use-package! evil-org-agenda
|
|
|
|
:when (featurep! :editor evil +everywhere)
|
|
|
|
:hook (org-agenda-mode . evil-org-agenda-mode)
|
|
|
|
:config
|
|
|
|
(evil-org-agenda-set-keys)
|
|
|
|
(evil-define-key* 'motion evil-org-agenda-mode-map
|
|
|
|
(kbd doom-leader-key) nil))
|
|
|
|
|
|
|
|
|
2018-05-18 01:43:37 +02:00
|
|
|
;;
|
2019-04-10 18:47:21 -04:00
|
|
|
;;; Bootstrap
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! org
|
2019-04-10 18:47:21 -04:00
|
|
|
:defer-incrementally
|
2019-06-28 16:53:26 +02:00
|
|
|
calendar find-func format-spec org-macs org-compat org-faces org-entities
|
|
|
|
org-list org-pcomplete org-src org-footnote org-macro ob org org-agenda
|
|
|
|
org-capture
|
|
|
|
:preface
|
2020-04-25 15:40:24 -04:00
|
|
|
;; Set these to nil now so we can detect user changes to them later (and fall
|
|
|
|
;; back on defaults otherwise)
|
|
|
|
(defvar org-directory nil)
|
|
|
|
(defvar org-attach-id-dir nil)
|
|
|
|
|
2020-04-25 01:27:25 -04:00
|
|
|
(setq org-publish-timestamp-directory (concat doom-cache-dir "org-timestamps/")
|
2020-01-02 00:31:20 -05:00
|
|
|
org-preview-latex-image-directory (concat doom-cache-dir "org-latex/"))
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2020-04-08 15:17:56 -04:00
|
|
|
;; Make most of the default modules opt-in, because I sincerely doubt most
|
|
|
|
;; users use all of them.
|
2019-06-28 16:53:26 +02:00
|
|
|
(defvar org-modules
|
2019-08-15 21:02:43 -04:00
|
|
|
'(;; ol-w3m
|
|
|
|
;; ol-bbdb
|
|
|
|
ol-bibtex
|
|
|
|
;; ol-docview
|
|
|
|
;; ol-gnus
|
|
|
|
;; ol-info
|
|
|
|
;; ol-irc
|
|
|
|
;; ol-mhe
|
|
|
|
;; ol-rmail
|
|
|
|
;; ol-eww
|
2019-06-28 16:53:26 +02:00
|
|
|
))
|
|
|
|
|
2020-04-08 15:17:56 -04:00
|
|
|
;;; Custom org modules
|
2020-05-11 02:53:18 -04:00
|
|
|
(dolist (flag doom--current-flags)
|
2020-05-11 04:53:39 -04:00
|
|
|
(load! (concat "contrib/" (substring (symbol-name flag) 1)) nil t))
|
2019-10-29 00:50:35 -04:00
|
|
|
|
2020-04-08 15:17:56 -04:00
|
|
|
;; Add our general hooks after the submodules, so that any hooks the
|
|
|
|
;; submodules add run after them, and can overwrite any defaults if necessary.
|
2019-04-10 18:47:21 -04:00
|
|
|
(add-hook! 'org-mode-hook
|
2019-10-25 20:00:06 -04:00
|
|
|
;; `show-paren-mode' causes flickering with indent overlays made by
|
2019-07-26 19:57:13 +02:00
|
|
|
;; `org-indent-mode', so we turn off show-paren-mode altogether
|
|
|
|
#'doom-disable-show-paren-mode-h
|
2019-10-25 20:00:06 -04:00
|
|
|
;; disable `show-trailing-whitespace'; shows a lot of false positives
|
2019-07-26 19:57:13 +02:00
|
|
|
#'doom-disable-show-trailing-whitespace-h
|
|
|
|
#'+org-enable-auto-reformat-tables-h
|
|
|
|
#'+org-enable-auto-update-cookies-h
|
2020-05-11 02:50:45 -04:00
|
|
|
#'+org-make-last-point-visible-h)
|
2019-04-10 18:47:21 -04:00
|
|
|
|
2019-06-28 16:53:26 +02:00
|
|
|
(add-hook! 'org-load-hook
|
2020-04-25 15:40:24 -04:00
|
|
|
#'+org-init-org-directory-h
|
2019-07-26 19:57:13 +02:00
|
|
|
#'+org-init-appearance-h
|
|
|
|
#'+org-init-agenda-h
|
2019-12-29 16:31:25 -05:00
|
|
|
#'+org-init-attachments-h
|
2019-07-26 19:57:13 +02:00
|
|
|
#'+org-init-babel-h
|
|
|
|
#'+org-init-babel-lazy-loader-h
|
|
|
|
#'+org-init-capture-defaults-h
|
|
|
|
#'+org-init-capture-frame-h
|
|
|
|
#'+org-init-custom-links-h
|
|
|
|
#'+org-init-export-h
|
2020-05-12 05:15:55 -04:00
|
|
|
#'+org-init-habit-h
|
2019-07-26 19:57:13 +02:00
|
|
|
#'+org-init-hacks-h
|
|
|
|
#'+org-init-keybinds-h
|
|
|
|
#'+org-init-popup-rules-h
|
|
|
|
#'+org-init-protocol-h
|
2020-05-13 22:48:42 -04:00
|
|
|
#'+org-init-protocol-lazy-loader-h
|
|
|
|
#'+org-init-smartparens-h)
|
2019-06-28 16:53:26 +02:00
|
|
|
|
2020-04-08 15:17:56 -04:00
|
|
|
;; (Re)activate eldoc-mode in org-mode a little later, because it disables
|
|
|
|
;; itself if started too soon (which is the case with `global-eldoc-mode').
|
|
|
|
(add-hook 'org-mode-local-vars-hook #'eldoc-mode)
|
2019-10-25 20:00:06 -04:00
|
|
|
|
2019-06-28 16:53:26 +02:00
|
|
|
;; In case the user has eagerly loaded org from their configs
|
2019-08-28 14:15:13 -04:00
|
|
|
(when (and (featurep 'org)
|
2019-09-20 23:10:53 -04:00
|
|
|
(not byte-compile-current-file))
|
2020-05-20 01:07:32 -04:00
|
|
|
(unless doom-reloading-p
|
|
|
|
(message "`org' was already loaded by the time lang/org loaded, this may cause issues"))
|
2019-06-28 16:53:26 +02:00
|
|
|
(run-hooks 'org-load-hook))
|
2019-04-10 18:47:21 -04:00
|
|
|
|
2019-07-08 22:07:52 +02:00
|
|
|
:config
|
2020-03-10 22:15:49 -04:00
|
|
|
(setq org-archive-subtree-save-file-p t) ; save target buffer after archiving
|
|
|
|
|
2020-01-02 00:31:20 -05:00
|
|
|
;; Global ID state means we can have ID links anywhere. This is required for
|
|
|
|
;; `org-brain', however.
|
2020-05-20 01:07:52 -04:00
|
|
|
(setq org-id-locations-file-relative t)
|
2020-01-02 00:31:20 -05:00
|
|
|
|
2020-02-06 22:26:06 -05:00
|
|
|
;; HACK `org-id' doesn't check if `org-id-locations-file' exists or is
|
|
|
|
;; writeable before trying to read/write to it.
|
|
|
|
(defadvice! +org--fail-gracefully-a (&rest _)
|
|
|
|
:before-while '(org-id-locations-save org-id-locations-load)
|
2020-03-01 23:35:59 -05:00
|
|
|
(file-writable-p org-id-locations-file))
|
2020-02-06 22:26:06 -05:00
|
|
|
|
2019-10-25 20:00:06 -04:00
|
|
|
(add-hook 'org-open-at-point-functions #'doom-set-jump-h))
|