mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-20 16:11:07 -05:00
Move lang/org => org/*
Since lang/org has grown (and is expected to grow much, much more), it has been given its own module category. Concerns #129, #138
This commit is contained in:
248
modules/org/org/autoload/org.el
Normal file
248
modules/org/org/autoload/org.el
Normal file
@@ -0,0 +1,248 @@
|
||||
;;; org/org/autoload/org.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode +org-pretty-mode
|
||||
"TODO"
|
||||
:init-value nil
|
||||
:lighter " *"
|
||||
:group 'evil-org
|
||||
(setq org-hide-emphasis-markers +org-pretty-mode)
|
||||
(org-toggle-pretty-entities)
|
||||
;; In case the above un-align tables
|
||||
(org-table-map-tables 'org-table-align t))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org|realign-table-maybe ()
|
||||
"Auto-align table under cursor."
|
||||
(when (org-at-table-p)
|
||||
(save-excursion
|
||||
(org-table-align))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org|update-cookies ()
|
||||
"Update counts in headlines (aka \"cookies\")."
|
||||
(when (and buffer-file-name (file-exists-p buffer-file-name))
|
||||
(org-update-statistics-cookies t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/dwim-at-point ()
|
||||
"Do-what-I-mean at point. This includes following timestamp links, aligning
|
||||
tables, toggling checkboxes/todos, executing babel blocks, previewing latex
|
||||
fragments, opening links, or refreshing images."
|
||||
(interactive)
|
||||
(let* ((scroll-pt (window-start))
|
||||
(context (org-element-context))
|
||||
(type (org-element-type context)))
|
||||
(cond
|
||||
((memq type '(planning timestamp))
|
||||
(org-follow-timestamp-link))
|
||||
|
||||
((memq type '(table table-row))
|
||||
(if (org-element-property :tblfm (org-element-property :parent context))
|
||||
(org-table-recalculate t)
|
||||
(org-table-align)))
|
||||
|
||||
((org-element-property :checkbox (org-element-lineage context '(item) t))
|
||||
(let ((match (and (org-at-item-checkbox-p) (match-string 1))))
|
||||
(org-toggle-checkbox (if (equal match "[ ]") '(16)))))
|
||||
|
||||
((and (eq type 'headline)
|
||||
(org-element-property :todo-type context))
|
||||
(org-todo
|
||||
(if (eq (org-element-property :todo-type context) 'done) 'todo 'done)))
|
||||
|
||||
((and (eq type 'headline)
|
||||
(string= "ARCHIVE" (car-safe (org-get-tags))))
|
||||
(org-force-cycle-archived))
|
||||
|
||||
((eq type 'headline)
|
||||
(org-remove-latex-fragment-image-overlays)
|
||||
(org-toggle-latex-fragment '(4)))
|
||||
|
||||
((eq type 'babel-call)
|
||||
(org-babel-lob-execute-maybe))
|
||||
|
||||
((memq type '(src-block inline-src-block))
|
||||
(org-babel-execute-src-block))
|
||||
|
||||
((memq type '(latex-fragment latex-environment))
|
||||
(org-toggle-latex-fragment))
|
||||
|
||||
((eq type 'link)
|
||||
(let ((path (org-element-property :path (org-element-lineage context '(link) t))))
|
||||
(if (and path (image-type-from-file-name path))
|
||||
(+org/refresh-inline-images)
|
||||
(org-open-at-point))))
|
||||
|
||||
(t (+org/refresh-inline-images)))
|
||||
(set-window-start nil scroll-pt)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/indent ()
|
||||
"Indent the current item (header or item). Otherwise, forward to
|
||||
`self-insert-command'."
|
||||
(interactive)
|
||||
(cond ((org-at-item-p)
|
||||
(org-indent-item-tree))
|
||||
((org-at-heading-p)
|
||||
(ignore-errors (org-demote)))
|
||||
((org-in-src-block-p t)
|
||||
(doom/dumb-indent))
|
||||
(t
|
||||
(call-interactively #'self-insert-command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/indent-or-next-field-or-yas-expand ()
|
||||
"Depending on the context either a) indent the current line, b) go the next
|
||||
table field or c) run `yas-expand'."
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(cond ((and (bound-and-true-p yas-minor-mode)
|
||||
(yas--templates-for-key-at-point))
|
||||
#'yas-expand)
|
||||
((org-at-table-p)
|
||||
#'org-table-next-field)
|
||||
(t
|
||||
#'+org/indent))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/dedent ()
|
||||
"Dedent the current item (header or item). Otherwise, forward to
|
||||
`self-insert-command'."
|
||||
(interactive)
|
||||
(cond ((org-at-item-p)
|
||||
(org-list-indent-item-generic
|
||||
-1 nil
|
||||
(save-excursion
|
||||
(when (org-region-active-p)
|
||||
(goto-char (region-beginning)))
|
||||
(org-list-struct))))
|
||||
((org-at-heading-p)
|
||||
(ignore-errors (org-promote)))
|
||||
(t
|
||||
(call-interactively #'self-insert-command))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/dedent-or-prev-field ()
|
||||
"Depending on the context either dedent the current item or go the previous
|
||||
table field."
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(if (org-at-table-p)
|
||||
#'org-table-previous-field
|
||||
#'+org/dedent)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/insert-item (direction)
|
||||
"Inserts a new heading, table cell or item, depending on the context.
|
||||
DIRECTION can be 'above or 'below.
|
||||
|
||||
I use this instead of `org-insert-item' or `org-insert-heading' which are too
|
||||
opinionated and perform this simple task incorrectly (e.g. whitespace in the
|
||||
wrong places)."
|
||||
(interactive)
|
||||
(let* ((context (org-element-lineage
|
||||
(org-element-context)
|
||||
'(table table-row headline inlinetask item plain-list)
|
||||
t))
|
||||
(type (org-element-type context)))
|
||||
(cond ((eq type 'item)
|
||||
(let ((marker (org-element-property :bullet context))
|
||||
(pad (save-excursion
|
||||
(back-to-indentation)
|
||||
(- (point) (line-beginning-position)))))
|
||||
(pcase direction
|
||||
('below
|
||||
(goto-char (line-end-position))
|
||||
(insert (concat "\n" (make-string pad ? ) marker)))
|
||||
('above
|
||||
(goto-char (line-beginning-position))
|
||||
(insert (make-string pad ? ) marker)
|
||||
(save-excursion (insert "\n")))))
|
||||
(when (org-element-property :checkbox context)
|
||||
(insert "[ ] ")))
|
||||
|
||||
((memq type '(table table-row))
|
||||
(pcase direction
|
||||
('below (org-table-insert-row t))
|
||||
('above (+org/table-prepend-row-or-shift-up))))
|
||||
|
||||
((memq type '(headline inlinetask plain-list))
|
||||
(let* ((subcontext (org-element-context))
|
||||
(level (save-excursion
|
||||
(org-back-to-heading)
|
||||
(org-element-property
|
||||
:level
|
||||
(if (eq (org-element-type subcontext) 'headline)
|
||||
subcontext
|
||||
1)))))
|
||||
(pcase direction
|
||||
('below
|
||||
(let ((at-eol (= (point) (1- (line-end-position)))))
|
||||
(goto-char (line-end-position))
|
||||
(org-end-of-subtree)
|
||||
(insert (concat "\n"
|
||||
(when (= level 1)
|
||||
(if at-eol
|
||||
(ignore (cl-incf level))
|
||||
"\n"))
|
||||
(make-string level ?*)
|
||||
" "))))
|
||||
('above
|
||||
(org-back-to-heading)
|
||||
(org-insert-heading)
|
||||
(when (= level 1)
|
||||
(save-excursion (evil-open-above 1))
|
||||
(save-excursion (insert "\n")))))
|
||||
(when (org-element-property :todo-type context)
|
||||
(org-todo 'todo))))
|
||||
|
||||
(t (user-error "Not a valid list, heading or table")))
|
||||
|
||||
(when (bound-and-true-p evil-mode)
|
||||
(evil-append-line 1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org-get-property (name &optional _file) ; TODO Add FILE
|
||||
"Get a propery from an org file."
|
||||
(save-excursion
|
||||
(goto-char 1)
|
||||
(re-search-forward (format "^#\\+%s:[ \t]*\\([^\n]+\\)" (upcase name)) nil t)
|
||||
(buffer-substring-no-properties (match-beginning 1) (match-end 1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/refresh-inline-images ()
|
||||
"Refresh image previews in the current heading/tree."
|
||||
(interactive)
|
||||
(if (> (length org-inline-image-overlays) 0)
|
||||
(org-remove-inline-images)
|
||||
(org-display-inline-images
|
||||
t t
|
||||
(if (org-before-first-heading-p)
|
||||
(line-beginning-position)
|
||||
(save-excursion (org-back-to-heading) (point)))
|
||||
(if (org-before-first-heading-p)
|
||||
(line-end-position)
|
||||
(save-excursion (org-end-of-subtree) (point))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/toggle-checkbox ()
|
||||
"Toggle the presence of a checkbox in the current item."
|
||||
(interactive)
|
||||
(org-toggle-checkbox '(4)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/toggle-fold ()
|
||||
"Toggle the local fold at the point (as opposed to cycling through all levels
|
||||
with `org-cycle'). Also removes babel result blocks, if run from a code block."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(org-beginning-of-line)
|
||||
(cond ((org-in-src-block-p)
|
||||
(org-babel-remove-result))
|
||||
((org-at-heading-p)
|
||||
(outline-toggle-children))
|
||||
((org-at-item-p)
|
||||
(let ((window-beg (window-start)))
|
||||
(org-cycle)
|
||||
(set-window-start nil window-beg))))))
|
66
modules/org/org/autoload/tables.el
Normal file
66
modules/org/org/autoload/tables.el
Normal file
@@ -0,0 +1,66 @@
|
||||
;;; org/org/autoload/tables.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-next-row ()
|
||||
"Go to the next row (same column) in the current table."
|
||||
(interactive)
|
||||
(if (org-at-table-p)
|
||||
(org-table-next-row)
|
||||
(org-down-element)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-previous-row ()
|
||||
"Go to the previous row (same column) in the current table. Before doing so,
|
||||
re-align the table if necessary. (Necessary because org-mode has a
|
||||
`org-table-next-row', but not `org-table-previous-row')"
|
||||
(interactive)
|
||||
(if (org-at-table-p)
|
||||
(progn
|
||||
(org-table-maybe-eval-formula)
|
||||
(org-table-maybe-recalculate-line)
|
||||
(if (and org-table-automatic-realign
|
||||
org-table-may-need-update)
|
||||
(org-table-align))
|
||||
(let ((col (org-table-current-column)))
|
||||
(beginning-of-line 0)
|
||||
(when (or (not (org-at-table-p)) (org-at-table-hline-p))
|
||||
(beginning-of-line))
|
||||
(org-table-goto-column col)
|
||||
(skip-chars-backward "^|\n\r")
|
||||
(when (org-looking-at-p " ") (forward-char))))
|
||||
(org-up-element)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-next-field ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-next-field) (org-end-of-line)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-previous-field ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-table-previous-field) (org-beginning-of-line)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-append-field-or-shift-right ()
|
||||
(interactive)
|
||||
(org-shiftmetaright)
|
||||
(when (org-at-table-p) (org-metaright)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-prepend-field-or-shift-left ()
|
||||
(interactive)
|
||||
(if (org-at-table-p) (org-shiftmetaright) (org-shiftmetaleft)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-append-row-or-shift-down ()
|
||||
(interactive)
|
||||
(org-shiftmetadown)
|
||||
(when (org-at-table-p) (org-metadown)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/table-prepend-row-or-shift-up ()
|
||||
(interactive)
|
||||
(if (org-at-table-p)
|
||||
(org-shiftmetadown)
|
||||
(org-shiftmetaup)))
|
||||
|
259
modules/org/org/config.el
Normal file
259
modules/org/org/config.el
Normal file
@@ -0,0 +1,259 @@
|
||||
;;; org/org/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Ensure ELPA org is prioritized above built-in org.
|
||||
(when-let (path (locate-library "org" nil doom--package-load-path))
|
||||
(cl-pushnew (file-name-directory path) load-path :test #'equal))
|
||||
|
||||
;; Custom variables
|
||||
(defvar +org-dir (expand-file-name "~/work/org/")
|
||||
"The directory where org files are kept.")
|
||||
(defvaralias 'org-directory '+org-dir)
|
||||
|
||||
(add-hook 'org-load-hook #'+org|init)
|
||||
(add-hook 'org-mode-hook #'+org|hook)
|
||||
|
||||
|
||||
;;
|
||||
;; Plugins
|
||||
;;
|
||||
|
||||
(def-package! toc-org
|
||||
:commands toc-org-enable
|
||||
:init (add-hook 'org-mode-hook #'toc-org-enable))
|
||||
|
||||
(def-package! org-crypt ; built-in
|
||||
:commands org-crypt-use-before-save-magic
|
||||
:init (add-hook 'org-load-hook #'org-crypt-use-before-save-magic)
|
||||
:config
|
||||
(setq org-tags-exclude-from-inheritance '("crypt")
|
||||
org-crypt-key user-mail-address
|
||||
epa-file-encrypt-to user-mail-address))
|
||||
|
||||
;; The standard unicode characters are usually misaligned depending on the font.
|
||||
;; This bugs me. Personally, markdown #-marks for headlines are more elegant, so
|
||||
;; we use those.
|
||||
(def-package! org-bullets
|
||||
:commands org-bullets-mode
|
||||
:init (add-hook 'org-mode-hook #'org-bullets-mode)
|
||||
:config (setq org-bullets-bullet-list '("#")))
|
||||
|
||||
|
||||
;;
|
||||
;; Hooks & bootstraps
|
||||
;;
|
||||
|
||||
(defun +org|hook ()
|
||||
"Run everytime `org-mode' is enabled."
|
||||
(setq line-spacing 1)
|
||||
|
||||
;; show-paren-mode causes problems for org-indent-mode
|
||||
(make-local-variable 'show-paren-mode)
|
||||
(setq show-paren-mode nil)
|
||||
|
||||
(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))))))
|
||||
|
||||
(defun +org|init ()
|
||||
"Run once, when org is first loaded."
|
||||
(define-minor-mode +org-evil-mode
|
||||
"Evil-mode bindings for org-mode."
|
||||
:init-value nil
|
||||
:lighter " !"
|
||||
:keymap (make-sparse-keymap)
|
||||
:group 'evil-org)
|
||||
|
||||
(add-hook 'org-mode-hook #'visual-line-mode)
|
||||
(when (featurep! :feature evil)
|
||||
(add-hook 'org-mode-hook #'+org-evil-mode))
|
||||
|
||||
(add-hook 'evil-insert-state-exit-hook #'+org|realign-table-maybe nil t)
|
||||
(add-hook 'evil-insert-state-exit-hook #'+org|update-cookies nil t)
|
||||
(add-hook 'before-save-hook #'+org|update-cookies nil t)
|
||||
|
||||
(+org-init-ui)
|
||||
(+org-init-keybinds)
|
||||
(+org-hacks))
|
||||
|
||||
;;
|
||||
(defun +org-init-ui ()
|
||||
"Configures the UI for `org-mode'."
|
||||
(setq-default
|
||||
org-adapt-indentation nil
|
||||
org-agenda-dim-blocked-tasks nil
|
||||
org-agenda-files (directory-files +org-dir t "\\.org$" t)
|
||||
org-agenda-inhibit-startup t
|
||||
org-agenda-skip-unavailable-files nil
|
||||
org-cycle-include-plain-lists t
|
||||
org-cycle-separator-lines 1
|
||||
;; org-ellipsis " "
|
||||
org-entities-user '(("flat" "\\flat" nil "" "" "266D" "♭") ("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
|
||||
org-hidden-keywords nil
|
||||
org-hide-emphasis-markers nil
|
||||
org-hide-leading-stars t
|
||||
org-hide-leading-stars-before-indent-mode t
|
||||
org-image-actual-width nil
|
||||
org-indent-indentation-per-level 2
|
||||
org-indent-mode-turns-on-hiding-stars t
|
||||
org-pretty-entities nil
|
||||
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 '{}
|
||||
outline-blank-line t
|
||||
|
||||
;; 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.
|
||||
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)))
|
||||
|
||||
;; 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))
|
||||
|
||||
;; Custom fontification
|
||||
(defsubst +org--tag-face (n)
|
||||
(let ((kwd (match-string n)))
|
||||
(or (and (equal kwd "#") 'org-tag)
|
||||
(and (equal kwd "@") 'org-special-keyword))))
|
||||
|
||||
(defun +org|init-custom-fontification ()
|
||||
"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)
|
||||
4. Fontify dividers/separators (5+ dashes)
|
||||
5. Fontify #hashtags and @at-tags, for personal convenience"
|
||||
(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
|
||||
("\\s-\\(\\([#@]\\)[^ \n.,]+\\)" 1 (+org--tag-face 2)))))))
|
||||
(add-hook 'org-font-lock-set-keywords-hook #'+org|init-custom-fontification))
|
||||
|
||||
(defun +org-init-keybinds ()
|
||||
"Sets up org-mode and evil keybindings. Tries to fix the idiosyncrasies
|
||||
between the two."
|
||||
(map! (:map org-mode-map "RET" #'org-return-indent)
|
||||
|
||||
(:map +org-evil-mode-map
|
||||
:n "RET" #'+org/dwim-at-point
|
||||
|
||||
;; Navigate table cells (from insert-mode)
|
||||
: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
|
||||
|
||||
:n [tab] #'+org/toggle-fold
|
||||
:i [tab] #'+org/indent-or-next-field-or-yas-expand
|
||||
:i [backtab] #'+org/dedent-or-prev-field
|
||||
|
||||
:ni [M-return] (λ! (+org/insert-item 'below))
|
||||
:ni [S-M-return] (λ! (+org/insert-item 'above))
|
||||
|
||||
:m "]]" (λ! (org-forward-heading-same-level nil) (org-beginning-of-line))
|
||||
:m "[[" (λ! (org-backward-heading-same-level nil) (org-beginning-of-line))
|
||||
:m "]l" #'org-next-link
|
||||
:m "[l" #'org-previous-link
|
||||
:m "$" #'org-end-of-line
|
||||
:m "^" #'org-beginning-of-line
|
||||
:n "gQ" #'org-fill-paragraph
|
||||
:n "<" #'org-metaleft
|
||||
:n ">" #'org-metaright
|
||||
:v "<" (λ! (org-metaleft) (evil-visual-restore))
|
||||
:v ">" (λ! (org-metaright) (evil-visual-restore))
|
||||
:m "<tab>" #'org-cycle
|
||||
|
||||
;; Fix code-folding keybindings
|
||||
:n "za" #'+org/toggle-fold
|
||||
:n "zA" #'org-shifttab
|
||||
:n "zc" #'outline-hide-subtree
|
||||
:n "zC" (λ! (outline-hide-sublevels 1))
|
||||
:n "zd" (lambda (&optional arg) (interactive "p") (outline-hide-sublevels (or arg 3)))
|
||||
:n "zm" (λ! (outline-hide-sublevels 1))
|
||||
:n "zo" #'outline-show-subtree
|
||||
:n "zO" #'outline-show-all
|
||||
:n "zr" #'outline-show-all)
|
||||
|
||||
(:after org-agenda
|
||||
(:map org-agenda-mode-map
|
||||
:e "<escape>" #'org-agenda-Quit
|
||||
:e "m" #'org-agenda-month-view
|
||||
:e "C-j" #'org-agenda-next-item
|
||||
:e "C-k" #'org-agenda-previous-item
|
||||
:e "C-n" #'org-agenda-next-item
|
||||
:e "C-p" #'org-agenda-previous-item))))
|
||||
|
||||
;;
|
||||
(defun +org-hacks ()
|
||||
"Getting org to behave."
|
||||
;; Don't open separate windows
|
||||
(cl-pushnew '(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
|
||||
(defun +org|remove-occur-highlights ()
|
||||
(when (derived-mode-p 'org-mode)
|
||||
(org-remove-occur-highlights)
|
||||
t))
|
||||
(add-hook '+evil-esc-hook #'+org|remove-occur-highlights)
|
||||
|
||||
(after! recentf
|
||||
;; Don't clobber recentf with agenda files
|
||||
(defun +org-is-agenda-file (filename)
|
||||
(cl-find (file-truename filename) org-agenda-files
|
||||
:key #'file-truename
|
||||
:test #'equal))
|
||||
(add-to-list 'recentf-exclude #'+org-is-agenda-file)))
|
11
modules/org/org/packages.el
Normal file
11
modules/org/org/packages.el
Normal file
@@ -0,0 +1,11 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; org/org/packages.el
|
||||
|
||||
;; NOTE This is an insecure source, but unavoidable if we want org 9.0+.
|
||||
;; orgmode.org offers no secure access to this repo. If this bothers you,
|
||||
;; comment out this `package!' block and download org-plus-contrib from
|
||||
;; orgmode.org.
|
||||
(package! org-plus-contrib :recipe (:fetcher git :url "http://orgmode.org/org-mode.git"))
|
||||
|
||||
(package! org-bullets :recipe (:fetcher github :repo "hlissner/org-bullets"))
|
||||
(package! toc-org)
|
Reference in New Issue
Block a user