Move modules/org/* back to lang/org

This commit is contained in:
Henrik Lissner 2017-12-08 22:59:42 -05:00
parent 346d7bdf36
commit b111303d20
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
25 changed files with 159 additions and 167 deletions

View file

@ -98,6 +98,14 @@
lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
ocaml ; an objective camel
(org ; organize your plain life in plain text
+attach ; custom attachment system
+babel ; running code in org
+capture ; org-capture in and outside of Emacs
+export ; centralized export system + more backends
+present ; Emacs for presentations
;; TODO +publish
)
perl ; write code no one else can comprehend
php ; make php less awful to work with
plantuml ; diagrams for confusing people more
@ -112,16 +120,6 @@
typescript ; javascript, but better
web ; the tubes
:org
org ; organize your plain life in plain text
org-babel ; executable code snippets in org-mode
org-attach ; a simpler attachment system
org-capture ; a better org-capture, in or outside of Emacs
org-export ; a custom, centralized export system
org-present ; using org-mode for presentations
;org-sync ; TODO sync with mobile
;org-publish ; TODO org + blogs
;; Applications are complex and opinionated modules that transform Emacs
;; toward a specific purpose. They may have additional dependencies and
;; should be loaded last.

View file

@ -1,10 +1,6 @@
;;; org/org-attach/config.el -*- lexical-binding: t; -*-
;;; lang/org/+attach.el -*- lexical-binding: t; -*-
(defvar +org-attach-dir (expand-file-name ".attach/" +org-dir)
"Where to store attachments (relative to current org file).")
(add-hook 'org-load-hook #'+org-attach|init t)
(add-hook 'org-load-hook #'+org-attach|init)
;; I believe Org's native attachment system is over-complicated and litters
;; files with metadata I don't want. So I wrote my own, which:
@ -21,6 +17,10 @@
;; + `+org-attach/url'
;; + :org [FILE/URL]
(defvar +org-attach-dir (expand-file-name ".attach/" +org-dir)
"Where to store attachments (relative to current org file).")
(def-package! org-download
:commands (org-download-dnd org-download-dnd-base64)
:init
@ -39,10 +39,8 @@
(setq org-download-screenshot-method
(cond (IS-MAC "screencapture -i %s")
(IS-LINUX
(cond ((executable-find "maim")
"maim -s %s")
((executable-find "scrot")
"scrot -s %s")))))
(cond ((executable-find "maim") "maim -s %s")
((executable-find "scrot") "scrot -s %s")))))
;; Ensure that relative inline image paths are relative to the attachment folder.
(advice-add #'org-display-inline-images :around #'+org-attach*relative-to-attach-dir)
@ -67,7 +65,8 @@
(defun +org-attach|init ()
(setq org-attach-directory +org-attach-dir)
(push +org-attach-dir projectile-globally-ignored-directories)
(push (car (last (split-string +org-attach-dir "/" t)))
projectile-globally-ignored-directories)
(after! recentf
(push (format "%s.+$" (regexp-quote +org-attach-dir))

View file

@ -1,6 +1,6 @@
;;; org/org-babel/config.el -*- lexical-binding: t; -*-
;;; lang/org/+babel.el -*- lexical-binding: t; -*-
(add-hook 'org-load-hook #'+org-babel|init t)
(add-hook 'org-load-hook #'+org-babel|init)
(defvar +org-babel-languages
'(calc
@ -24,6 +24,7 @@
translate) ; ob-translate
"A list of org-babel languages to load.")
(defun +org-babel|init ()
(setq org-src-fontify-natively t ; make code pretty
org-src-preserve-indentation t ; use native major-mode indentation
@ -46,9 +47,4 @@
(cl-loop with fn = (if others #'not #'identity)
for p in params
if (funcall fn (eq (car p) key))
collect p))
(defun +org|src-mode-remove-header ()
"Remove header-line with keybinding help; I know the keybinds."
(setq header-line-format nil))
(add-hook 'org-src-mode-hook #'+org|src-mode-remove-header))
collect p)))

View file

@ -1,6 +1,6 @@
;;; org/org-capture/config.el -*- lexical-binding: t; -*-
;;; lang/org/+capture.el -*- lexical-binding: t; -*-
(add-hook 'org-load-hook #'+org-capture|init t)
(add-hook 'org-load-hook #'+org-capture|init)
;; Sets up two `org-capture' workflows that I like:
;;
@ -12,8 +12,10 @@
;; anywhere I can call org-capture (whether or not Emacs is open/running),
;; like, say, from qutebrowser, vimperator, dmenu or a global keybinding.
(setq org-default-notes-file (concat +org-dir "notes.org")
org-capture-templates
(defvar +org-default-notes-file "notes.org"
"TODO")
(setq org-capture-templates
'(("t" "Todo" entry
(file+headline (expand-file-name "todo.org" +org-dir) "Inbox")
"* [ ] %?\n%i" :prepend t :kill-buffer t)
@ -23,6 +25,9 @@
"* %u %?\n%i" :prepend t :kill-buffer t)))
(defun +org-capture|init ()
(defvaralias 'org-default-notes-file '+org-default-notes-file)
(setq org-default-notes-file (expand-file-name +org-default-notes-file +org-dir))
(add-hook 'org-capture-after-finalize-hook #'+org-capture|cleanup-frame)
(when (featurep! :feature evil)

View file

@ -1,6 +1,6 @@
;;; org/org-export/config.el -*- lexical-binding: t; -*-
;;; lang/org/+export.el -*- lexical-binding: t; -*-
(add-hook 'org-load-hook #'+org-export|init t)
(add-hook 'org-load-hook #'+org-export|init)
;; I don't have any beef with org's built-in export system, but I do wish it
;; would export to a central directory, rather than `default-directory'. This is
@ -8,6 +8,7 @@
;; refer back to old exports if needed.
(def-package! ox-pandoc
:defer t
:config
(unless (executable-find "pandoc")
(warn "org-export: couldn't find pandoc, disabling pandoc export"))
@ -19,7 +20,7 @@
;;
(defun +org-export|init ()
(setq org-export-directory (expand-file-name ".export" +org-dir)
org-export-backends '(ascii html latex md)
org-export-backends '(ascii html latex md pandoc)
org-export-with-toc t
org-export-with-author t)

View file

@ -1,9 +1,9 @@
;;; org/org-present/config.el -*- lexical-binding: t; -*-
;;; lang/org/+present.el -*- lexical-binding: t; -*-
(defvar +org-present-text-scale 7
"The `text-scale-amount' for `org-tree-slide-mode'.")
(add-hook 'org-load-hook #'+org-present|init t)
(add-hook 'org-load-hook #'+org-present|init)
;;
@ -11,6 +11,7 @@
;;
(def-package! ox-reveal
:defer t
:config
(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/"
org-reveal-mathjax t))

View file

View file

@ -1,9 +1,9 @@
;; org/org-attach/autoload/evil.el -*- lexical-binding: t; -*-
;;; lang/org/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil)
;; TODO +org-attach:find
;;;###autoload (autoload '+org-attach:uri "org/org-attach/autoload/evil" nil t)
;;;###autoload (autoload '+org-attach:uri "lang/org/autoload/evil" nil t)
(evil-define-command +org-attach:uri (uri)
"Downloads the file at URL and places an org link to it at the cursor."
(interactive "<f>")

View file

@ -1,4 +1,5 @@
;;; org/org-attach/autoload/org-attach.el -*- lexical-binding: t; -*-
;;; lang/org/autoload/org-attach.el -*- lexical-binding: t; -*-
;;;###if (featurep! +attach)
(defun +org-attach--icon (path)
(char-to-string

View file

@ -1,4 +1,5 @@
;;; org/org-babel/autoload.el -*- lexical-binding: t; -*-
;;; lang/org/autoload/org-babel.el -*- lexical-binding: t; -*-
;;;###if (featurep! +babel)
;;;###autoload
(defun +org-babel/edit (arg)

View file

@ -1,4 +1,15 @@
;;; org/org-capture/autoload/org-capture.el -*- lexical-binding: t; -*-
;;; lang/org/autoload/org-capture.el -*- lexical-binding: t; -*-
;;;###if (featurep! +capture)
(when (featurep! :feature evil)
;;;###autoload (autoload '+org-capture:open "lang/org/autoload/org-capture" nil t)
(evil-define-operator +org-capture:open (&optional beg end)
"Evil ex interface to `+org-capture/dwim'."
:move-point nil :type inclusive
(interactive "<r>")
(+org-capture/open
(unless (or (evil-normal-state-p) (evil-insert-state-p))
(buffer-substring beg end)))))
;;;###autoload
(defun +org-capture/open (&optional string key)

View file

@ -1,4 +1,5 @@
;;; org/org-present/autoload.el -*- lexical-binding: t; -*-
;;; lang/org/autoload/org-present.el -*- lexical-binding: t; -*-
;;;###if (featurep! +present)
(defvar +org-present--overlays nil)
;;;###autoload

View file

@ -1,16 +1,22 @@
;;; org/org/config.el -*- lexical-binding: t; -*-
;;; lang/org/config.el -*- lexical-binding: t; -*-
(defvar +org-dir (expand-file-name "~/work/org/")
"The directory where org files are kept.")
;; Ensure ELPA org is prioritized above built-in org.
(when-let (path (locate-library "org" nil doom--package-load-path))
(setq load-path (delete path load-path))
(push (file-name-directory path) load-path))
;; Custom variables
(defvar +org-dir (expand-file-name "~/work/org/")
"The directory where org files are kept.")
(defvaralias 'org-directory '+org-dir)
;; Sub-modules
(if (featurep! +attach) (load! +attach))
(if (featurep! +babel) (load! +babel))
(if (featurep! +capture) (load! +capture))
(if (featurep! +export) (load! +export))
(if (featurep! +present) (load! +present))
;; TODO (if (featurep! +publish) (load! +publish))
(add-hook 'org-load-hook #'+org|init)
(after! org (+org|init))
(add-hook 'org-mode-hook #'+org|hook)
@ -19,38 +25,38 @@
;;
(def-package! toc-org
:commands toc-org-enable
:init (add-hook 'org-mode-hook #'toc-org-enable))
:hook (org-mode . 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)
:hook (org-load . 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 '("#")))
:hook (org-mode . org-bullets-mode))
;;
;; Hooks & bootstraps
;;
(defun +org|init ()
"Run once, when org is first loaded."
(defvaralias 'org-directory '+org-dir)
(require 'org)
(+org-init-ui)
(+org-init-keybinds)
(+org-hacks))
(defun +org|hook ()
"Run everytime `org-mode' is enabled."
(when (featurep! :feature evil)
(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)
(+org-evil-mode +1))
(add-hook 'evil-insert-state-exit-hook #'+org|update-cookies nil t))
;; TODO Add filesize checks (possibly too expensive in big org files)
(add-hook 'before-save-hook #'+org|update-cookies nil t)
;;
@ -75,19 +81,6 @@
(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)
(+org-init-ui)
(+org-init-keybinds)
(+org-hacks))
;;
(defun +org-init-ui ()
"Configures the UI for `org-mode'."
@ -100,7 +93,7 @@
org-cycle-include-plain-lists t
org-cycle-separator-lines 1
org-entities-user '(("flat" "\\flat" nil "" "" "266D" "") ("sharp" "\\sharp" nil "" "" "266F" ""))
org-ellipsis ""
;; org-ellipsis " ... "
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-fontify-whole-heading-line t
@ -132,6 +125,7 @@
;; 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-preview-latex-image-directory (concat doom-cache-dir "org-latex/")
org-format-latex-options (plist-put org-format-latex-options :scale 1.5)
org-format-latex-options
(plist-put org-format-latex-options
@ -152,56 +146,53 @@
(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
"C-c C-S-l" #'+org/remove-link
:n "j" "gj"
:n "k" "gk")
(map! :map org-mode-map
"RET" #'org-return-indent
"C-c C-S-l" #'+org/remove-link
:n "C-c C-i" #'org-toggle-inline-images
(:map +org-evil-mode-map
:n "RET" #'+org/dwim-at-point
: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
;; Expand tables (or shiftmeta move)
: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-metaup
:ni "C-S-j" #'org-metadown
;; 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
;; Expand tables (or shiftmeta move)
: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-metaup
:ni "C-S-j" #'org-metadown
:n [tab] #'+org/toggle-fold
:i [tab] #'+org/indent-or-next-field-or-yas-expand
:i [backtab] #'+org/dedent-or-prev-field
: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))
: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
: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))
;; 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)
;; 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

View file

@ -0,0 +1,33 @@
;; -*- no-byte-compile: t; -*-
;;; lang/org/packages.el
;; NOTE This is an insecure source, but unavoidable if we want org 9.0+ (which
;; this module requires). 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)
(when (featurep! +attach)
(package! org-download))
(when (featurep! +babel)
(package! ob-go)
(package! ob-mongo)
(package! ob-redis)
(package! ob-restclient)
(package! ob-rust :recipe (:fetcher github :repo "zweifisch/ob-rust"))
(package! ob-sql-mode)
(package! ob-translate))
(when (featurep! +export)
(package! ox-pandoc))
(when (featurep! +present)
(package! centered-window-mode)
(package! org-tree-slide)
(package! ox-reveal))
;; (when (featurep! +publish))

View file

@ -1,4 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; org/org-attach/packages.el
(package! org-download)

View file

@ -1,10 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; org/org-babel/packages.el
(package! ob-go)
(package! ob-mongo)
(package! ob-redis)
(package! ob-restclient)
(package! ob-rust :recipe (:fetcher github :repo "zweifisch/ob-rust"))
(package! ob-sql-mode)
(package! ob-translate)

View file

@ -1,11 +0,0 @@
;;; org/org-capture/autoload/evil.el -*- lexical-binding: t; -*-
;;;###if (featurep! :feature evil)
;;;###autoload (autoload '+org-capture:open "org/org-capture/autoload/evil" nil t)
(evil-define-operator +org-capture:open (&optional beg end)
"Evil ex interface to `+org-capture/dwim'."
:move-point nil :type inclusive
(interactive "<r>")
(+org-capture/open
(unless (or (evil-normal-state-p) (evil-insert-state-p))
(buffer-substring beg end))))

View file

@ -1,4 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; org/org-export/packages.el
(package! ox-pandoc)

View file

@ -1,6 +0,0 @@
;; -*- no-byte-compile: t; -*-
;;; org/org-present/packages.el
(package! centered-window-mode)
(package! org-tree-slide)
(package! ox-reveal)

View file

@ -1,11 +0,0 @@
;; -*- 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)