diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-25 14:37:40 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-25 14:37:40 -0500 |
| commit | a5555afaf09be4c023f49661d48de803b2586927 (patch) | |
| tree | 78625656fea7df312ed9a4467e2e899433e16998 | |
| parent | 80de20b443c7a3cbc9283bb64380539d80c61cf8 (diff) | |
re-organized org modules using use-package + maintenance work
- updated packages
- removed :after org-contrib references
- added ob-awk, sed, scheme, and shell backends
- make v play with mpv in elfeed search mode map
- added abbrevs
| -rw-r--r-- | TODO.org | 30 | ||||
| -rw-r--r-- | assets/abbrev_defs | 4 | ||||
| -rw-r--r-- | localrepo/archive-contents | 8 | ||||
| -rw-r--r-- | localrepo/geiser-0.30.tar | bin | 0 -> 1064960 bytes | |||
| -rw-r--r-- | localrepo/geiser-guile-0.28.1.tar | bin | 0 -> 81920 bytes | |||
| -rw-r--r-- | localrepo/git-gutter-20240425.647.tar (renamed from localrepo/git-gutter-20220922.256.tar) | bin | 51200 -> 51200 bytes | |||
| -rw-r--r-- | localrepo/gptel-20240424.2306.tar (renamed from localrepo/gptel-20240422.1939.tar) | bin | 174080 -> 184320 bytes | |||
| -rw-r--r-- | localrepo/lsp-ui-20240424.412.tar (renamed from localrepo/lsp-ui-20240423.1111.tar) | bin | 163840 -> 163840 bytes | |||
| -rw-r--r-- | localrepo/pdf-tools-1.1.0.tar | bin | 6400000 -> 6400000 bytes | |||
| -rw-r--r-- | localrepo/vterm-20240325.1551.tar | bin | 522240 -> 532480 bytes | |||
| -rw-r--r-- | localrepo/which-key-3.6.0.tar | bin | 645120 -> 675840 bytes | |||
| -rw-r--r-- | localrepo/ztree-1.0.6.tar | bin | 143360 -> 143360 bytes | |||
| -rw-r--r-- | modules/elfeed-config.el | 3 | ||||
| -rw-r--r-- | modules/org-babel-config.el | 189 | ||||
| -rw-r--r-- | modules/org-capture-config.el | 103 | ||||
| -rw-r--r-- | modules/org-contacts-config.el | 11 | ||||
| -rw-r--r-- | modules/org-drill-config.el | 46 | ||||
| -rw-r--r-- | modules/org-export-config.el | 39 | ||||
| -rw-r--r-- | modules/org-refile-config.el | 118 |
19 files changed, 302 insertions, 249 deletions
@@ -704,18 +704,7 @@ This is the result of overriding that function in cj/invincible-buffers in syste *** DONE [#C] Bookmark-save-flag Replaces Bookmark-set-and-save CLOSED: [2024-04-03 Wed 15:00] remove cj/bookmark-set-and-save if setting bookmark-save-flat to 1 saves when adding/modifying a bookmark -** DOING Open v0.7 Fit and Finish (ends 2024.04.20) [1/6] -*** DOING [#B] Modularize all org-mode config files into use-package statements -- [X] org-config -- [X] org-agenda -- [ ] org-roam -- [ ] org-appearance -- [ ] org-babel -- [ ] org-capture -- [ ] org-refile -- [ ] org-contacts -- [ ] org-drill -- [ ] org-export +** DOING Open v0.7 Fit and Finish (ends 2024.04.20) [1/5] *** DOING [#B] Save All Attachments Working in Mu4e **** 2024-04-18 Thu @ 05:55:32 -0500 The Documentation Suggests A Path Forward This suggests that if I'm writing another function, I should @@ -1163,8 +1152,23 @@ Now mapped to C-S-t at the bottom of org-capture-config.el ***** 2024-04-18 Thu @ 20:31:44 -0500 Issue It's now failing with org-roam-capture--fill-template: Wrong type argument: char-or-string-p, (expand-file-name (concat roam-dir "/inbox.org")) +**** DONE [#B] Modularize all org-mode config files into use-package statements [10/10] +CLOSED: [2024-04-25 Thu 14:15] +:LOGBOOK: +- State "DONE" from "DOING" [2024-04-25 Thu 14:15] +:END: +- [X] org-config +- [X] org-agenda +- [X] org-roam +- [X] org-appearance +- [X] org-babel +- [X] org-capture +- [X] org-refile +- [X] org-contacts +- [X] org-drill +- [X] org-export ** DOING Complete v0.7 Release Checklist [8/11] -*** DOING 2 Week Fit and Finish (ends 2024.04.18) +*** DOING Fit and Finish Period *** TODO Clean Launch from Archsetup *** TODO Close Release and Create Tag on Repo *** DONE No Open Work diff --git a/assets/abbrev_defs b/assets/abbrev_defs index 1fe4aa02..2c8d0cdb 100644 --- a/assets/abbrev_defs +++ b/assets/abbrev_defs @@ -300,10 +300,10 @@ ("supplment" "supplement" nil :count 0) ("suprise" "surprise" nil :count 0) ("surprize" "surprise" nil :count 0) - ("takss" "tasks" nil :count 1) + ("takss" "tasks" nil :count 2) ("talekd" "talked" nil :count 0) ("talkign" "talking" nil :count 5) - ("teh" "the" nil :count 61) + ("teh" "the" nil :count 62) ("tehir" "their" nil :count 3) ("tehre" "there" nil :count 2) ("thansk" "thanks" nil :count 2) diff --git a/localrepo/archive-contents b/localrepo/archive-contents index 214e1c54..54054c71 100644 --- a/localrepo/archive-contents +++ b/localrepo/archive-contents @@ -60,13 +60,15 @@ (flyspell-correct-ivy . [(20220520 630) ((flyspell-correct (0 6 1)) (ivy (0 8 0)) (emacs (24 4))) "Correcting words with flyspell via ivy interface" tar]) (fontaine . [(2 0 0) ((emacs (29 1))) "Set font configurations using presets" tar]) (free-keys . [(1 0) ((cl-lib (0 3))) "Show free keybindings for modkeys or prefixes" tar]) + (geiser . [(0 30) ((emacs (27 1)) (project (0 8 1))) "GNU Emacs and Scheme talk to each other" tar]) + (geiser-guile . [(0 28 1) ((emacs (25 1)) (transient (0 3)) (geiser (0 28 1))) "Guile and Geiser talk to each other" tar]) (git-commit . [(3 3 0) ((emacs (25 1)) (dash (2 19 1)) (transient (0 3 6)) (with-editor (3 0 5))) "Edit Git commit messages" tar]) - (git-gutter . [(20220922 256) ((emacs (25 1))) "Port of Sublime Text plugin GitGutter" tar]) + (git-gutter . [(20240425 647) ((emacs (25 1))) "Port of Sublime Text plugin GitGutter" tar]) (git-timemachine . [(20240413 909) ((emacs (24 3)) (transient (0 1 0))) "Walk through git revisions of a file" tar]) (github-dark-vscode-theme . [(20231011 2034) ((emacs (24 1))) "The GitHub Dark Theme from Visual Studio Code" tar]) (gntp . [(20141025 250) nil "Growl Notification Protocol for Emacs" tar]) (go-mode . [(1 6 0) ((emacs (26 1))) "Major mode for the Go programming language" tar]) - (gptel . [(20240422 1939) ((emacs (27 1)) (transient (0 4 0)) (compat (29 1 4 1))) "Interact with ChatGPT or other LLMs" tar]) + (gptel . [(20240424 2306) ((emacs (27 1)) (transient (0 4 0)) (compat (29 1 4 1))) "Interact with ChatGPT or other LLMs" tar]) (graphql . [(0 1 2) ((emacs (25))) "GraphQL utilities" tar]) (graphviz-dot-mode . [(20230325 1050) ((emacs (25 0))) "Mode for the dot-language used by graphviz (att)." tar]) (helpful . [(20231028 516) ((emacs (25)) (dash (2 18 0)) (s (1 11 0)) (f (0 20 0)) (elisp-refs (1 2))) "A better *help* buffer" tar]) @@ -89,7 +91,7 @@ (ligature . [(20220808 1225) ((emacs (28))) "Display typographical ligatures in major modes" tar]) (log4e . [(20240123 1313) nil "provide logging framework for elisp" tar]) (lsp-mode . [(20240422 334) ((emacs (27 1)) (dash (2 18 0)) (f (0 20 0)) (ht (2 3)) (spinner (1 7 3)) (markdown-mode (2 3)) (lv (0)) (eldoc (1 11))) "LSP mode" tar]) - (lsp-ui . [(20240423 1111) ((emacs (27 1)) (dash (2 18 0)) (lsp-mode (6 0)) (markdown-mode (2 3))) "UI modules for lsp-mode" tar]) + (lsp-ui . [(20240424 412) ((emacs (27 1)) (dash (2 18 0)) (lsp-mode (6 0)) (markdown-mode (2 3))) "UI modules for lsp-mode" tar]) (lv . [(0 15 0) nil "Other echo area" tar]) (madhat2r-theme . [(20170203 30) ((emacs (24))) "dark color theme that is easy on the eyes" tar]) (magit . [(3 3 0) ((emacs (25 1)) (dash (2 19 1)) (git-commit (3 3 0)) (magit-section (3 3 0)) (transient (0 3 6)) (with-editor (3 0 5))) "A Git porcelain inside Emacs" tar]) diff --git a/localrepo/geiser-0.30.tar b/localrepo/geiser-0.30.tar Binary files differnew file mode 100644 index 00000000..39290429 --- /dev/null +++ b/localrepo/geiser-0.30.tar diff --git a/localrepo/geiser-guile-0.28.1.tar b/localrepo/geiser-guile-0.28.1.tar Binary files differnew file mode 100644 index 00000000..ee64911b --- /dev/null +++ b/localrepo/geiser-guile-0.28.1.tar diff --git a/localrepo/git-gutter-20220922.256.tar b/localrepo/git-gutter-20240425.647.tar Binary files differindex 735971d7..4407f874 100644 --- a/localrepo/git-gutter-20220922.256.tar +++ b/localrepo/git-gutter-20240425.647.tar diff --git a/localrepo/gptel-20240422.1939.tar b/localrepo/gptel-20240424.2306.tar Binary files differindex 0d0c6c9c..a80a6757 100644 --- a/localrepo/gptel-20240422.1939.tar +++ b/localrepo/gptel-20240424.2306.tar diff --git a/localrepo/lsp-ui-20240423.1111.tar b/localrepo/lsp-ui-20240424.412.tar Binary files differindex 6ddb2943..bbd03254 100644 --- a/localrepo/lsp-ui-20240423.1111.tar +++ b/localrepo/lsp-ui-20240424.412.tar diff --git a/localrepo/pdf-tools-1.1.0.tar b/localrepo/pdf-tools-1.1.0.tar Binary files differindex f1e7e9cf..fa7e0768 100644 --- a/localrepo/pdf-tools-1.1.0.tar +++ b/localrepo/pdf-tools-1.1.0.tar diff --git a/localrepo/vterm-20240325.1551.tar b/localrepo/vterm-20240325.1551.tar Binary files differindex 1676052b..5ab9a983 100644 --- a/localrepo/vterm-20240325.1551.tar +++ b/localrepo/vterm-20240325.1551.tar diff --git a/localrepo/which-key-3.6.0.tar b/localrepo/which-key-3.6.0.tar Binary files differindex 26aed842..34b8ed9c 100644 --- a/localrepo/which-key-3.6.0.tar +++ b/localrepo/which-key-3.6.0.tar diff --git a/localrepo/ztree-1.0.6.tar b/localrepo/ztree-1.0.6.tar Binary files differindex b6e5b0d7..84a99656 100644 --- a/localrepo/ztree-1.0.6.tar +++ b/localrepo/ztree-1.0.6.tar diff --git a/modules/elfeed-config.el b/modules/elfeed-config.el index 901ae0b1..4d4a80d1 100644 --- a/modules/elfeed-config.el +++ b/modules/elfeed-config.el @@ -15,7 +15,8 @@ ("w" . cj/elfeed-eww-open) ;; opens in eww ("b" . cj/elfeed-browser-open) ;; opens in external browser ("d" . cj/elfeed-youtube-dl) ;; async download with yt-dlp and tsp - ("p" . cj/play-with-mpv) ;; async play with mpv + ("p" . cj/play-with-mpv) ;; async play with mpv + ("v" . cj/play-with-mpv) ;; async play with mpv ("R" . cj/elfeed-mark-all-as-read) ;; capital marks all as read, since upper case marks one as read ("U" . cj/elfeed-mark-all-as-unread)) ;; capital marks all as unread, since lower case marks one as unread :config diff --git a/modules/org-babel-config.el b/modules/org-babel-config.el index dfb9ca14..01b1e5a1 100644 --- a/modules/org-babel-config.el +++ b/modules/org-babel-config.el @@ -5,84 +5,133 @@ ;;; Code: -(with-eval-after-load 'org - (require 'ob-core) - - ;; ------------------- Babel Execution Confirmation Toggle ------------------- - ;; org-babel verifies before each execution - - (defun babel-confirm (flag) - "Report the setting of org-confirm-babel-evaluate. - If invoked with C-u, toggle the setting." - (interactive "P") - (if (equal flag '(4)) - (setq org-confirm-babel-evaluate (not org-confirm-babel-evaluate))) - (message "Babel evaluation confirmation is %s" - (if org-confirm-babel-evaluate "on" "off"))) - - ;; ---------------------------- Org Babel Languages ---------------------------- - ;; create executable code blocks in a language within org-mode - - ;; (org-babel-do-load-languages - ;; 'org-babel-load-languages - ;; '((shell . t))) - - (use-package ob-python - :ensure nil ;; built-in - :defer .5 - :after org-contrib - :commands (org-babel-execute:python)) - - (use-package ob-emacs-lisp - :ensure nil ;; built-in - :defer .5 - :commands - (org-babel-execute:emacs-lisp - org-babel-expand-body:emacs-lisp)) - - (use-package ob-dot - :ensure nil ;; built-in - :defer .5 - :commands - (org-babel-execute:dot - org-babel-expand-body:dot) - :config - ;; https://stackoverflow.com/questions/16770868/org-babel-doesnt-load-graphviz-editing-mode-for-dot-sources - (add-to-list 'org-src-lang-modes (quote ("dot" . graphviz-dot)))) - - ;; --------------------------------- Org-Tempo --------------------------------- - ;; expands snippets to babel code blocks using templates - - (use-package org-tempo - :defer .5 - :ensure nil ;; built-in - :after org - :config - (add-to-list 'org-structure-template-alist '("awk" . "src awk")) - (add-to-list 'org-structure-template-alist '("bash" . "src bash")) - (add-to-list 'org-structure-template-alist '("dot" . "src dot :file temp.png :cmdline -Kdot -Tpng")) - (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) - (add-to-list 'org-structure-template-alist '("json" . "src json")) - (add-to-list 'org-structure-template-alist '("latex" . "src latex")) - (add-to-list 'org-structure-template-alist '("sicp" . "src racket :lang sicp")) - (add-to-list 'org-structure-template-alist '("py" . "src python")) - (add-to-list 'org-structure-template-alist '("sh" . "src sh")) - (add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))) - - ;; ---------------------------- Org Babel Settings --------------------------- - ;; general org babel settings - +;; ------------------------------- Org Babel Core ------------------------------ +;; general org babel settings + +(use-package ob-core + :ensure nil ;; built-in + :after org + :defer .5 + :hook + (org-babel-after-execute-hook . org-redisplay-inline-images) ;; for seeing inline dotgraph images + :config (setq org-src-fontify-natively t) ;; fontify the code in blocks (setq org-src-tab-acts-natively t) ;; tabs act like in language major mode buffer (setq org-src-window-setup 'current-window) ;; don't split window when source editing wih C-c ' (setq org-confirm-babel-evaluate nil) ;; just evaluate the source code (setq org-babel-default-header-args (cons '(:tangle . "yes") - (assq-delete-all :tangle org-babel-default-header-args))) ;; default header args for babel - (add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images) ;; for seeing inline dotgraph images + (assq-delete-all :tangle org-babel-default-header-args)))) ;; default header args for babel + - ) ;; end with-eval-after-load +;; ------------------- Babel Execution Confirmation Toggle ------------------- +;; org-babel verifies before each execution +(defun babel-confirm (flag) + "Report the setting of org-confirm-babel-evaluate. + If invoked with C-u, toggle the setting." + (interactive "P") + (if (equal flag '(4)) + (setq org-confirm-babel-evaluate (not org-confirm-babel-evaluate))) + (message "Babel evaluation confirmation is %s" + (if org-confirm-babel-evaluate "on" "off"))) + + +;; ---------------------------- Org Babel Languages ---------------------------- +;; create executable code blocks in a language within org-mode + +(use-package ob-awk + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands + (org-babel-execute:awk + org-babel-expand-body:awk)) + +(use-package ob-dot + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands + (org-babel-execute:dot + org-babel-expand-body:dot) + :config + ;; https://stackoverflow.com/questions/16770868/org-babel-doesnt-load-graphviz-editing-mode-for-dot-sources + (add-to-list 'org-src-lang-modes (quote ("dot" . graphviz-dot)))) + +(use-package ob-emacs-lisp + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands + (org-babel-execute:emacs-lisp + org-babel-expand-body:emacs-lisp)) + +(use-package ob-latex + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands + (org-babel-execute:latex + org-babel-expand-body:latex)) + +(use-package ob-python + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands + (org-babel-execute:python + org-babel-variable-assignments:python + org-babel-load-session:python + org-babel-prep-session:python)) + +(use-package ob-scheme + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands + (org-babel-execute:scheme + org-babel-expand-body:scheme)) + +;; allows for shell, bash, and fish +(use-package ob-shell + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands + (org-babel-execute:shell + org-babel-prep-session:shell + org-babel-load-session:shell + org-babel-variable-assignments:shell)) + +(use-package ob-sed + :ensure nil ;; built-in + :defer .5 + :after ob-core + :commands (org-babel-execute:sed)) + +;; --------------------------------- Org-Tempo --------------------------------- +;; expands snippets to babel code blocks using templates + +(use-package org-tempo + :defer .5 + :ensure nil ;; built-in + :after ob-core + :config + (add-to-list 'org-structure-template-alist '("awk" . "src awk")) + (add-to-list 'org-structure-template-alist '("sed" . "src sed")) + (add-to-list 'org-structure-template-alist '("bash" . "src bash")) + (add-to-list 'org-structure-template-alist '("dot" . "src dot :file temp.png :cmdline -Kdot -Tpng")) + (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) + (add-to-list 'org-structure-template-alist '("json" . "src json")) + (add-to-list 'org-structure-template-alist '("latex" . "src latex")) + (add-to-list 'org-structure-template-alist '("py" . "src python")) + (add-to-list 'org-structure-template-alist '("scheme" . "src scheme")) + (add-to-list 'org-structure-template-alist '("shell" . "src shell")) + (add-to-list 'org-structure-template-alist '("yaml" . "src yaml"))) + +;; requires ob-racket, not yet in repositories +;; (add-to-list 'org-structure-template-alist '("sicp" . "src racket :lang sicp")) (provide 'org-babel-config) ;;; org-babel-config.el ends here. diff --git a/modules/org-capture-config.el b/modules/org-capture-config.el index 4fa7af41..469abf52 100644 --- a/modules/org-capture-config.el +++ b/modules/org-capture-config.el @@ -11,14 +11,12 @@ ;;; Code: -(with-eval-after-load 'org +;; ---------------------- Org-Webpage-Clipper ---------------------- +;; Saves a copy of the page eww is visiting in the 'articles'-file for offline +;; reading. In other words, it's a "Poor Man's Pocket/Instapaper" - ;; ---------------------- Org-Webpage-Clipper ---------------------- - ;; Saves a copy of the page eww is visiting in the 'articles'-file for offline - ;; reading. In other words, it's a "Poor Man's Pocket/Instapaper" - - (defun cj/org-webpage-clipper () - "Capture a web page for later viewing in an org-file. +(defun cj/org-webpage-clipper () + "Capture a web page for later viewing in an org-file. Encodes all links and marks that may interfere with org mode display, then inserts the content into a file for later offline use. This is meant to be used in coordination with an org-capture-template. @@ -29,52 +27,57 @@ Example Template: (\"w\" \"Website\" plain (function cj/org-webpage-clipper) \"* %a\\nArticle Link: %L\\nCaptured On: %U\\n\\n\" :immediate-finish t) '@" - (interactive) - - ;; Ensure valid major mode before encoding - (cond - ((eq major-mode 'w3m-mode) - (org-w3m-copy-for-org-mode)) - ((eq major-mode 'eww-mode) - (org-eww-copy-for-org-mode)) - (t - (error "Not valid -- must be in w3m or eww mode"))) - - ;; Check for full path to the archive file. Create missing directories. - (unless (file-exists-p article-file) - (let ((dir (file-name-directory article-file))) - (unless (file-exists-p dir) - (make-directory dir)))) - - ;; Move to end of file and insert blank line for org-capture to add timestamp, etc. - (find-file article-file) - (goto-char (point-max)) - (insert "\n\n\n\n\n") - - ;; Insert the web content keeping our place. - (save-excursion (yank)) - - ;; Remove page info from kill ring. Also, fix the yank pointer. - (setq kill-ring (cdr kill-ring)) - (setq kill-ring-yank-pointer kill-ring) - - ;; Final repositioning. - (forward-line -1)) + (interactive) + + ;; Ensure valid major mode before encoding + (cond + ((eq major-mode 'w3m-mode) + (org-w3m-copy-for-org-mode)) + ((eq major-mode 'eww-mode) + (org-eww-copy-for-org-mode)) + (t + (error "Not valid -- must be in w3m or eww mode"))) + + ;; Check for full path to the archive file. Create missing directories. + (unless (file-exists-p article-file) + (let ((dir (file-name-directory article-file))) + (unless (file-exists-p dir) + (make-directory dir)))) + + ;; Move to end of file and insert blank line for org-capture to add timestamp, etc. + (find-file article-file) + (goto-char (point-max)) + (insert "\n\n\n\n\n") + + ;; Insert the web content keeping our place. + (save-excursion (yank)) + + ;; Remove page info from kill ring. Also, fix the yank pointer. + (setq kill-ring (cdr kill-ring)) + (setq kill-ring-yank-pointer kill-ring) + + ;; Final repositioning. + (forward-line -1)) ;;;; --------------------------------- Functions ------------------------------- - (defun org-capture-pdf-active-region () - "Capture the active region of the pdf-view buffer. +(defun cj/org-capture-pdf-active-region () + "Capture the active region of the pdf-view buffer. Intended to be called within an org capture template." - (let* ((pdf-buf-name (plist-get org-capture-plist :original-buffer)) - (pdf-buf (get-buffer pdf-buf-name))) - (if (buffer-live-p pdf-buf) - (with-current-buffer pdf-buf - (car (pdf-view-active-region-text))) - (user-error "Buffer %S not alive" pdf-buf-name)))) + (let* ((pdf-buf-name (plist-get org-capture-plist :original-buffer)) + (pdf-buf (get-buffer pdf-buf-name))) + (if (buffer-live-p pdf-buf) + (with-current-buffer pdf-buf + (car (pdf-view-active-region-text))) + (user-error "Buffer %S not alive" pdf-buf-name)))) ;;;; --------------------------- Org-Capture Templates ------------------------- +(use-package org-protocol + :ensure nil ;; built-in + :defer .5 + :after org + :config ;; ORG-CAPTURE TEMPLATES (setq org-protocol-default-template-key "L") (setq org-capture-templates @@ -90,9 +93,10 @@ Intended to be called within an org capture template." Source: [[%:link][%(buffer-name (org-capture-get :original-buffer))]] Captured On: %U" :prepend t) + ;; requires cj/org-capture-pdf-active-region function defined above ("P" "PDF Text" entry (file+headline inbox-file "Inbox") "* %? -#+BEGIN_QUOTE\n%(org-capture-pdf-active-region)\n#+END_QUOTE +#+BEGIN_QUOTE\n%(cj/org-capture-pdf-active-region)\n#+END_QUOTE Source:[[%L][%(buffer-name (org-capture-get :original-buffer))]] Captured On: %U" :prepend t) @@ -119,11 +123,10 @@ Captured On: %U" ("s" "Shopping List Entry" entry (file+headline inbox-file "Shopping List") "* %?") + ;; requires cj/org-web-clipper function defined above ("w" "Web Page Clipper" plain (function cj/org-webpage-clipper) - "* %a\nArticle Link: %L\nCaptured On: %U\n\n" :immediate-finish t))) - - ) ;; end with-eval-after-load 'org + "* %a\nArticle Link: %L\nCaptured On: %U\n\n" :immediate-finish t)))) ;; ---------------------------- Simple Task Capture ---------------------------- ;; the simplest way to capture a task. Also a simple way to write this function. diff --git a/modules/org-contacts-config.el b/modules/org-contacts-config.el index 489d7a33..676b901d 100644 --- a/modules/org-contacts-config.el +++ b/modules/org-contacts-config.el @@ -1,13 +1,13 @@ ;;; org-contacts-config.el --- Org Contacts Customizations -*- lexical-binding: t; -*- ;;; Commentary: -;; +;; Configuration for Org Contacts. ;;; Code: (use-package org-contacts - :after (org org-contrib mu4e) - :defer 1 + :after (org mu4e) + :defer .5 :bind ("C-z C" . org-contacts) ; starts contacts search :config (setq org-contacts-files (cons contacts-file '())) @@ -16,15 +16,12 @@ '("c" "Contact" entry (file+headline contacts-file "Contacts") "*%?\n:PROPERTIES:\n:ADDRESS: \n:PHONE: \n:EMAIL: \n:BIRTHDAY: \n:NOTES: \n:END:" :prepend t)) - (setq mu4e-contacts-file contacts-file) (add-to-list 'mu4e-headers-actions '("add contact" . mu4e-action-add-org-contact)) (add-to-list 'mu4e-view-actions - '("add contact" . mu4e-action-add-org-contact)) - (add-to-list 'mu4e-view-actions - '("download attachments" . cj/mu4e-view-save-attachments))) + '("add contact" . mu4e-action-add-org-contact))) (provide 'org-contacts-config) ;;; org-contacts-config.el ends here. diff --git a/modules/org-drill-config.el b/modules/org-drill-config.el index be0256d3..1a42cdfa 100644 --- a/modules/org-drill-config.el +++ b/modules/org-drill-config.el @@ -10,16 +10,17 @@ ;; create a new bookmark and add "Drill Entry" to the name field and the above ;; snippet to the URL field. -;; ----------------------------------- Tasks ----------------------------------- - ;;; Code: +;; --------------------------------- Org Drill --------------------------------- + (use-package org-drill :after org :preface ;; create an org-drill-map so you can use C-d as prefix (define-prefix-command 'org-drill-map) (global-set-key (kbd "C-d") 'org-drill-map) + :bind (:map org-drill-map ("s" . cj/drill-start) @@ -37,32 +38,33 @@ (setq org-drill-add-random-noise-to-intervals-p t) ;; slightly vary number of days to repetition (defun cj/drill-start () - "Prompt user to pick a drill org file, then starts an org-drill session." - (interactive) - (let ((choices (directory-files drill-dir nil "^[^.].*\\.org$"))) - (setq chosen-drill-file (completing-read "Choose Flashcard File:" choices)) - (find-file (concat drill-dir chosen-drill-file)) - (require 'org-drill) - (org-drill))) + "Prompt user to pick a drill org file, then start an org-drill session." + (interactive) + (let* ((choices (directory-files drill-dir nil "^[^.].*\\.org$")) + (chosen-drill-file (completing-read "Choose Flashcard File:" choices))) + (find-file (concat drill-dir chosen-drill-file)) + (require 'cl) ;; for the first function + (org-drill))) (defun cj/drill-edit () - "Prompts the user to pick a drill org file, then opens it for editing." - (interactive) - (let* ((choices drill-dir) - (chosen-drill-file (completing-read "Choose Flashcards to Edit:" choices))) - (find-file chosen-drill-file))) + "Prompts the user to pick a drill org file, then opens it for editing." + (interactive) + (let* ((choices drill-dir) + (chosen-drill-file (completing-read "Choose Flashcards to Edit:" choices))) + (find-file chosen-drill-file))) (defun cj/drill-capture () - "Quickly capture a drill question." - (interactive) - (org-capture nil "d")) + "Quickly capture a drill question." + (interactive) + (org-capture nil "d")) (defun cj/drill-refile () - "Refile to a drill file." - (interactive) - (setq org-refile-targets '((nil :maxlevel . 1) - (drill-dir :maxlevel . 1))) - (call-interactively 'org-refile)) + "Refile to a drill file." + (interactive) + (setq org-refile-targets '((nil :maxlevel . 1) + (drill-dir :maxlevel . 1))) + (call-interactively 'org-refile)) + ;; add useful org drill capture templates (require 'custom-functions) diff --git a/modules/org-export-config.el b/modules/org-export-config.el index befb4361..4f7db412 100644 --- a/modules/org-export-config.el +++ b/modules/org-export-config.el @@ -4,25 +4,13 @@ ;;; Code: -;;;; ------------------------- Org-Exporting ------------------------- +;; --------------------------------- Org Export -------------------------------- +;; backends for exporting from org-mode -(with-eval-after-load 'org - - ;; markdown - (use-package ox-md - :ensure nil ;; built-in - :after ox) - - ;; hugo markdown - (use-package ox-hugo - :after ox) - - ;; beamer presentations - (use-package ox-beamer - :ensure nil ;; built-in - :after ox) - - ;; ORG EXPORT +(use-package ox + :ensure nil + :after org + :config (setq org-export-coding-system 'utf-8) ;; force utf-8 in org (setq org-export-headline-levels 6) ;; export headlines 6 levels deep (setq org-export-initial-scope 'subtree) ;; export the current subtree by default @@ -30,10 +18,21 @@ (setq org-export-with-section-numbers nil) ;; export without section numbers by default (setq org-export-with-tags nil) ;; export without tags by default (setq org-export-with-tasks nil) ;; export without tasks by default - (setq org-export-with-toc nil) ;; export without table of contents by default + (setq org-export-with-toc nil)) ;; export without table of contents by default + +;; markdown +(use-package ox-md + :ensure nil ;; built-in + :after ox) - ) ;; end with-eval-after-load +;; hugo markdown +(use-package ox-hugo + :after ox) +;; beamer presentations +(use-package ox-beamer + :ensure nil ;; built-in + :after ox) (provide 'org-export-config) ;;; org-export-config.el ends here. diff --git a/modules/org-refile-config.el b/modules/org-refile-config.el index 3f71d91d..f36af000 100644 --- a/modules/org-refile-config.el +++ b/modules/org-refile-config.el @@ -1,81 +1,77 @@ ;;; org-refile-config.el --- Org Refile Customizations -*- lexical-binding: t; -*- ;;; Commentary: -;; +;; Configuration and custom functions for org-mode refiling. ;;; Code: -(use-package org-refile - :ensure nil ;; built-in - :defer .5 - :bind - (:map org-mode-map - ("C-c C-w" . cj/org-refile) - ("C-c w" . cj/org-refile-in-file)) - :config - - ;; ----------------------------- Org Refile Targets ---------------------------- - ;; sets refile targets - ;; - adds project files in org-roam to the refile targets - ;; - adds todo.org files in subdirectories of the code and project directories - - (defun cj/build-org-refile-targets() - "Build org-refile-targets." - (interactive) - (let (new-files) - ;; Start with the inbox and the schedule files. - (setq new-files `((,inbox-file . (:maxlevel . 1)) (,schedule-file . (:maxlevel . 1)))) - - ;; Extend new-files with the project and topic files. - (let ((project-and-topic-files (append (cj/org-roam-list-notes-by-tag "Project") - (cj/org-roam-list-notes-by-tag "Topic")))) +;; ----------------------------- Org Refile Targets ---------------------------- +;; sets refile targets +;; - adds project files in org-roam to the refile targets +;; - adds todo.org files in subdirectories of the code and project directories + +(defun cj/build-org-refile-targets() + "Build org-refile-targets." + (interactive) + (let (new-files) + ;; Start with the inbox and the schedule files. + (setq new-files `((,inbox-file . (:maxlevel . 1)) (,schedule-file . (:maxlevel . 1)))) + + ;; Extend new-files with the project and topic files. + (let ((project-and-topic-files (append (cj/org-roam-list-notes-by-tag "Project") + (cj/org-roam-list-notes-by-tag "Topic")))) + (let ((file-rule `(:level . 1))) + (dolist (file project-and-topic-files) + (unless (assoc file new-files) + (push `(,file . ,file-rule) new-files))))) + + ;; Extend new-files with todo.org files in the specified directories. + (dolist (dir (list user-emacs-directory code-dir projects-dir)) + (let ((todo-files (directory-files-recursively dir "^[Tt][Oo][Dd][Oo]\\.[Oo][Rr][Gg]$"))) (let ((file-rule `(:level . 1))) - (dolist (file project-and-topic-files) + (dolist (file todo-files) (unless (assoc file new-files) - (push `(,file . ,file-rule) new-files))))) - - ;; Extend new-files with todo.org files in the specified directories. - (dolist (dir (list user-emacs-directory code-dir projects-dir)) - (let ((todo-files (directory-files-recursively dir "^[Tt][Oo][Dd][Oo]\\.[Oo][Rr][Gg]$"))) - (let ((file-rule `(:level . 1))) - (dolist (file todo-files) - (unless (assoc file new-files) - (push `(,file . ,file-rule) new-files)))))) + (push `(,file . ,file-rule) new-files)))))) - ;; Set org-refile-targets. - (setq org-refile-targets (nreverse new-files)))) + ;; Set org-refile-targets. + (setq org-refile-targets (nreverse new-files)))) - ;; -------------------------------- Org-Refile ------------------------------- - ;; used in place of org-refile to ensure the refile targets are rebuilt. +;; -------------------------------- Org-Refile ------------------------------- +;; used in place of org-refile to ensure the refile targets are rebuilt. - (defun cj/org-refile (&optional ARG DEFAULT-BUFFER RFLOC MSG) - "Simply rebuilds the refile targets before calling org-refile. +(defun cj/org-refile (&optional ARG DEFAULT-BUFFER RFLOC MSG) + "Simply rebuilds the refile targets before calling org-refile. ARG DEFAULT-BUFFER RFLOC and MSG parameters passed to org-refile." - (interactive "P") - (cj/build-org-refile-targets) - (org-refile ARG DEFAULT-BUFFER RFLOC MSG)) + (interactive "P") + (cj/build-org-refile-targets) + (org-refile ARG DEFAULT-BUFFER RFLOC MSG)) - ;; ----------------------------- Org Refile In File ---------------------------- - ;; convenience function for scoping the refile candidates to the current buffer. +;; ----------------------------- Org Refile In File ---------------------------- +;; convenience function for scoping the refile candidates to the current buffer. - (defun cj/org-refile-in-file () - "Refile to a target within the current file and save the buffer." - (interactive) - (let ((org-refile-targets `(((,(buffer-file-name)) :maxlevel . 6)))) - (call-interactively 'org-refile) - (save-buffer))) +(defun cj/org-refile-in-file () + "Refile to a target within the current file and save the buffer." + (interactive) + (let ((org-refile-targets `(((,(buffer-file-name)) :maxlevel . 6)))) + (call-interactively 'org-refile) + (save-buffer))) - ) ; end use-package statement - - -;; ----------------------- Save Org Files After Refile ----------------------- -;; advice that saves all open org buffers after a refile is complete - -(advice-add 'org-refile :after - (lambda (&rest _) - (org-save-all-org-buffers))) +;; --------------------------------- Org Refile -------------------------------- +;; +(use-package org-refile + :ensure nil ;; built-in + :defer .5 + :bind + (:map org-mode-map + ("C-c C-w" . cj/org-refile) + ("C-c w" . cj/org-refile-in-file)) + :config + ;; save all open org buffers after a refile is complete + (advice-add 'org-refile :after + (lambda (&rest _) + (org-save-all-org-buffers)))) (provide 'org-refile-config) ;;; org-refile-config.el ends here. |
