From a58ae3b59d5f76c92a77aeee195f18e0940861a3 Mon Sep 17 00:00:00 2001 From: James Patrick Date: Tue, 16 Jul 2024 11:46:24 -0400 Subject: [PATCH] Added icons to syntax check and did some editting --- emacs/config.org | 50 +++++++++++++++++++++++++----------------------- emacs/init.el | 4 +++- 2 files changed, 29 insertions(+), 25 deletions(-) diff --git a/emacs/config.org b/emacs/config.org index fb2c3b1..aeb61db 100644 --- a/emacs/config.org +++ b/emacs/config.org @@ -5,7 +5,7 @@ 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. -This Emacs configuration is written using the [[https://en.wikipedia.org/wiki/Literate_programming][Literate Programming]] (sort of) paradigm (well sort of) proposed by [[https://en.wikipedia.org/wiki/Donald_Knuth][Donald Knuth]] in 1984, and uses Hlissner's awesome [[https://github.com/doomemacs/doomemacs][Doom Emacs]] configuration framework. While I like Literate Programming, literate configuration can be a mixed bag. Literate Programming produces more prose then code. Discoverability & readability can be drowned out under the prose about the current thoughts, pros & cons, backstory, deciding thoughts, & moral pondering. While this verbosity[fn:4] aids documentation and understanding, its often at the cost of readability. As a compromise I'm going to version both to the verbose =config.org= file and all of the produced configuration files; this will allow us to =git blame= both the this file and the generated files. +This Emacs configuration is written using the [[https://en.wikipedia.org/wiki/Literate_programming][Literate Programming]] (sort of) paradigm (well sort of) proposed by [[https://en.wikipedia.org/wiki/Donald_Knuth][Donald Knuth]] in 1984, and uses Hlissner's awesome [[https://github.com/doomemacs/doomemacs][Doom Emacs]] configuration framework. While I like Literate Programming, literate configuration can be a mixed bag. Literate Programming produces more prose than code. Discoverability & readability can be drowned out under the prose about the current thoughts, pros & cons, backstory, deciding thoughts, & moral pondering. While this verbosity[fn:4] aids documentation and understanding, its often at the cost of readability. As a compromise I'm going to version both to the verbose =config.org= file and all the produced configuration files; this will allow us to =git blame= both this file and the generated files. * Document Structure ** Doom Emacs @@ -13,20 +13,20 @@ I'm utilizing Hlissner's [[https://github.com/doomemacs/doomemacs][Doom Emacs]] Configuration is located in the ~$DOOMDIR~ directory; this can be located either[fn:3] at =~/.doom.d= or =$XDG_CONFIG_HOME/doom=. ** Tangle -This org-mode document works by using [[https://orgmode.org/manual/Extracting-Source-Code.html][tangles]]. By default Doom's literate config mode adds any ~#+begin_src~ blocks into the =config.el= file[fn:1]. If you want to tangle to a specific file you pass in a file name. +This org-mode document works by using [[https://orgmode.org/manual/Extracting-Source-Code.html][tangles]]. By default, Doom's literate config mode adds any ~#+begin_src~ blocks into the =config.el= file[fn:1]. If you want to tangle to a specific file you pass in a file name. #+begin_src org :tangle no #+begin_src emacs-lisp :tangle "example.el" #+end_src -or to disable it tangling for a codeblock set the =:tangle= property in code block header to =no=. +or to disable it tangling for a code block set the =:tangle= property in code block header to =no=. #+begin_src org :tangle no #+begin_src orgmode :tangle no #+end_src *** Noweb Reference -This document uses [[https://orgmode.org/manual/Noweb-Reference-Syntax.html][noweb reference syntax]]. This allows us to extract bits of configuration into named codeblocks, which can be interpolated into another code block's variable. For example: +This document uses [[https://orgmode.org/manual/Noweb-Reference-Syntax.html][noweb reference syntax]]. This allows us to extract bits of configuration into named code blocks, which can be interpolated into another code block's variable. For example: #+begin_example :tangle no #+NAME: initialization @@ -85,7 +85,7 @@ tree $DOOMDIR -L 2 Doom will automatically load the following files. + =init.el= :: Enabled Doom Modules -+ =package.el= :: Packages to fetch from MELPA, Github, etc. ++ =package.el= :: Packages to fetch from MELPA, GitHub, etc. + =config.el= :: General Emacs configuration Any additional files should follow the pattern of =+name.el= and should be scoped to that individual purpose. @@ -96,10 +96,10 @@ This should be loaded by the =config.el= file by using the =load!= macro[fn:7] (load! "+name") #+end_src -Currently this includes +Currently, this includes - =+orgmode.el= :: Additional configuration for Orgmode. Considering this is one of the primary modes I use emacs in there's a fair bit of configuration there. -- =+keybinds.el= :: A relatively new and not fully utilized file. The plan is to use this as a centralized location for all custom keybinds. +- =+keybinds.el= :: A relatively new and not fully utilized file. The plan is to use this as a centralized location for all custom key binds. *** Other files There are several other files here not directly used by emacs but are related to it. @@ -120,7 +120,7 @@ There [[https://nullprogram.com/blog/2016/12/22/][minor but non-zero start time #+END_SRC *** Warn user not to modify =*.el= files directly. -As mentioned above, we are versioning the generated emacs lisp configuration. We shouldn't modified these files as they'll be clobbed anytime the org-tangle is run. Lets include a warning to this effect. +As mentioned above, we are versioning the generated emacs lisp configuration. We shouldn't modify these files as they'll be clobbered anytime the org-tangle is run. Let's include a warning to this effect. #+name:modification-warning #+begin_src emacs-lisp @@ -129,7 +129,7 @@ As mentioned above, we are versioning the generated emacs lisp configuration. We #+end_src *** Applying to all files -We need to apply this to all of the following files. +We need to apply this to all the following files. #+begin_src bash :tangle no :exports result :results output verbatim find ~/.doom.d/* -iname '*.el' | sed "s/.*\///" #+end_src @@ -141,7 +141,7 @@ find ~/.doom.d/* -iname '*.el' | sed "s/.*\///" : init.el : packages.el - Since we've used a named these blocks we can use [[*Noweb Reference][Noweb Reference]] for all of the files. + Since we've used a named these blocks we can use [[*Noweb Reference][Noweb Reference]] for all the files. =+keybinds.el= #+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no @@ -356,7 +356,9 @@ https://github.com/doomemacs/doomemacs/tree/master/modules/checker #+name:doom-checker #+begin_src emacs-lisp :tangle no -(syntax +childframe) ; tasing you for every semicolon you forget +(syntax +childframe ; tasing you for every semicolon you forget + +icons + +flymake) (spell ; tasing you for misspelling mispelling +aspell +everywhere) @@ -537,9 +539,9 @@ literate #+end_src -* General UI Tweaks -** Window Titlebar -The titlebar display string will display =♢= if there exist unsaved buffer modifications & =♦= otherwise. +* General UI Tweaks +** Window Title bar +The title bar display string will display =♢= if there exist unsaved buffer modifications & =♦= otherwise. #+begin_src emacs-lisp :tangle "config.el" :noweb no-export :comments no (setq doom-fallback-buffer-name "Doom" @@ -560,7 +562,7 @@ The titlebar display string will display =♢= if there exist unsaved buffer mod #+end_src ** Fonts -I use the [[https://www.nerdfonts.com/][nerdfont]]'s [[https://github.com/i-tu/Hasklig][Hasklig]] for my monospace font & Huerta Tipografica's [[https://www.huertatipografica.com/en/fonts/alegreya-ht-pro][ Alegreya]] serif font. +I use the [[https://www.nerdfonts.com/][nerdfont]]'s [[https://github.com/i-tu/Hasklig][Hasklig]] for my monospaced font & Huerta Tipografica's [[https://www.huertatipografica.com/en/fonts/alegreya-ht-pro][ Alegreya]] serif font. #+begin_src emacs-lisp :tangle "config.el" :noweb no-export :comments no (setq doom-font (font-spec :family "Hasklig" :size 14 :height 1) @@ -569,21 +571,21 @@ I use the [[https://www.nerdfonts.com/][nerdfont]]'s [[https://github.com/i-tu/H #+end_src * Keys -Keybinds should be centralized in =$DOOMDIR/+keybinds.el=. This is loaded from =$DOOMDIR/config.el= file via +Key binds should be centralized in =$DOOMDIR/+keybinds.el=. This is loaded from =$DOOMDIR/config.el= file via #+begin_src emacs-lisp :tangle "config.el" :noweb no-export :comments no (load! "+keybinds") #+end_src -Doom comes with some good keybind macros (see [[https://github.com/doomemacs/doomemacs/blob/master/docs/faq.org#bind-my-own-keys-or-change-existing-ones][here]] for why). Documentation for this can be found [[https://github.com/doomemacs/doomemacs/blob/master/docs/faq.org#bind-my-own-keys-or-change-existing-ones][here]], but in broad strokes: +Doom comes with some good key bind macros (see [[https://github.com/doomemacs/doomemacs/blob/master/docs/faq.org#bind-my-own-keys-or-change-existing-ones][here]] for why). Documentation for this can be found [[https://github.com/doomemacs/doomemacs/blob/master/docs/faq.org#bind-my-own-keys-or-change-existing-ones][here]], but in broad strokes: 1. Start with a =map!= macro. You can use 2. When possible use =:when= to limit scope. 3. Use =:prefix= and =:prefix-map= where possible. 4. Always use =:desc= to describe what is being done. -Below is a sample snippet from Rameez Khan's [[https://rameezkhan.me/posts/2020/2020-07-03--adding-keybindings-to-doom-emacs/][blog]] (first hit on "doom emacs keybind" using [[https://duckduckgo.com/][DDG]]): +Below is a sample snippet from Rameez Khan's [[https://rameezkhan.me/posts/2020/2020-07-03--adding-keybindings-to-doom-emacs/][blog]] (first hit on "doom emacs key bind" using [[https://duckduckgo.com/][DDG]]): #+begin_src emacs-lisp :tangle no (map! :leader (:prefix-map ("a" . "applications") @@ -592,10 +594,10 @@ Below is a sample snippet from Rameez Khan's [[https://rameezkhan.me/posts/2020/ :desc "Search journal entry" "s" #'org-journal-search))) #+end_src -Note: Keybinds should be defined with in the context that they are being used, not here +Note: Key binds should be defined with in the context that they are being used, not here ** Local Leader -Lets set the local leader to =,=. We may want to remap this to =;= later. Both of these seem to have issues with potential key conflicts with evil-snipe. This seems to primarily exists with regards to org-mode. Github issue can be found [[https://github.com/doomemacs/doomemacs/issues/4242][here]]. +Lets set the local leader to =,=. We may want to remap this to =;= later. Both of these seem to have issues with potential key conflicts with evil-snipe. This seems to primarily exists in regard to org-mode. GitHub issue can be found [[https://github.com/doomemacs/doomemacs/issues/4242][here]]. #+begin_src emacs-lisp :tangle "+keybinds.el" :noweb no-export :comments no (setq doom-localleader-key ",") @@ -616,18 +618,18 @@ Some files we'll need to set the major-mode for manually. Either based on where (add-to-list 'auto-mode-alist '("/path/to/file/.*\\.file" . markdown-mode)) #+end_src ** 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, 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. +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 it's 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 :tangle "config.el" :noweb no-export :comments no (add-to-list 'auto-mode-alist '("/\\(tmp\\|private/var\\)/.*/tmp_.*\\.txt" . markdown-mode)) #+end_src * 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 it's not reasonable to start up my entire working env. This file can be located at =$DOOMDIR/+orgmode.el=. #+begin_src emacs-lisp :tangle "config.el" :noweb no-export :comments no (load! "+orgmode") #+end_src -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 to make sure the orgmode is actually loaded. #+begin_src emacs-lisp :tangle "+orgmode.el" :noweb no-export :comments no (require 'org) @@ -711,7 +713,7 @@ For configuring it we'll want the following settings: - =gac-automatically-push-p= :: Automatically push new changes. - =gac-automatically-add-new-files-p= :: Automatically add new files. -Additionally we'll also want to add a big of additional logic so that we will automatically pull changes as well. It may be worth setting up a crontab to automate the pull in the future. +Additionally, we'll also want to add a big of additional logic so that we will automatically pull changes as well. It may be worth setting up a crontab to automate the pull in the future. This snippet below is from siatwe's comment [[https://github.com/ryuslash/git-auto-commit-mode/pull/40#issuecomment-1772237807][here]]. diff --git a/emacs/init.el b/emacs/init.el index a6035bf..93d3536 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -87,7 +87,9 @@ vterm ; the best terminal emulation in Emacs :checkers - (syntax +childframe) ; tasing you for every semicolon you forget + (syntax +childframe ; tasing you for every semicolon you forget + +icons + +flymake) (spell ; tasing you for misspelling mispelling +aspell +everywhere)