2017-02-20 13:18:59 -05:00
|
|
|
;;; lang/org/config.el
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
;; A few things you can expect
|
|
|
|
;; + `org-capture' in a popup frame (can be invoked from outside emacs too)
|
|
|
|
;; + Exported files are put in a centralized location (see
|
|
|
|
;; `org-export-directory')
|
2017-03-16 23:39:35 -04:00
|
|
|
;; + Inline latex previews (requires latex and dvipng programs)
|
2017-04-10 02:53:32 -04:00
|
|
|
;; + Inline code block execution for various languages
|
2017-02-28 12:12:09 -05:00
|
|
|
;; + TODO A simpler attachment system (with auto-deleting support) and
|
|
|
|
;; drag-and-drop for images and documents into org files
|
2017-02-19 19:01:47 -05:00
|
|
|
;; + TODO Custom links for class notes
|
|
|
|
;; + TODO An org-mode based CRM (including invoicing and pdf exporting) (see custom-crm)
|
|
|
|
;; + TODO A tag-based file browser reminiscient of Evernote and Quiver (there's neotree too!)
|
|
|
|
|
|
|
|
(defvar +org-init-hook nil
|
|
|
|
"TODO")
|
|
|
|
|
2017-04-17 02:17:10 -04:00
|
|
|
(add-hook 'org-load-hook #'+org|init)
|
|
|
|
(add-hook 'org-mode-hook #'+org|hook)
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
;; Custom variables
|
2017-02-24 20:00:59 -05:00
|
|
|
(defvar +org-dir (expand-file-name "~/work/org/")
|
2017-02-19 19:01:47 -05:00
|
|
|
"The directory where org files are kept.")
|
|
|
|
(defvaralias 'org-directory '+org-dir)
|
|
|
|
|
|
|
|
(defvar +org-attachment-dir ".attach/"
|
|
|
|
"Where to store attachments (relative to current org file).")
|
|
|
|
|
2017-04-08 01:36:11 -04:00
|
|
|
;; Ensure ELPA org is prioritized above built-in org.
|
2017-03-05 13:32:12 -05:00
|
|
|
(when-let (path (locate-library "org" nil doom--package-load-path))
|
|
|
|
(push (file-name-directory path) load-path))
|
|
|
|
|
2017-04-27 14:23:22 -04:00
|
|
|
(load! +agenda)
|
2017-02-23 00:06:12 -05:00
|
|
|
(load! +attach)
|
|
|
|
(load! +capture)
|
|
|
|
(load! +export)
|
2017-04-05 14:29:25 -04:00
|
|
|
(load! +notebook)
|
2017-04-11 08:28:02 -04:00
|
|
|
(load! +babel)
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;; Config
|
|
|
|
;;
|
|
|
|
|
|
|
|
(defun +org|hook ()
|
|
|
|
"Run everytime `org-mode' is enabled."
|
2017-04-27 15:43:38 -04:00
|
|
|
(setq line-spacing 1)
|
|
|
|
|
2017-05-15 13:52:22 +02:00
|
|
|
;; show-paren-mode causes problems for org-indent-mode
|
2017-05-15 21:24:31 -04:00
|
|
|
(make-local-variable 'show-paren-mode)
|
|
|
|
(setq show-paren-mode nil)
|
2017-05-15 13:52:22 +02:00
|
|
|
|
2017-04-27 15:43:38 -04:00
|
|
|
(visual-line-mode +1)
|
2017-04-27 14:24:32 -04:00
|
|
|
(when (and (featurep 'evil) evil-mode)
|
2017-04-21 15:57:14 -04:00
|
|
|
(evil-org-mode +1))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-04-27 14:24:20 -04:00
|
|
|
(unless org-agenda-inhibit-startup
|
|
|
|
;; My version of the 'overview' #+STARTUP option: expand first-level
|
|
|
|
;; headings.
|
|
|
|
(when (eq org-startup-folded t)
|
|
|
|
(outline-hide-sublevels 2))
|
|
|
|
|
|
|
|
;; If saveplace places the point in a folded position, unfold it on load
|
|
|
|
(when (outline-invisible-p)
|
|
|
|
(ignore-errors
|
|
|
|
(save-excursion
|
|
|
|
(outline-previous-visible-heading 1)
|
|
|
|
(org-show-subtree)))))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-04-11 08:28:40 -04:00
|
|
|
(defun +org|realign-table-maybe ()
|
2017-04-27 14:24:32 -04:00
|
|
|
"Auto-align table under cursor."
|
2017-04-11 08:28:40 -04:00
|
|
|
(when (org-at-table-p)
|
2017-05-19 13:10:14 +02:00
|
|
|
(save-excursion
|
|
|
|
(org-table-align))))
|
2017-04-17 02:17:10 -04:00
|
|
|
(add-hook 'evil-insert-state-exit-hook #'+org|realign-table-maybe nil t)
|
2017-04-11 08:28:40 -04:00
|
|
|
|
2017-02-20 00:44:59 -05:00
|
|
|
(defun +org|update-cookies ()
|
2017-04-27 14:24:32 -04:00
|
|
|
"Update counts in headlines (aka \"cookies\")."
|
2017-02-24 20:00:59 -05:00
|
|
|
(when (and buffer-file-name (file-exists-p buffer-file-name))
|
2017-02-19 19:01:47 -05:00
|
|
|
(org-update-statistics-cookies t)))
|
|
|
|
|
2017-04-17 02:17:10 -04:00
|
|
|
(add-hook 'before-save-hook #'+org|update-cookies nil t)
|
|
|
|
(add-hook 'evil-insert-state-exit-hook #'+org|update-cookies nil t))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
|
|
|
|
(defun +org|init ()
|
|
|
|
"Initializes org core."
|
|
|
|
(define-minor-mode evil-org-mode
|
|
|
|
"Evil-mode bindings for org-mode."
|
|
|
|
:init-value nil
|
|
|
|
:lighter " !"
|
|
|
|
:keymap (make-sparse-keymap)
|
|
|
|
:group 'evil-org)
|
|
|
|
|
2017-04-21 15:56:19 -04:00
|
|
|
(define-minor-mode +org-pretty-mode
|
2017-04-27 14:24:32 -04:00
|
|
|
"TODO"
|
2017-04-21 15:56:19 -04:00
|
|
|
:init-value nil
|
|
|
|
:lighter " *"
|
|
|
|
:group 'evil-org
|
|
|
|
(setq org-hide-emphasis-markers +org-pretty-mode)
|
2017-04-27 14:24:32 -04:00
|
|
|
(org-toggle-pretty-entities)
|
|
|
|
;; In case the above un-align tables
|
|
|
|
(org-table-map-tables 'org-table-align t))
|
2017-04-21 15:56:19 -04:00
|
|
|
|
2017-02-19 19:01:47 -05:00
|
|
|
(setq-default
|
|
|
|
org-export-coding-system 'utf-8
|
2017-05-04 10:42:30 +02:00
|
|
|
org-todo-keywords
|
|
|
|
'((sequence "[ ](t)" "[-](p)" "[?](m)" "|" "[X](d)")
|
|
|
|
(sequence "TODO(T)" "|" "DONE(D)")
|
|
|
|
(sequence "IDEA(i)" "NEXT(n)" "ACTIVE(a)" "WAITING(w)" "LATER(l)"
|
|
|
|
"|" "CANCELLED(c)"))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
;; Appearance
|
|
|
|
outline-blank-line t
|
|
|
|
org-indent-mode-turns-on-hiding-stars t
|
|
|
|
org-adapt-indentation nil
|
|
|
|
org-cycle-separator-lines 1
|
|
|
|
org-cycle-include-plain-lists t
|
2017-05-10 05:28:50 +02:00
|
|
|
;; org-ellipsis " "
|
2017-04-27 15:43:38 -04:00
|
|
|
org-entities-user '(("flat" "\\flat" nil "" "" "266D" "♭")
|
2017-02-19 19:01:47 -05:00
|
|
|
("sharp" "\\sharp" nil "" "" "266F" "♯"))
|
|
|
|
org-fontify-done-headline t
|
|
|
|
org-fontify-quote-and-verse-blocks t
|
|
|
|
org-fontify-whole-heading-line t
|
|
|
|
org-footnote-auto-label 'plain
|
2017-04-21 15:56:19 -04:00
|
|
|
org-hide-emphasis-markers nil
|
2017-02-19 19:01:47 -05:00
|
|
|
org-hide-leading-stars t
|
2017-04-11 08:28:40 -04:00
|
|
|
org-hide-leading-stars-before-indent-mode t
|
2017-04-27 15:43:38 -04:00
|
|
|
org-hidden-keywords nil
|
2017-02-19 19:01:47 -05:00
|
|
|
org-image-actual-width nil
|
|
|
|
org-indent-indentation-per-level 2
|
2017-04-21 15:56:19 -04:00
|
|
|
org-pretty-entities nil
|
2017-02-19 19:01:47 -05:00
|
|
|
org-pretty-entities-include-sub-superscripts t
|
|
|
|
org-startup-folded t
|
|
|
|
org-startup-indented t
|
|
|
|
org-startup-with-inline-images nil
|
|
|
|
org-tags-column 0
|
|
|
|
org-use-sub-superscripts '{}
|
|
|
|
|
|
|
|
;; Behavior
|
2017-04-27 15:43:38 -04:00
|
|
|
org-blank-before-new-entry '((heading . nil) (plain-list-item . auto))
|
2017-02-19 19:01:47 -05:00
|
|
|
org-catch-invisible-edits 'show
|
|
|
|
org-checkbox-hierarchical-statistics nil
|
2017-04-27 15:07:24 -04:00
|
|
|
org-enforce-todo-checkbox-dependencies nil
|
2017-02-19 19:01:47 -05:00
|
|
|
org-confirm-elisp-link-function nil
|
|
|
|
org-default-priority ?C
|
|
|
|
org-hierarchical-todo-statistics t
|
|
|
|
org-loop-over-headlines-in-active-region t
|
|
|
|
org-refile-use-outline-path t
|
|
|
|
org-special-ctrl-a/e t
|
|
|
|
|
|
|
|
;; Sorting/refiling
|
|
|
|
org-archive-location (concat +org-dir "/archived/%s::")
|
|
|
|
org-refile-targets '((nil . (:maxlevel . 2))) ; display full path in refile completion
|
|
|
|
|
|
|
|
;; Latex
|
|
|
|
org-highlight-latex-and-related '(latex)
|
|
|
|
org-latex-create-formula-image-program 'dvipng
|
|
|
|
org-latex-image-default-width ".9\\linewidth"
|
|
|
|
org-latex-preview-ltxpng-directory (concat doom-cache-dir "/ltxpng/")
|
|
|
|
org-latex-remove-logfiles nil
|
|
|
|
org-startup-with-latex-preview nil
|
|
|
|
;; org-latex-packages-alist
|
|
|
|
;; '(("" "gauss" t)
|
|
|
|
;; ("" "physics" t) TODO Install this)
|
|
|
|
)
|
|
|
|
|
2017-04-27 14:24:32 -04:00
|
|
|
;; LaTeX previews are too small and usually render to light backgrounds, so
|
|
|
|
;; this enlargens them and ensures their background (and foreground) match the
|
|
|
|
;; current theme.
|
|
|
|
(setq-default
|
|
|
|
org-format-latex-options
|
|
|
|
(plist-put org-format-latex-options :scale 1.5)
|
|
|
|
org-format-latex-options
|
|
|
|
(plist-put org-format-latex-options
|
|
|
|
:background (face-attribute (or (cadr (assq 'default face-remapping-alist))
|
|
|
|
'default)
|
|
|
|
:background nil t)))
|
|
|
|
|
2017-04-27 15:43:38 -04:00
|
|
|
;; Use ivy/helm if either is available
|
|
|
|
(when (or (featurep! :completion ivy)
|
|
|
|
(featurep! :completion helm))
|
|
|
|
(setq-default org-completion-use-ido nil
|
|
|
|
org-outline-path-complete-in-steps nil))
|
|
|
|
|
2017-02-19 19:01:47 -05:00
|
|
|
(let ((ext-regexp (regexp-opt '("GIF" "JPG" "JPEG" "SVG" "TIF" "TIFF" "BMP" "XPM"
|
|
|
|
"gif" "jpg" "jpeg" "svg" "tif" "tiff" "bmp" "xpm"))))
|
|
|
|
(setq iimage-mode-image-regex-alist
|
|
|
|
`((,(concat "\\(`?file://\\|\\[\\[\\|<\\|`\\)?\\([-+./_0-9a-zA-Z]+\\."
|
|
|
|
ext-regexp "\\)\\(\\]\\]\\|>\\|'\\)?") . 2)
|
|
|
|
(,(concat "<\\(http://.+\\." ext-regexp "\\)>") . 1))))
|
|
|
|
|
2017-05-19 13:21:39 +02:00
|
|
|
|
|
|
|
|
2017-04-27 15:07:47 -04:00
|
|
|
;;; Custom fontification
|
2017-05-19 13:21:39 +02:00
|
|
|
(defun +org--tag-face (n)
|
|
|
|
(let ((kwd (match-string n)))
|
|
|
|
(or (and (equal kwd "#") 'org-tag)
|
|
|
|
(and (equal kwd "@") 'org-special-keyword))))
|
|
|
|
|
|
|
|
(defun +org|adjust-faces ()
|
|
|
|
"Correct (and improve) org-mode's font-lock keywords.
|
|
|
|
|
|
|
|
1. Re-set `org-todo' & `org-headline-done' faces, to make them respect
|
|
|
|
underlying faces.
|
|
|
|
2. Fontify item bullets
|
|
|
|
3. Fontify item checkboxes (and when they're marked done)"
|
|
|
|
(let ((org-todo (format org-heading-keyword-regexp-format
|
|
|
|
org-todo-regexp))
|
|
|
|
(org-done (format org-heading-keyword-regexp-format
|
|
|
|
(concat "\\(?:" (mapconcat #'regexp-quote org-done-keywords "\\|") "\\)"))))
|
|
|
|
(setq
|
|
|
|
org-font-lock-extra-keywords
|
|
|
|
(append (org-delete-all
|
|
|
|
`(("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]"
|
|
|
|
(0 (org-get-checkbox-statistics-face) t))
|
|
|
|
(,org-todo (2 (org-get-todo-face 2) t))
|
|
|
|
(,org-done (2 'org-headline-done t)))
|
|
|
|
org-font-lock-extra-keywords)
|
|
|
|
`((,org-todo (2 (org-get-todo-face 2) prepend))
|
|
|
|
(,org-done (2 'org-headline-done prepend))
|
|
|
|
;; Make checkbox statistic cookies respect underlying faces
|
|
|
|
("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]"
|
|
|
|
(0 (org-get-checkbox-statistics-face) prepend))
|
|
|
|
;; I like how org-mode fontifies checked TODOs and want this to extend to
|
|
|
|
;; checked checkbox items:
|
|
|
|
("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)"
|
|
|
|
1 'org-headline-done prepend)
|
|
|
|
;; make plain list bullets stand out
|
|
|
|
("^ *\\([-+]\\|[0-9]+[).]\\) " 1 'org-list-dt append)
|
|
|
|
;; and separators/dividers
|
|
|
|
("^ *\\(-----+\\)$" 1 'org-meta-line)
|
|
|
|
;; custom #hashtags & @at-tags for another level of organization
|
|
|
|
;; TODO refactor this into a single rule
|
|
|
|
("\\s-\\(\\([#@]\\)[^ \n]+\\)" 1 (+org--tag-face 2)))))))
|
|
|
|
(add-hook 'org-font-lock-set-keywords-hook #'+org|adjust-faces)
|
|
|
|
|
|
|
|
;; enable gpg support
|
2017-02-19 19:01:47 -05:00
|
|
|
(require 'org-crypt)
|
|
|
|
(org-crypt-use-before-save-magic)
|
|
|
|
(setq org-tags-exclude-from-inheritance '("crypt")
|
|
|
|
org-crypt-key user-mail-address
|
|
|
|
epa-file-encrypt-to user-mail-address)
|
|
|
|
|
|
|
|
;; smartparens config
|
|
|
|
(sp-with-modes '(org-mode)
|
|
|
|
(sp-local-pair "\\[" "\\]" :post-handlers '(("| " "SPC")))
|
|
|
|
(sp-local-pair "\\(" "\\)" :post-handlers '(("| " "SPC")))
|
|
|
|
(sp-local-pair "$$" "$$" :post-handlers '((:add " | ")) :unless '(sp-point-at-bol-p))
|
|
|
|
(sp-local-pair "{" nil))
|
|
|
|
|
2017-04-27 14:24:32 -04:00
|
|
|
;; The standard unicode characters are usually misaligned depending on the
|
2017-05-14 00:25:04 +02:00
|
|
|
;; font. This bugs me. Personally, markdown #-marks for headlines are more
|
|
|
|
;; elegant, so we use those.
|
2017-04-27 14:24:32 -04:00
|
|
|
(def-package! org-bullets
|
|
|
|
:commands org-bullets-mode
|
2017-05-14 00:25:04 +02:00
|
|
|
:init (add-hook 'org-mode-hook #'org-bullets-mode)
|
2017-04-27 14:24:32 -04:00
|
|
|
:config (setq org-bullets-bullet-list '("#")))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
;; Keybinds
|
2017-02-23 00:06:12 -05:00
|
|
|
(map! (:map org-mode-map
|
2017-05-14 00:25:04 +02:00
|
|
|
"RET" #'org-return-indent
|
2017-02-19 19:01:47 -05:00
|
|
|
"C-j" nil
|
2017-05-14 00:25:04 +02:00
|
|
|
"C-k" nil)
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
(:map evil-org-mode-map
|
2017-05-25 20:11:24 +02:00
|
|
|
:n "RET" #'+org/dwim-at-point
|
2017-02-19 19:01:47 -05:00
|
|
|
;;
|
2017-05-25 20:11:24 +02:00
|
|
|
:ni "A-L" #'org-shiftmetaright
|
|
|
|
:ni "A-H" #'org-shiftmetaleft
|
|
|
|
:ni "A-K" #'org-shiftmetaup
|
|
|
|
:ni "A-J" #'org-shiftmetadown
|
2017-02-19 19:01:47 -05:00
|
|
|
;; Expand tables (or shiftmeta move)
|
2017-04-17 02:17:10 -04:00
|
|
|
:ni "C-S-l" #'+org/table-append-field-or-shift-right
|
|
|
|
:ni "C-S-h" #'+org/table-prepend-field-or-shift-left
|
|
|
|
:ni "C-S-k" #'+org/table-prepend-row-or-shift-up
|
|
|
|
:ni "C-S-j" #'+org/table-append-row-or-shift-down
|
2017-02-19 19:01:47 -05:00
|
|
|
;; Navigate table cells
|
2017-05-25 20:11:24 +02:00
|
|
|
:i "C-L" #'+org/table-next-field
|
|
|
|
:i "C-H" #'+org/table-previous-field
|
|
|
|
:i "C-K" #'+org/table-previous-row
|
|
|
|
:i "C-J" #'+org/table-next-row
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-05-25 20:11:24 +02:00
|
|
|
:i "C-e" #'org-end-of-line
|
|
|
|
:i "C-a" #'org-beginning-of-line
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-05-25 20:11:24 +02:00
|
|
|
:i [tab] #'+org/indent-or-next-field-or-yas-expand
|
|
|
|
:i [backtab] #'+org/dedent-or-prev-field
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-05-19 13:07:59 +02:00
|
|
|
:n [tab] #'+org/toggle-fold
|
|
|
|
:v [backtab] #'+snippets/expand-on-region
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-04-17 02:17:10 -04:00
|
|
|
:nv "j" #'evil-next-visual-line
|
|
|
|
:nv "k" #'evil-previous-visual-line
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
:i "M-a" (λ! (evil-visual-state) (org-mark-element))
|
2017-04-17 02:17:10 -04:00
|
|
|
:n "M-a" #'org-mark-element
|
|
|
|
:v "M-a" #'mark-whole-buffer
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-05-19 14:01:38 +02:00
|
|
|
:ni [M-return] (λ! (+org/insert-item 'below))
|
|
|
|
:ni [S-M-return] (λ! (+org/insert-item 'above))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
(:localleader
|
2017-04-17 02:17:10 -04:00
|
|
|
:n "RET" #'org-archive-subtree
|
|
|
|
:n "SPC" #'+org/toggle-checkbox
|
2017-05-19 14:01:38 +02:00
|
|
|
:n "/" #'org-sparse-tree
|
|
|
|
:n "=" #'org-align-all-tags
|
|
|
|
:n "?" #'org-tags-view
|
|
|
|
:n "a" #'org-agenda
|
|
|
|
:n "d" #'org-time-stamp
|
|
|
|
:n "D" #'org-deadline
|
|
|
|
:n "e" #'org-edit-special
|
|
|
|
:n "E" #'+org/edit-special-same-window
|
|
|
|
:n "n" (λ! (if (buffer-narrowed-p) (widen) (org-narrow-to-subtree)))
|
|
|
|
:n "r" #'org-refile
|
|
|
|
:n "R" (λ! (org-metaleft) (org-archive-to-archive-sibling)) ; archive to parent sibling
|
|
|
|
:n "s" #'org-schedule
|
|
|
|
:n "t" (λ! (org-todo (if (org-entry-is-todo-p) 'none 'todo)))
|
|
|
|
:v "t" (λ! (evil-ex-normal evil-visual-beginning evil-visual-end "\\t"))
|
|
|
|
:n "T" #'org-todo
|
|
|
|
:n "v" #'variable-pitch-mode
|
|
|
|
:nv "l" #'org-insert-link
|
|
|
|
:nv "L" #'org-store-link
|
|
|
|
;:n "w" #'writing-mode
|
|
|
|
;:n "x" #'+org/remove-link
|
2017-02-20 00:49:25 -05:00
|
|
|
)
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
;; TODO Improve folding bindings
|
2017-04-17 02:17:10 -04:00
|
|
|
:n "za" #'+org/toggle-fold
|
|
|
|
:n "zA" #'org-shifttab
|
|
|
|
:n "zc" #'outline-hide-subtree
|
2017-02-23 00:06:12 -05:00
|
|
|
:n "zC" (λ! (outline-hide-sublevels 1))
|
2017-02-19 19:01:47 -05:00
|
|
|
:n "zd" (lambda (&optional arg) (interactive "p") (outline-hide-sublevels (or arg 3)))
|
2017-02-23 00:06:12 -05:00
|
|
|
:n "zm" (λ! (outline-hide-sublevels 1))
|
2017-04-17 02:17:10 -04:00
|
|
|
:n "zo" #'outline-show-subtree
|
|
|
|
:n "zO" #'outline-show-all
|
|
|
|
:n "zr" #'outline-show-all
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-05-25 20:11:24 +02:00
|
|
|
:m "]]" (λ! (org-forward-heading-same-level nil) (org-beginning-of-line))
|
|
|
|
:m "[[" (λ! (org-backward-heading-same-level nil) (org-beginning-of-line))
|
2017-04-17 02:17:10 -04:00
|
|
|
:m "]l" #'org-next-link
|
|
|
|
:m "[l" #'org-previous-link
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-04-17 02:17:10 -04:00
|
|
|
:m "gh" #'outline-up-heading
|
|
|
|
:m "gj" #'org-forward-heading-same-level
|
|
|
|
:m "gk" #'org-backward-heading-same-level
|
|
|
|
:m "gl" (λ! (call-interactively #'outline-next-visible-heading) (show-children))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-04-17 02:17:10 -04:00
|
|
|
:n "go" #'org-open-at-point
|
2017-02-23 00:06:12 -05:00
|
|
|
:n "gO" (λ! (let ((org-link-frame-setup (append '((file . find-file-other-window)) org-link-frame-setup))
|
2017-02-19 19:01:47 -05:00
|
|
|
(org-file-apps '(("\\.org$" . emacs)
|
|
|
|
(t . "open \"%s\""))))
|
2017-04-17 02:17:10 -04:00
|
|
|
(call-interactively #'org-open-at-point)))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-04-17 02:17:10 -04:00
|
|
|
:n "gQ" #'org-fill-paragraph
|
|
|
|
:m "$" #'org-end-of-line
|
|
|
|
:m "^" #'org-beginning-of-line
|
|
|
|
:n "<" #'org-metaleft
|
|
|
|
:n ">" #'org-metaright
|
2017-02-23 00:06:12 -05:00
|
|
|
:v "<" (λ! (org-metaleft) (evil-visual-restore))
|
|
|
|
:v ">" (λ! (org-metaright) (evil-visual-restore))
|
2017-04-17 02:17:10 -04:00
|
|
|
:n "-" #'org-cycle-list-bullet
|
2017-04-27 14:23:22 -04:00
|
|
|
:m "<tab>" #'org-cycle))
|
2017-02-19 19:01:47 -05:00
|
|
|
|
|
|
|
;; Initialize everything else
|
|
|
|
(run-hooks '+org-init-hook)
|
|
|
|
(+org|hacks))
|
|
|
|
|
|
|
|
|
|
|
|
(defun +org|hacks ()
|
|
|
|
"Getting org to behave."
|
|
|
|
;; Don't open separate windows
|
|
|
|
(push '(file . find-file) org-link-frame-setup)
|
|
|
|
|
|
|
|
;; Let OS decide what to do with files when opened
|
|
|
|
(setq org-file-apps
|
|
|
|
`(("\\.org$" . emacs)
|
|
|
|
(t . ,(cond (IS-MAC "open -R \"%s\"")
|
|
|
|
(IS-LINUX "xdg-open \"%s\"")))))
|
|
|
|
|
|
|
|
;; Remove highlights on ESC
|
2017-05-07 19:12:48 +02:00
|
|
|
(defun +org|remove-occur-highlights (&rest args)
|
2017-05-19 03:29:00 +02:00
|
|
|
(when (derived-mode-p 'org-mode)
|
2017-05-25 12:22:05 +02:00
|
|
|
(org-remove-occur-highlights)
|
|
|
|
t))
|
2017-05-07 19:12:48 +02:00
|
|
|
(add-hook '+evil-esc-hook #'+org|remove-occur-highlights)
|
2017-02-19 19:01:47 -05:00
|
|
|
|
2017-05-04 08:57:51 +02:00
|
|
|
(after! org-bullets
|
|
|
|
(define-minor-mode org-bullets-mode
|
|
|
|
"Modified version of `org-bullets-mode' that respects the `org-hide' face."
|
|
|
|
nil nil nil
|
|
|
|
(let* ((keyword
|
|
|
|
`((,org-outline-regexp-bol
|
|
|
|
(0 (let ((level (- (match-end 0) (match-beginning 0) 1)))
|
|
|
|
(compose-region (- (match-end 0) 2)
|
|
|
|
(- (match-end 0) 1)
|
|
|
|
(org-bullets-level-char level))
|
|
|
|
(when (facep org-bullets-face-name)
|
|
|
|
(put-text-property (- (match-end 0) 2)
|
|
|
|
(- (match-end 0) 1)
|
|
|
|
'face org-bullets-face-name))
|
|
|
|
(put-text-property (match-beginning 0) (match-end 0)
|
|
|
|
'keymap org-bullets-bullet-map)
|
|
|
|
nil))))))
|
|
|
|
(if org-bullets-mode
|
|
|
|
(progn (font-lock-add-keywords nil keyword)
|
|
|
|
(font-lock-fontify-buffer))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(font-lock-remove-keywords nil keyword)
|
|
|
|
(while (re-search-forward org-outline-regexp-bol nil t)
|
|
|
|
(decompose-region (match-beginning 0) (match-end 0)))
|
|
|
|
(font-lock-fontify-buffer)))))))
|
2017-02-19 19:01:47 -05:00
|
|
|
|