feat(emacs): Org theming
This commit is contained in:
@@ -72,17 +72,56 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
|
||||
(downcase uuid)
|
||||
uuid)))
|
||||
|
||||
(defun syd-org-init-faces ()
|
||||
(let ((headline `(:weight bold)))
|
||||
(defun syd-org-init-theme ()
|
||||
(require 'syd-kanagawa)
|
||||
(let* ((hl `(:weight bold))
|
||||
(fg (lambda (c) `(:foreground ,(syd-kanagawa-get c))))
|
||||
(bg (lambda (c) `(:background ,(syd-kanagawa-get c))))
|
||||
(block-delim `(:foreground nil
|
||||
:inherit font-lock-comment-face
|
||||
:extend t
|
||||
,@(funcall bg 'sumi-ink-0)
|
||||
:height 0.75))
|
||||
(keyword '(:background nil :foreground nil
|
||||
:inherit (fixed-pitch font-lock-comment-face)
|
||||
:height 0.9)))
|
||||
(setq org-src-block-faces
|
||||
`(("jupyter-apl" syd-apl)))
|
||||
(custom-theme-set-faces
|
||||
'user
|
||||
`(org-document-title ((t (,@hl :height 1.60))))
|
||||
`(org-document-info ((t (,@hl :height 1.0))))
|
||||
`(org-document-info-keyword ((t ,keyword)))
|
||||
`(org-meta-line ((t ,keyword)))
|
||||
`(org-level-1 ((t (,@hl :height 1.40 ,@(funcall fg 'oni-violet)))))
|
||||
`(org-level-2 ((t (,@hl :height 1.35 ,@(funcall fg 'crystal-blue)))))
|
||||
`(org-level-3 ((t (,@hl :height 1.30 ,@(funcall fg 'spring-violet-2)))))
|
||||
`(org-level-4 ((t (,@hl :height 1.25 ,@(funcall fg 'light-blue)))))
|
||||
`(org-level-5 ((t (,@hl :height 1.20 ,@(funcall fg 'wave-aqua-2)))))
|
||||
`(org-level-6 ((t (,@hl :height 1.15 ,@(funcall fg 'spring-green)))))
|
||||
`(org-level-7 ((t (,@hl :height 1.10 ,@(funcall fg 'boat-yellow-1)))))
|
||||
`(org-level-8 ((t (,@hl :height 1.05 ,@(funcall fg 'boat-yellow-2)))))
|
||||
`(org-block-begin-line ((t ,block-delim)))
|
||||
`(org-block-end-line ((t ,block-delim)))
|
||||
'(org-ellipsis ((t (:height 1.0))))
|
||||
;; It is important that the `org-indent' face uses a fixed-pitch font, lest
|
||||
;; e.g. multi-line bullets appear misaligned.
|
||||
'(org-indent ((t (:inherit (org-hide fixed-pitch)))))
|
||||
'(org-indent ((t (:inherit (org-hide syd-alt-fixed-pitch)))))
|
||||
;; Must be fixed-pitch; `[ ]` and `[X]' should be the same width.
|
||||
'(org-checkbox ((t (:inherit fixed-pitch))))
|
||||
'(org-drawer ((t (:inherit (font-lock-comment-face fixed-pitch)))))
|
||||
'(org-property-value ((t (:inherit fixed-pitch)))))))
|
||||
`(org-drawer ((t ,block-delim)))
|
||||
'(org-property-value ((t (:inherit fixed-pitch))))
|
||||
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))
|
||||
`(org-block ((t (:inherit fixed-pitch
|
||||
,@(funcall bg 'sumi-ink-2)))))
|
||||
'(org-code ((t (:inherit (shadow fixed-pitch))))))))
|
||||
|
||||
(evil-define-command syd-org-yank-link (register)
|
||||
(interactive "<x>")
|
||||
(if-let* ((url (thing-at-point 'url)))
|
||||
(progn (evil-set-register (or register ?\") url)
|
||||
(message "Yanked link: %s" url))
|
||||
(message "No URL at point")))
|
||||
|
||||
(defun syd-org-init-keybinds ()
|
||||
(general-def
|
||||
@@ -92,7 +131,8 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
|
||||
[C-M-return] #'org-insert-subheading)
|
||||
(general-def
|
||||
:prefix-map 'syd-org-mode-links-map
|
||||
"l" #'org-insert-link)
|
||||
"l" #'org-insert-link
|
||||
"y" #'syd-org-yank-link)
|
||||
(general-define-key
|
||||
:keymaps 'org-mode-map
|
||||
:states '(normal visual motion emacs insert)
|
||||
@@ -108,20 +148,56 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
|
||||
"i" #'org-toggle-item
|
||||
"I" #'org-id-get-create
|
||||
"k" #'org-babel-remove-result
|
||||
"l" `("Links" . ,syd-org-mode-links-map)))
|
||||
"l" `("Links" . ,syd-org-mode-links-map)
|
||||
"t" #'org-todo))
|
||||
|
||||
(use-package org
|
||||
:defer-incrementally
|
||||
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
|
||||
:init
|
||||
;; 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.
|
||||
(with-no-warnings
|
||||
(custom-declare-face 'syd-org-todo-active
|
||||
'((t (:inherit (bold font-lock-constant-face org-todo)))) "")
|
||||
(custom-declare-face 'syd-org-todo-project
|
||||
'((t (:inherit (bold font-lock-doc-face org-todo)))) "")
|
||||
(custom-declare-face 'syd-org-todo-onhold
|
||||
'((t (:inherit (bold warning org-todo)))) "")
|
||||
(custom-declare-face 'syd-org-todo-cancel
|
||||
'((t (:inherit (bold error org-todo)))) ""))
|
||||
:custom ((org-startup-folded 'content)
|
||||
(org-directory "~/org")
|
||||
;; Stay out of my config dir!
|
||||
(org-id-locations-file (file-name-concat syd-cache-dir
|
||||
"org-id-locations"))
|
||||
;; New headings should be inserted /after/ the heading's contents.
|
||||
(org-insert-heading-respect-content t))
|
||||
(org-insert-heading-respect-content t)
|
||||
;; Hide markup syntax and leave the markup.
|
||||
(org-hide-emphasis-markers t)
|
||||
(org-ellipsis " […]")
|
||||
(org-todo-keywords
|
||||
'((sequence
|
||||
"TODO(t)" ; A task that needs doing & is ready to do
|
||||
"PROJ(p)" ; A project, which usually contains other tasks
|
||||
"STRT(s)" ; A task that is in progress
|
||||
"WAIT(w)" ; Something external is holding up this task
|
||||
"HOLD(h)" ; This task is paused/on hold because of me
|
||||
"IDEA(i)" ; An unconfirmed and unapproved task or notion
|
||||
"|"
|
||||
"DONE(d)" ; Task successfully completed
|
||||
"KILL(k)"))) ; Task was cancelled, aborted, or is no longer
|
||||
; applicable
|
||||
(org-todo-keyword-faces
|
||||
'(("[-]" . syd-org-todo-active)
|
||||
("STRT" . syd-org-todo-active)
|
||||
("WAIT" . syd-org-todo-onhold)
|
||||
("HOLD" . syd-org-todo-onhold)
|
||||
("PROJ" . syd-org-todo-project)
|
||||
("KILL" . syd-org-todo-cancel))))
|
||||
:preface
|
||||
;; Speed up initialisation by disabling modules we don't need.
|
||||
(defvar org-modules
|
||||
@@ -140,9 +216,13 @@ See https://lists.gnu.org/archive/html/emacs-orgmode/2019-07/msg00081.html."
|
||||
(syd-add-hook 'org-mode-hook
|
||||
#'org-indent-mode
|
||||
#'syd-prose-mode)
|
||||
(syd-org-init-faces)
|
||||
(syd-org-init-theme)
|
||||
(syd-org-init-keybinds))
|
||||
|
||||
(use-package org-appear
|
||||
:hook (org-mode . org-appear-mode)
|
||||
:custom (org-appear-autoemphasis t))
|
||||
|
||||
;; Unlike those appearing in `syd-org--init-roam-keybinds', these should be
|
||||
;; available even outside of Org-mode.
|
||||
(general-def
|
||||
@@ -199,8 +279,7 @@ In case of failure, fail gracefully."
|
||||
|
||||
(use-package evil-org
|
||||
:hook ((org-mode . evil-org-mode)
|
||||
(org-capture-mode . evil-insert-state)
|
||||
(doom-docs-org-mode . evil-org-mode))
|
||||
(org-capture-mode . evil-insert-state))
|
||||
:init
|
||||
(defvar evil-org-retain-visual-state-on-shift t)
|
||||
(defvar evil-org-special-o/O '(table-row))
|
||||
@@ -215,7 +294,18 @@ In case of failure, fail gracefully."
|
||||
;; (kbd syd-leader-key) nil))
|
||||
|
||||
(use-package hide-mode-line
|
||||
:hook (org-mode-hook . hide-mode-line-mode))
|
||||
:hook (org-mode . hide-mode-line-mode))
|
||||
|
||||
(use-package org-superstar
|
||||
:hook (org-mode . org-superstar-mode)
|
||||
:custom ((org-superstar-headline-bullets-list '(9675))
|
||||
(org-superstar-item-bullet-alist '((?- . ?•)
|
||||
(?+ . ?➤)
|
||||
(?* . ?⋆))))
|
||||
:config
|
||||
(custom-theme-set-faces
|
||||
'user
|
||||
`(org-superstar-header-bullet ((t (:font ,syd-alt-fixed-pitch-font))))))
|
||||
|
||||
(provide 'syd-org)
|
||||
;;; syd-org.el ends here
|
||||
|
||||
Reference in New Issue
Block a user