mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 12:00:24 +10:00
Minor updates.
This commit is contained in:
@@ -74,15 +74,24 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
|
||||
(unless org-agenda-files
|
||||
(setq org-agenda-files (list org-directory)))
|
||||
(setq-default
|
||||
;; Different colors for different priority levels
|
||||
org-agenda-deadline-faces
|
||||
'((1.001 . error)
|
||||
(1.0 . org-warning)
|
||||
(0.5 . org-upcoming-deadline)
|
||||
(0.0 . org-upcoming-distant-deadline))
|
||||
;; Don't monopolize the whole frame just for the agenda
|
||||
org-agenda-window-setup 'current-window
|
||||
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
|
||||
;; Shift the agenda to show the previous 3 days and the next 7 days for
|
||||
;; better context on your week. The past is less important than the future.
|
||||
org-agenda-span 10
|
||||
org-agenda-start-on-weekday nil
|
||||
org-agenda-start-day "-3d"))
|
||||
org-agenda-start-day "-3d"
|
||||
;; Optimize `org-agenda' by inhibiting extra work while opening agenda
|
||||
;; buffers in the background. They'll be "restarted" if the user switches to
|
||||
;; them anyway (see `+org-exclude-agenda-buffers-from-workspace-h')
|
||||
org-agenda-inhibit-startup t))
|
||||
|
||||
|
||||
(defun +org-init-appearance-h ()
|
||||
@@ -93,11 +102,13 @@ Is relative to `org-directory', unless it is absolute. Is used in Doom's default
|
||||
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-hide-leading-stars t
|
||||
org-image-actual-width nil
|
||||
org-imenu-depth 8
|
||||
org-priority-faces
|
||||
'((?A . error)
|
||||
(?B . warning)
|
||||
@@ -200,10 +211,27 @@ This forces it to read the background before rendering."
|
||||
(defadvice! +org-fix-newline-and-indent-in-src-blocks-a (&optional indent _arg _interactive)
|
||||
"Mimic `newline-and-indent' in src blocks w/ lang-appropriate indentation."
|
||||
:after #'org-return
|
||||
(when (and indent (org-in-src-block-p t))
|
||||
(when (and indent
|
||||
org-src-tab-acts-natively
|
||||
(org-in-src-block-p t))
|
||||
(org-babel-do-in-edit-buffer
|
||||
(call-interactively #'indent-for-tab-command))))
|
||||
|
||||
(defadvice! +org-inhibit-mode-hooks-a (orig-fn datum name &optional initialize &rest args)
|
||||
"Prevent potentially expensive mode hooks in `org-babel-do-in-edit-buffer' ops."
|
||||
:around #'org-src--edit-element
|
||||
(apply orig-fn datum name
|
||||
(if (and (eq org-src-window-setup 'switch-invisibly)
|
||||
(functionp initialize))
|
||||
;; org-babel-do-in-edit-buffer is used to execute quick, one-off
|
||||
;; logic in the context of another major mode. Initializing this
|
||||
;; major mode can be terribly expensive (particular its mode
|
||||
;; hooks), so we inhibit them.
|
||||
(lambda ()
|
||||
(quiet! (delay-mode-hooks (funcall initialize))))
|
||||
initialize)
|
||||
args))
|
||||
|
||||
;; 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)
|
||||
@@ -344,10 +372,7 @@ relative to `org-directory', unless it is an absolute path."
|
||||
(propertize (abbreviate-file-name (buffer-file-name (buffer-base-buffer)))
|
||||
'face 'font-lock-string-face)
|
||||
org-eldoc-breadcrumb-separator
|
||||
header-line-format))))
|
||||
|
||||
(when (featurep! :editor evil)
|
||||
(add-hook 'org-capture-mode-hook #'evil-insert-state)))
|
||||
header-line-format)))))
|
||||
|
||||
|
||||
(defun +org-init-capture-frame-h ()
|
||||
@@ -413,19 +438,27 @@ relative to `org-directory', unless it is an absolute path."
|
||||
(+org-define-basic-link "doom-docs" 'doom-docs-dir)
|
||||
(+org-define-basic-link "doom-modules" 'doom-modules-dir)
|
||||
|
||||
;; Allow inline image previews of http(s)? urls or data uris
|
||||
;; Allow inline image previews of http(s)? urls or data uris.
|
||||
;; `+org-http-image-data-fn' will respect `org-display-remote-inline-images'.
|
||||
(setq org-display-remote-inline-images 'download) ; TRAMP urls
|
||||
(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)
|
||||
|
||||
;; Add support for youtube links + previews
|
||||
(require 'org-yt nil t))
|
||||
(require 'org-yt nil t)
|
||||
|
||||
(defadvice! +org-dont-preview-if-disabled-a (&rest _)
|
||||
"Make `org-yt' respect `org-display-remote-inline-images'."
|
||||
:before-while #'org-yt-image-data-fun
|
||||
(not (eq org-display-remote-inline-images 'skip))))
|
||||
|
||||
|
||||
(defun +org-init-export-h ()
|
||||
"TODO"
|
||||
(setq org-export-with-smart-quotes t
|
||||
org-html-validation-link nil)
|
||||
org-html-validation-link nil
|
||||
org-latex-prefer-user-labels t)
|
||||
|
||||
(when (featurep! :lang markdown)
|
||||
(add-to-list 'org-export-backends 'md))
|
||||
@@ -514,7 +547,7 @@ eldoc string."
|
||||
(funcall orig-fn
|
||||
(cl-loop for part in path
|
||||
;; Remove full link syntax
|
||||
for fixedpart = (replace-regexp-in-string org-link-any-re "\\4" part)
|
||||
for fixedpart = (replace-regexp-in-string org-link-any-re "\\4" (or part ""))
|
||||
for n from 0
|
||||
for face = (nth (% n org-n-level-faces) org-level-faces)
|
||||
collect
|
||||
@@ -538,24 +571,25 @@ eldoc string."
|
||||
|
||||
(add-hook! 'org-agenda-finalize-hook
|
||||
(defun +org-exclude-agenda-buffers-from-workspace-h ()
|
||||
"Prevent temporarily-opened agenda buffers from being associated with the
|
||||
current workspace (and clean them up)."
|
||||
(when (and org-agenda-new-buffers (bound-and-true-p persp-mode))
|
||||
(unless org-agenda-sticky
|
||||
(let (persp-autokill-buffer-on-remove)
|
||||
(persp-remove-buffer org-agenda-new-buffers
|
||||
(get-current-persp)
|
||||
nil)))
|
||||
(dolist (buffer org-agenda-new-buffers)
|
||||
(with-current-buffer buffer
|
||||
;; HACK Org agenda opens temporary agenda incomplete org-mode
|
||||
;; 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.
|
||||
(add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
|
||||
nil 'local))))))
|
||||
"Prevent temporary agenda buffers being associated with current
|
||||
workspace."
|
||||
(when (and org-agenda-new-buffers
|
||||
(bound-and-true-p persp-mode)
|
||||
(not org-agenda-sticky))
|
||||
(let (persp-autokill-buffer-on-remove)
|
||||
(persp-remove-buffer org-agenda-new-buffers
|
||||
(get-current-persp)
|
||||
nil))))
|
||||
(defun +org-defer-mode-in-agenda-buffers-h ()
|
||||
"Org agenda opens temporary agenda incomplete org-mode 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."
|
||||
(dolist (buffer org-agenda-new-buffers)
|
||||
(with-current-buffer buffer
|
||||
(add-hook 'doom-switch-buffer-hook #'+org--restart-mode-h
|
||||
nil 'local)))))
|
||||
|
||||
(defadvice! +org--exclude-agenda-buffers-from-recentf-a (orig-fn file)
|
||||
"Prevent temporarily opened agenda buffers from polluting recentf."
|
||||
@@ -606,6 +640,7 @@ between the two."
|
||||
"C-c C-S-l" #'+org/remove-link
|
||||
"C-c C-i" #'org-toggle-inline-images
|
||||
;; textmate-esque newline insertion
|
||||
"S-RET" #'+org/shift-return
|
||||
"C-RET" #'+org/insert-item-below
|
||||
"C-S-RET" #'+org/insert-item-above
|
||||
"C-M-RET" #'org-insert-subheading
|
||||
@@ -692,7 +727,8 @@ between the two."
|
||||
"e" #'org-clock-modify-effort-estimate
|
||||
"E" #'org-set-effort
|
||||
"g" #'org-clock-goto
|
||||
"G" (λ! (org-clock-goto 'select))
|
||||
"G" (cmd! (org-clock-goto 'select))
|
||||
"l" #'+org/toggle-last-clock
|
||||
"i" #'org-clock-in
|
||||
"I" #'org-clock-in-last
|
||||
"o" #'org-clock-out
|
||||
@@ -715,7 +751,7 @@ between the two."
|
||||
"g" #'helm-org-in-buffer-headings
|
||||
"G" #'helm-org-agenda-files-headings)
|
||||
"c" #'org-clock-goto
|
||||
"C" (λ! (org-clock-goto 'select))
|
||||
"C" (cmd! (org-clock-goto 'select))
|
||||
"i" #'org-id-goto
|
||||
"r" #'org-refile-goto-last-stored
|
||||
"v" #'+org/goto-visible
|
||||
@@ -729,6 +765,12 @@ between the two."
|
||||
"s" #'org-store-link
|
||||
"S" #'org-insert-last-stored-link
|
||||
"t" #'org-toggle-link-display)
|
||||
(:prefix ("P" . "publish")
|
||||
"a" #'org-publish-all
|
||||
"f" #'org-publish-current-file
|
||||
"p" #'org-publish
|
||||
"P" #'org-publish-current-project
|
||||
"s" #'org-publish-sitemap)
|
||||
(:prefix ("r" . "refile")
|
||||
"." #'+org/refile-to-current-file
|
||||
"c" #'+org/refile-to-running-clock
|
||||
@@ -757,7 +799,6 @@ between the two."
|
||||
"p" #'org-priority
|
||||
"u" #'org-priority-up)))
|
||||
|
||||
|
||||
(map! :after org-agenda
|
||||
:map org-agenda-mode-map
|
||||
:m "C-SPC" #'org-agenda-show-and-scroll-up
|
||||
@@ -852,25 +893,6 @@ compelling reason, so..."
|
||||
(set-marker p nil)))))
|
||||
|
||||
|
||||
(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
|
||||
org-superstar-leading-fallback ?\s
|
||||
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))))
|
||||
|
||||
|
||||
(use-package! org-crypt ; built-in
|
||||
:commands org-encrypt-entries org-encrypt-entry org-decrypt-entries org-decrypt-entry
|
||||
:hook (org-reveal-start . org-decrypt-entry)
|
||||
@@ -925,6 +947,7 @@ compelling reason, so..."
|
||||
(use-package! evil-org
|
||||
:when (featurep! :editor evil +everywhere)
|
||||
:hook (org-mode . evil-org-mode)
|
||||
:hook (org-capture-mode . evil-insert-state)
|
||||
:init
|
||||
(defvar evil-org-retain-visual-state-on-shift t)
|
||||
(defvar evil-org-special-o/O '(table-row))
|
||||
@@ -940,24 +963,25 @@ compelling reason, so..."
|
||||
: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
|
||||
:i "C-l" (cmds! (org-at-table-p) #'org-table-next-field
|
||||
#'org-end-of-line)
|
||||
:i "C-h" (cmds! (org-at-table-p) #'org-table-previous-field
|
||||
#'org-beginning-of-line)
|
||||
:i "C-k" (cmds! (org-at-table-p) #'+org/table-previous-row
|
||||
#'org-up-element)
|
||||
:i "C-j" (cmds! (org-at-table-p) #'org-table-next-row
|
||||
#'org-down-element)
|
||||
: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
|
||||
:i [return] (λ! (org-return t))
|
||||
:i "RET" (λ! (org-return t))
|
||||
:n [return] #'+org/dwim-at-point
|
||||
:n "RET" #'+org/dwim-at-point
|
||||
:n [return] #'+org/dwim-at-point
|
||||
:n "RET" #'+org/dwim-at-point
|
||||
:i [return] (cmd! (org-return electric-indent-mode))
|
||||
:i "RET" (cmd! (org-return electric-indent-mode))
|
||||
:i [S-return] #'+org/shift-return
|
||||
:i "S-RET" #'+org/shift-return
|
||||
;; 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
|
||||
@@ -966,8 +990,6 @@ compelling reason, so..."
|
||||
: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
|
||||
@@ -1011,16 +1033,18 @@ compelling reason, so..."
|
||||
org-list org-pcomplete org-src org-footnote org-macro ob org org-agenda
|
||||
org-capture
|
||||
:preface
|
||||
;; Set these to nil now so we can detect user changes to them later (and fall
|
||||
;; back on defaults otherwise)
|
||||
;; Set to nil 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)
|
||||
|
||||
(setq org-publish-timestamp-directory (concat doom-cache-dir "org-timestamps/")
|
||||
org-preview-latex-image-directory (concat doom-cache-dir "org-latex/"))
|
||||
org-preview-latex-image-directory (concat doom-cache-dir "org-latex/")
|
||||
;; Recognize a), A), a., A., etc -- must be set before org is loaded.
|
||||
org-list-allow-alphabetical t)
|
||||
|
||||
;; Make most of the default modules opt-in, because I sincerely doubt most
|
||||
;; users use all of them.
|
||||
;; Make most of the default modules opt-in to lighten its first-time load
|
||||
;; delay. I sincerely doubt most users use them all.
|
||||
(defvar org-modules
|
||||
'(;; ol-w3m
|
||||
;; ol-bbdb
|
||||
@@ -1081,7 +1105,19 @@ compelling reason, so..."
|
||||
(run-hooks 'org-load-hook))
|
||||
|
||||
:config
|
||||
(setq org-archive-subtree-save-file-p t) ; save target buffer after archiving
|
||||
(set-company-backend! 'org-mode 'company-capf 'company-dabbrev)
|
||||
(set-eval-handler! 'org-mode #'+org-eval-handler)
|
||||
(set-lookup-handlers! 'org-mode
|
||||
:definition #'+org-lookup-definition-handler
|
||||
:references #'+org-lookup-references-handler
|
||||
:documentation #'+org-lookup-documentation-handler)
|
||||
|
||||
;; Save target buffer after archiving a node.
|
||||
(setq org-archive-subtree-save-file-p t)
|
||||
|
||||
;; Prevent modifications made in invisible sections of an org document, as
|
||||
;; unintended changes can easily go unseen otherwise.
|
||||
(setq org-catch-invisible-edits 'smart)
|
||||
|
||||
;; Global ID state means we can have ID links anywhere. This is required for
|
||||
;; `org-brain', however.
|
||||
|
||||
Reference in New Issue
Block a user