Refactoring of orgmode, GPT, the remaining configuration header.

This commit is contained in:
James Patrick 2024-02-03 21:14:41 -05:00 committed by James Patrick
parent eae7b32b23
commit d093b969f5
2 changed files with 67 additions and 59 deletions

View File

@ -36,8 +36,7 @@
(setq which-key-idle-delay 0.1) (setq which-key-idle-delay 0.1)
(add-to-list 'auto-mode-alist '("/\\(tmp\\|private/var\\)/.*/tmp_.*.greenfiling.com.*\\.txt" . markdown-mode)) (add-to-list 'auto-mode-alist '("/\\(tmp\\|private/var\\)/.*/tmp_.*\\.txt" . markdown-mode))
(add-to-list 'auto-mode-alist '("/\\(tmp\\|private/var\\)/.*/tmp_.*.github.com.*\\.txt" . markdown-mode))
(load! "+orgmode") (load! "+orgmode")

View File

@ -1,4 +1,5 @@
#+title: Doom Emacs Configuration #+title: Doom Emacs Configuration
#+AUTHOR: James Patrick
#+SETUPFILE: ./dist/setup.org #+SETUPFILE: ./dist/setup.org
I'll fill out the how and why of this all as I figure out what the hell I'm doing. My current Emacs Configuration is a mess of copy and pasted snippet loosely grouped together. There's a fair number of work around, to transient configuration issues that now no longer exist, and more of stuff cribbed off StackOverflow & held together with string & bubble gum. While not yet calling Configuration Bankrupt's, I am going to try to see if I can restructure this technical debt. I'll fill out the how and why of this all as I figure out what the hell I'm doing. My current Emacs Configuration is a mess of copy and pasted snippet loosely grouped together. There's a fair number of work around, to transient configuration issues that now no longer exist, and more of stuff cribbed off StackOverflow & held together with string & bubble gum. While not yet calling Configuration Bankrupt's, I am going to try to see if I can restructure this technical debt.
@ -387,7 +388,7 @@ tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp ;;upload ; map local to remote projects via ssh/ftp
#+end_src #+end_src
NOTE: =:leader r= is currently being used by roam. See [[id:f9ffe9df-a417-45c4-8bf2-6ee655140648][Roam Keybinds]]. This conflicts with the =upload= module. If you wish to use this module in the future you will need to updated one of the keybinds to not conflict. NOTE: =:leader r= is currently being used by roam. See [[*Keybinds][Roam Keybinds]]. This conflicts with the =upload= module. If you wish to use this module in the future you will need to updated one of the keybinds to not conflict.
*** Magit Forge Support *** Magit Forge Support
For use with Github this requires the creation of a Github Token (see [[https://github.com/settings/tokens][here]]). This will need to be appended to your =~/.authinfo.gpg= file using the format below[fn:2]. For use with Github this requires the creation of a Github Token (see [[https://github.com/settings/tokens][here]]). This will need to be appended to your =~/.authinfo.gpg= file using the format below[fn:2].
@ -522,7 +523,6 @@ literate
#+end_src #+end_src
* General UI Tweaks * General UI Tweaks
** Window Titlebar ** Window Titlebar
The titlebar display string will display =♢= if there exist unsaved buffer modifications & =♦= otherwise. The titlebar display string will display =♢= if there exist unsaved buffer modifications & =♦= otherwise.
@ -594,48 +594,32 @@ Lets set the local leader to =,=. We may want to remap this to =;= later. Both o
(setq which-key-idle-delay 0.1) (setq which-key-idle-delay 0.1)
#+end_src #+end_src
** Roam Keybinds
:PROPERTIES:
:ID: f9ffe9df-a417-45c4-8bf2-6ee655140648
:END:
The standard keybind for getting to Roam's daily capture is pretty long. To capture a Log entry I have to type =SPC n r d T l=. I want to capture as many logs and goals as possible, so lets shorten this up some.
#+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no
(map! :leader
(:when (modulep! :lang org +roam2)
(:prefix-map ("r" . "roam")
:desc "Find node" "/" #'org-roam-node-find
:desc "Capture to node" "n" #'org-roam-capture
:desc "Capture Today" "c" #'org-roam-dailies-capture-today
:desc "Goto Today" "t" #'org-roam-dailies-goto-today
)
)
)
#+end_src
=:leader r= is used by =:tools upload= for "remote", but since I'm not using this lets just not care about that. * Auto-Mode Alist
* Configuration Some files we'll need to set the major-mode for manually. Either based on where the file is located, or its extension. To do this add the value to the =auto-mode-alist= and specify the major mode.
#+begin_src emacs-lisp :tangle no
(add-to-list 'auto-mode-alist '("/path/to/file/.*\\.file" . markdown-mode))
#+end_src
** Tridactyl ** Tridactyl
I am currently using Firefox with [[https://github.com/tridactyl/tridactyl][Tridactyl]]. The =editorcmd= creates a temporary file & opens it with the editor of choice. The domain is included in the temporary file name. We can use this to set the syntax of the file in question. This likely just be markdown. I am currently using Firefox with [[https://github.com/tridactyl/tridactyl][Tridactyl]]. The =editorcmd= creates a temporary file & opens it with the editor of choice. The domain is included in the temporary file name, but its a fair assumption that it will markdown. We can use this to set the syntax of the file in question. This likely just be markdown.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-to-list 'auto-mode-alist '("/\\(tmp\\|private/var\\)/.*/tmp_.*.greenfiling.com.*\\.txt" . markdown-mode)) (add-to-list 'auto-mode-alist '("/\\(tmp\\|private/var\\)/.*/tmp_.*\\.txt" . markdown-mode))
(add-to-list 'auto-mode-alist '("/\\(tmp\\|private/var\\)/.*/tmp_.*.github.com.*\\.txt" . markdown-mode))
#+end_src #+end_src
* Orgmode
** Orgmode
This file will be needed for emacs batch automation, where its not reasonable to start up my entire working env. This file can be located at =$DOOMDIR/+orgmode.el=. This file will be needed for emacs batch automation, where its not reasonable to start up my entire working env. This file can be located at =$DOOMDIR/+orgmode.el=.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(load! "+orgmode") (load! "+orgmode")
#+end_src #+end_src
*** Importing org ** Importing org
This file may get consumed via emacs batch scripting, so we need ot make sure the orgmode is actually loaded. This file may get consumed via emacs batch scripting, so we need ot make sure the orgmode is actually loaded.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(require 'org) (require 'org)
#+end_src #+end_src
*** Directories ** Directories
My notes are stored via [[https://nextcloud.com/][NextCloud]] to sync multiple machines. The Nextcloud directory can be located in a couple different location based off the OS that the machine is running, but where the NextCloud general sync directory may vary based on machine but notes should always be stored at =$HOME/org=. My notes are stored via [[https://nextcloud.com/][NextCloud]] to sync multiple machines. The Nextcloud directory can be located in a couple different location based off the OS that the machine is running, but where the NextCloud general sync directory may vary based on machine but notes should always be stored at =$HOME/org=.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
@ -654,10 +638,10 @@ I've tried to organize things based on purpose & this will likely change in the
└── Work └── Work
#+end_example #+end_example
**** =.archive= *** =.archive=
Where old files go. See =org-archive-subtree= for more. Where old files go. See =org-archive-subtree= for more.
**** =.attach= *** =.attach=
Stuff that is not an orgmode document. Stuff that is not an orgmode document.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
@ -665,23 +649,23 @@ Stuff that is not an orgmode document.
org-download-image-dir (concat org-directory ".attach/")) org-download-image-dir (concat org-directory ".attach/"))
#+end_src #+end_src
**** =Projects= *** =Projects=
I keep a =todo.org= at the root of each project. These are symlinked into the Projects directory. Nextcloud does not sync symlinked documents. I keep a =todo.org= at the root of each project. These are symlinked into the Projects directory. Nextcloud does not sync symlinked documents.
**** =Roam= *** =Roam=
All roam docs go here. This is my default note taking system. All roam docs go here. This is my default note taking system.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq (setq
org-roam-directory (concat org-directory "Roam/")) org-roam-directory (concat org-directory "Roam/"))
#+end_src #+end_src
**** =Todo= *** =Todo=
Another symlink dir. This is used to populate org agenda files. Another symlink dir. This is used to populate org agenda files.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-agenda-files (list (concat org-directory "Todos/" ))) (setq org-agenda-files (list (concat org-directory "Todos/" )))
#+end_src #+end_src
**** =Work= *** =Work=
On my work machine I'll symlink this into my =Todo= On my work machine I'll symlink this into my =Todo=
#+begin_src bash :tangle no #+begin_src bash :tangle no
ln -s $HOME/org/Work/todo.org $HOME/org/Todo/work.org ln -s $HOME/org/Work/todo.org $HOME/org/Todo/work.org
@ -698,19 +682,19 @@ I still want to capture work related notes where ever I am though.
"* [_] %i%?\n%a -  %u" :prepend t)) "* [_] %i%?\n%a -  %u" :prepend t))
#+end_src #+end_src
*** A Prettier Orgmode ** A Prettier Orgmode
**** Use a serif variable font *** Use a serif variable font
This uses =doom-variable-pitch-font= as defined in the font section. This uses =doom-variable-pitch-font= as defined in the font section.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(add-hook! 'org-mode-hook #'mixed-pitch-mode) (add-hook! 'org-mode-hook #'mixed-pitch-mode)
#+end_src #+end_src
**** Pretty mode *** Pretty mode
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(add-hook! 'org-mode-hook #'+org-pretty-mode) (add-hook! 'org-mode-hook #'+org-pretty-mode)
#+end_src #+end_src
**** Agenda faces *** Agenda faces
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-agenda-deadline-faces (setq org-agenda-deadline-faces
'((1.001 . error) '((1.001 . error)
@ -718,7 +702,7 @@ This uses =doom-variable-pitch-font= as defined in the font section.
(0.5 . org-upcoming-deadline) (0.5 . org-upcoming-deadline)
(0.0 . org-upcoming-distant-deadline))) (0.0 . org-upcoming-distant-deadline)))
#+end_src #+end_src
**** Prettify Symbols *** Prettify Symbols
There is a few of these built into the =orgmode='s =+pretty= module. Checkboxes are not included so lets include it. There is a few of these built into the =orgmode='s =+pretty= module. Checkboxes are not included so lets include it.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(add-hook 'org-mode-hook (lambda () (add-hook 'org-mode-hook (lambda ()
@ -735,7 +719,7 @@ And when you hover over it, disable it.
(setq prettify-symbols-unprettify-at-point 'right-edge) (setq prettify-symbols-unprettify-at-point 'right-edge)
#+end_src #+end_src
**** Fancy Source Blocks *** Fancy Source Blocks
This was grabbed from Rasmus Pank's [[https://pank.eu/blog/pretty-babel-src-blocks.html][blog]]. This was grabbed from Rasmus Pank's [[https://pank.eu/blog/pretty-babel-src-blocks.html][blog]].
this makes the beginning / ending of both source and quote blocks, & headers for that display a little cleaner. this makes the beginning / ending of both source and quote blocks, & headers for that display a little cleaner.
@ -832,21 +816,21 @@ this makes the beginning / ending of both source and quote blocks, & headers for
(add-hook 'post-command-hook 'rasmus/org-prettify-src t t)) (add-hook 'post-command-hook 'rasmus/org-prettify-src t t))
(add-hook 'org-mode-hook #'rasmus/org-prettify-symbols)) (add-hook 'org-mode-hook #'rasmus/org-prettify-symbols))
#+end_src #+end_src
*** Drawers ** Drawers
https://orgmode.org/manual/Drawers.html https://orgmode.org/manual/Drawers.html
**** State Change Log *** State Change Log
Logs updates can bleed into the notes. Sticking them in a drawer works as a better escape then indentations. Logs updates can bleed into the notes. Sticking them in a drawer works as a better escape then indentations.
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-log-into-drawer t) (setq org-log-into-drawer t)
#+end_src #+end_src
**** Clock drawers *** Clock drawers
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
(setq org-clock-into-drawer t) (setq org-clock-into-drawer t)
#+end_src #+end_src
*** Roam ** Roam
I use =org-roam= v2 for most of my note taking. TODO expand this section. I use =org-roam= v2 for most of my note taking. TODO expand this section.
**** Dailies Templates *** Dailies Templates
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no :results output silent #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no :results output silent
(setq org-roam-dailies-capture-templates (setq org-roam-dailies-capture-templates
'(("l" "Log" entry "* %T %?" '(("l" "Log" entry "* %T %?"
@ -859,19 +843,33 @@ I use =org-roam= v2 for most of my note taking. TODO expand this section.
("Goals"))))) ("Goals")))))
#+end_src #+end_src
**** Keybinds *** Keybinds
These were declared in [[id:f9ffe9df-a417-45c4-8bf2-6ee655140648][Roam Keybinds]] section above. See there for more details. The standard keybind for getting to Roam's daily capture is pretty long. To capture a Log entry I have to type =SPC n r d T l=. I want to capture as many logs and goals as possible, so lets shorten this up some.
*** Mermaid #+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no
(map! :leader
(:when (modulep! :lang org +roam2)
(:prefix-map ("r" . "roam")
:desc "Find node" "/" #'org-roam-node-find
:desc "Capture to node" "n" #'org-roam-capture
:desc "Capture Today" "c" #'org-roam-dailies-capture-today
:desc "Goto Today" "t" #'org-roam-dailies-goto-today
)
)
)
#+end_src
=:leader r= is used by =:tools upload= for "remote", but since I'm not using this lets just not care about that.
** Mermaid
[[https://mermaid.js.org/][MermaidJS]] is a diagramming and charting tool similar to Dot/Graphviz, but significantly prettier with less boilerplate. We'll likely only ever want to modify it in the context of =org-mode= so we'll want [[https://github.com/arnm/ob-mermaid][ob-mermaid]]. [[https://mermaid.js.org/][MermaidJS]] is a diagramming and charting tool similar to Dot/Graphviz, but significantly prettier with less boilerplate. We'll likely only ever want to modify it in the context of =org-mode= so we'll want [[https://github.com/arnm/ob-mermaid][ob-mermaid]].
Add the following the =packages.el= Add the following the =packages.el=
#+begin_src emacs-lisp :tangle "packages.el" :noweb no-export :comments no :results output silent #+begin_src emacs-lisp :tangle "packages.el" :noweb no-export :comments no :results output silent
(package! ob-mermaid) (package! ob-mermaid)
#+end_src #+end_src
*** Babel stuff ** Babel stuff
Babel execute can be tweaked per the syntax see orgmode docs [[https://orgmode.org/manual/Evaluating-Code-Blocks.html][here]]. Babel execute can be tweaked per the syntax see orgmode docs [[https://orgmode.org/manual/Evaluating-Code-Blocks.html][here]].
**** Src blocks *** Src blocks
These are grabbed from [[https://www.gtrun.org/custom/config][gtrun]]'s configuration.' These are grabbed from [[https://www.gtrun.org/custom/config][gtrun]]'s configuration.'
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no :results output silent #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no :results output silent
@ -880,7 +878,7 @@ These are grabbed from [[https://www.gtrun.org/custom/config][gtrun]]'s configur
org-src-tab-acts-natively t org-src-tab-acts-natively t
org-src-window-setup 'current-window) org-src-window-setup 'current-window)
#+end_src #+end_src
**** Diff *** Diff
The snippet below is largely pulled from John Kitchin [[https://emacs.stackexchange.com/questions/63517/org-mode-evaluate-diff-code-block/63520#63520][Stackexchange Post]]. The snippet below is largely pulled from John Kitchin [[https://emacs.stackexchange.com/questions/63517/org-mode-evaluate-diff-code-block/63520#63520][Stackexchange Post]].
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
@ -928,13 +926,13 @@ cat a.org
| 3 | | 3 |
#+end_example #+end_example
*** Solaire ** Solaire
#+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no
;(add-hook! 'org-mode-hook #'solaire-mode) ;(add-hook! 'org-mode-hook #'solaire-mode)
;(add-hook 'mixed-pitch-mode-hook #'solaire-mode-reset) ;(add-hook 'mixed-pitch-mode-hook #'solaire-mode-reset)
#+end_src #+end_src
*** Export to Tufte ** Export to Tufte
Rather than using =org-export-dispatch='s html export, we'll want to use [[https://github.com/ox-tufte/ox-tufte][ox-tufte]]. The HTML output is a more reasonable than the HTML format. Rather than using =org-export-dispatch='s html export, we'll want to use [[https://github.com/ox-tufte/ox-tufte][ox-tufte]]. The HTML output is a more reasonable than the HTML format.
#+BEGIN_SRC emacs-lisp :tangle "packages.el" #+BEGIN_SRC emacs-lisp :tangle "packages.el"
@ -977,7 +975,7 @@ The default =+org-capture/open-frame= is a little small. Let's modify the parame
)) ))
#+end_src #+end_src
** GPT * GPT
GPT is more useful than I thought. Its incredibly helpful for writing prose which I can struggle with due to mild dysgraphia. We will be using the [[https://github.com/karthink/gptel][karthink/gptel]] package. GPT is more useful than I thought. Its incredibly helpful for writing prose which I can struggle with due to mild dysgraphia. We will be using the [[https://github.com/karthink/gptel][karthink/gptel]] package.
#+BEGIN_SRC emacs-lisp :tangle "packages.el" #+BEGIN_SRC emacs-lisp :tangle "packages.el"
@ -994,6 +992,17 @@ This package supports multiple LLM backends. I'm going to be using the OpenAI Ch
machine api.openai.com login apikey password TOKEN machine api.openai.com login apikey password TOKEN
#+end_src #+end_src
** Keybinds
| Keybind | Command |
|---------+---------------------|
| =SPC A a= | =gptel-menu= |
| =SPC A c= | =gptel-system-prompt= |
| =SPC A m= | =gptel-menu= |
| =SPC A o= | =gptel= |
| =SPC A r= | =gptel-rewrite-menu= |
| =SPC A s= | =gptel-send= |
| =SPC A t= | =gptel-set-topic= |
#+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no #+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no
(map! :leader (map! :leader
@ -1008,12 +1017,12 @@ machine api.openai.com login apikey password TOKEN
) )
) )
#+end_src #+end_src
** Snippets * Snippets
We've enabled the [[doom-module:editor snippets][snippets module]] [[*Editor][earlier]]. This will give us use of the [[https://github.com/doomemacs/snippets][Doom Snippets package]], but we'll want to add our own as well. Custom snippets are added under =$DOOMDIR/snippets/= directory. Documentation on how to write snippets can be found at [[http://joaotavora.github.io/yasnippet/snippet-development.html][yas-snippet/documentation]] and [[https://github.com/doomemacs/snippets][doom-snippets github page]]. We've enabled the [[doom-module:editor snippets][snippets module]] [[*Editor][earlier]]. This will give us use of the [[https://github.com/doomemacs/snippets][Doom Snippets package]], but we'll want to add our own as well. Custom snippets are added under =$DOOMDIR/snippets/= directory. Documentation on how to write snippets can be found at [[http://joaotavora.github.io/yasnippet/snippet-development.html][yas-snippet/documentation]] and [[https://github.com/doomemacs/snippets][doom-snippets github page]].
While we'll want to store these snippets in this orgmode document, using the =+snippets/create= & =snippets/edit= may be useful for creating these. While we'll want to store these snippets in this orgmode document, using the =+snippets/create= & =snippets/edit= may be useful for creating these.
*** Orgmode ** Orgmode
In my work todo and my roam notes I've been using a list elements with nerd-fonts icons under my section header to provide quick links for the context. Below are a few that I've been using. In my work todo and my roam notes I've been using a list elements with nerd-fonts icons under my section header to provide quick links for the context. Below are a few that I've been using.
-  [[github:github/example][github/example]] -  [[github:github/example][github/example]]