Compare commits

...

3 Commits

Author SHA1 Message Date
J S
d28cd4d88e
feat[latex,bash] Updated latex templates
I updated the latex templates and process.
I updated the mechanism for accessing bash and other shells.
2024-01-26 18:27:26 -05:00
J S
476ab85aec
feat[website] Added cap template for website 2024-01-01 16:23:52 -05:00
J S
d951d543ed
feat[captures] Removed defunct school template
Added error-check to not use Hack font if not present.
Began work on filter for inline anki links
2024-01-01 16:15:12 -05:00
2 changed files with 158 additions and 86 deletions

View File

@ -36,12 +36,16 @@ Some basic settings for Emacs
Set the theme. Set the theme.
/Use something dark/ /Use something dark/
+I also prefer relative line numbers because of *evil* mode+ +I also prefer relative line numbers because of *evil* mode+
Relative line numbers don't work, because of foling in Org-mode. Relative line numbers don't seem to work, because of folding in Org-mode.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq doom-theme 'doom-homage-black) (setq doom-theme 'doom-homage-black)
(setq doom-font (font-spec :family "Hack Nerd Font Mono" :size 16 :weight 'medium)) (condition-case nil
(setq doom-font (font-spec :family "Hack Nerd Font Mono" :size 16 :weight 'medium))
(error (set-face-attribute 'default nil :height 130)))
(setq auto-save-default nil) ;I don't like autosaving. Let me do it myself. (setq auto-save-default nil) ;I don't like autosaving. Let me do it myself.
#+end_src #+end_src
** Doom splash screen ** Doom splash screen
I really don't like the widgets, and I think it takes longer to load so I get rid of them I really don't like the widgets, and I think it takes longer to load so I get rid of them
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -60,6 +64,8 @@ I want a non-ESC way to get back to normal mode:
(after! org-mode (map! :desc "Delete previous character in insert mode" :i "C-h" #'evil-delete-backward-char)) (after! org-mode (map! :desc "Delete previous character in insert mode" :i "C-h" #'evil-delete-backward-char))
(map! :desc "Increment number below or after cursor" :n "C-a" #'evil-numbers/inc-at-pt) (map! :desc "Increment number below or after cursor" :n "C-a" #'evil-numbers/inc-at-pt)
(map! :desc "Decrement number below or after cursor" :n "C-x" #'evil-numbers/dec-at-pt) (map! :desc "Decrement number below or after cursor" :n "C-x" #'evil-numbers/dec-at-pt)
(map! :n "g j" #'evil-next-visual-line)
(map! :n "g k" #'evil-previous-visual-line)
#+end_src #+end_src
* Terminal setup * Terminal setup
@ -69,13 +75,48 @@ I like to just use bash:
"Lauch term with /bin/bash" "Lauch term with /bin/bash"
(interactive) (interactive)
(term "/bin/bash")) (term "/bin/bash"))
(map!
:desc "Start a bash shell" (defun dash nil
"<f6>" #'bash) "Lauch term with /bin/dash"
(interactive)
(term "/bin/dash"))
(defun zsh nil
"Lauch term with /bin/zsh"
(interactive)
(term "/bin/zsh"))
#+end_src #+end_src
I don't like the modeline in the terminal. #+RESULTS:
: zsh
** Shell mappings
#+begin_src emacs-lisp #+begin_src emacs-lisp
(map! :leader (:prefix ("k" . "shell")
:desc "Start a bash shell"
:n "b" #'bash
:desc "Start a dash shell"
:n "d" #'dash
:desc "Start a zsh shell"
:n "z" #'zsh
:desc "Start an elisp repl"
:n "e" #'+emacs-lisp/open-repl
:desc "Start a python repl"
:n "j" #'+python/open-repl))
#+end_src
#+RESULTS:
,#+RESULTS:
I don't like the modeline in the terminal.
,#+begin_src emacs-lisp
(add-hook 'term-mode-hook 'hide-mode-line-mode) (add-hook 'term-mode-hook 'hide-mode-line-mode)
#+end_src #+end_src
* Sage-math * Sage-math
@ -122,6 +163,14 @@ Because I sometimes use Fish or another shell, it's good to make sure bash is ru
:desc "Insert the current date into the buffer" :desc "Insert the current date into the buffer"
"i d" #'insert-current-date) "i d" #'insert-current-date)
#+end_src #+end_src
** Convert regex strings to rx
#+begin_src elisp :tangle packages.el
(package! xr)
#+end_src
#+begin_src elisp
(use-package! xr)
#+end_src
* Creating Diagrams and graphs * Creating Diagrams and graphs
** TODO set default values using org-babel's features for that. ** TODO set default values using org-babel's features for that.
@ -149,8 +198,6 @@ Because I sometimes use Fish or another shell, it's good to make sure bash is ru
:END: :END:
This preprocessor script allows me to use Ripgrep with Age to filter agenda files. This preprocessor script allows me to use Ripgrep with Age to filter agenda files.
You can see the configuration for that in [[#agenda-efficient][this section]]. You can see the configuration for that in [[#agenda-efficient][this section]].
#+begin_src zsh :tangle "/home/user/age-preprocessor.zsh" #+begin_src zsh :tangle "/home/user/age-preprocessor.zsh"
#!/usr/bin/env zsh #!/usr/bin/env zsh
@ -191,7 +238,6 @@ Emacs has better default values now, so it will ask to evaluate local variables.
* Org-mode for a great todo list * Org-mode for a great todo list
** Making the Agenda features more efficient ** Making the Agenda features more efficient
Using ripgrep we can automatically narrow org-agenda files. Using ripgrep we can automatically narrow org-agenda files.
*** Finding Files with Ripgrep *** Finding Files with Ripgrep
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: agenda-efficient :CUSTOM_ID: agenda-efficient
@ -218,6 +264,16 @@ And then we want to call this before building the agenda:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-hook 'org-agenda-mode-hook 'set-org-agenda-files-ripgrep) (add-hook 'org-agenda-mode-hook 'set-org-agenda-files-ripgrep)
#+end_src #+end_src
*** Filtering the agenda
I don't want the agenda to show more than one day be default.
#+begin_src emacs-lisp
(after! org
(setq org-agenda-start-day "-8d")
(setq org-agenda-span 9))
#+end_src
#+RESULTS:
: 9
** Basic settings ** Basic settings
@ -278,17 +334,20 @@ Edna allows better dependency handling for todos and the like.
(org-habit-graph-column 1) (org-habit-graph-column 1)
(org-habit-preceding-days 10) (org-habit-preceding-days 10)
(org-habit-following-days 1) (org-habit-following-days 1)
(org-habit-show-habits-only-for-today nil)) (org-habit-show-habits-only-for-today t))
#+end_src #+end_src
** Anki editing in org-mode ** Anki editing in org-mode
Anki editor is a good one for large cards that need high complexity.
#+begin_src emacs-lisp :tangle packages.el #+begin_src emacs-lisp :tangle packages.el
(package! anki-editor) (package! anki-editor)
#+end_src #+end_src
*** Configuring inline-anki *** inline-anki
Inline anki is far better for small cards, and where it is best to maintain a /single source of truth/.
#+begin_src emacs-lisp :tangle packages.el #+begin_src emacs-lisp :tangle packages.el
(package! asyncloop) (package! asyncloop)
(package! inline-aki (package! inline-aki
@ -299,6 +358,18 @@ Edna allows better dependency handling for todos and the like.
(setq inline-anki-note-type "Katex and Markdown Cloze") (setq inline-anki-note-type "Katex and Markdown Cloze")
(setq inline-anki-use-tags t) (setq inline-anki-use-tags t)
#+end_src #+end_src
**** Inline Anki symbol
By default, [[*inline-anki][Inline-anki]] uses _underscore_ to specify the card type.
This is okay, but I'd rather find something that isn't already used.
#+begin_src emacs-lisp
(add-to-list 'org-emphasis-alist '("." nil))
(setq inline-anki-emphasis-type "_")
#+end_src
#+RESULTS:
: _
** calfw Calendar View ** calfw Calendar View
#+begin_src emacs-lisp :tangle "packages.el" #+begin_src emacs-lisp :tangle "packages.el"
(package! calfw (package! calfw
@ -328,15 +399,6 @@ In order for editorconfig to do its thing, indentation by the lsp must be disabl
#+end_src #+end_src
#+begin_src emacs-lisp
(add-to-list 'org-roam-capture-templates
'("m" "Markdown" plain "" :target
(file+head "training-resources/content/${title}.md"
"---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: \n---\n")
:unnarrowed t))
#+end_src
** Hugo base directory ** Hugo base directory
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-hugo-base-dir (concat org-directory (file-name-as-directory "website"))) (setq org-hugo-base-dir (concat org-directory (file-name-as-directory "website")))
@ -378,10 +440,7 @@ I've found that lualatex does a good job processing PDFs. $hi$
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! ox-latex (after! ox-latex
(setq org-latex-pdf-process (setq org-latex-pdf-process
'("lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f" '("lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f")))
"lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f"))
)
#+end_src #+end_src
$x + 1 = 3$ $x + 1 = 3$
@ -526,8 +585,35 @@ We'll want a handy shortcut for this.
#+end_src #+end_src
#+RESULTS: #+RESULTS:
: /home/user/.config/doom/ : /home/user/.config/doom/
*** Delete links from inline anki
#+begin_src elisp
(defun inline-anki-link-filter (link backend info)
"Rewrite links in export to preserve link text only"
(if (eq backend 'inline-anki--ox-anki-html-backend)
(save-match-data ; is usually a good idea
(and (string-match "\\[(?:\\[([^\\]\\[]*)\\])(?:\\[(.*)\\])?\\]" link)
(match-string 2 link)))))
#+end_src
#+RESULTS:
: inline-anki-link-filter
#+begin_src elisp
(add-to-list 'org-export-filter-link-functions
'inline-anki-link-filter)
#+end_src
#+begin_src elisp
#+end_src
#+RESULTS:
| inline-anki-link-filter |
** Automatic Citations with *citar* and *org-cite* ** Automatic Citations with *citar* and *org-cite*
:PROPERTIES:
:custom_id: citation-settings
:END:
Citar is a sweet little package for managing citations. Citar is a sweet little package for managing citations.
We want a general [[file:~/org/references.bib][bibliography file]], a [[file:~/Zotero/styles/][styles directory]], We want a general [[file:~/org/references.bib][bibliography file]], a [[file:~/Zotero/styles/][styles directory]],
and a default set of styles. and a default set of styles.
@ -666,38 +752,41 @@ Org-roam enables features essential to a Zettelkasten such as inter-ID linking.
:init (setq org-roam-directory "~/org/")) :custom :init (setq org-roam-directory "~/org/")) :custom
#+end_src #+end_src
I use several capture templates to make it easy to get notes into my various sections.
I only use [[#md-roam-config][Markdown]] in the team wiki, so I have it set to that.
I also have a capture template form my [[Website]]
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! org-roam (after! org-roam
:ensure t :ensure t
:custom :custom
(setq org-roam-capture-templates (setq org-roam-capture-templates
`( `(
("d" "default" plain "%?" ("d" "default" plain "%?"
:target (file+head "%<%Y%m%d-%H%M%S>.org" :target (file+head "%<%Y%m%d-%H%M%S>.org"
"#+TITLE: ${title}\n#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"css/retro.css\" />\n") "#+TITLE: ${title}\n")
:unnarrowed t) :unnarrowed t)
("s" "school" plain "%?" ("c" "encrypted" plain "%?"
:target (file+head "%<%Y%m%d-%H%M%S>.org" :target (file+head "%<%Y%m%d-%H%M%S>.sec.org.age"
"#+TITLE: ${title} "#+TITLE: ${title}\n#+FILETAGS: :secure:noexport:\n\n* No Export Below This Line")
,#+LATEX_CLASS: student-apa7 :unnarrowed t)
,#+LATEX_OPTIONS: stu
,#+LATEX_HEADER: \\course{}
,#+LATEX_HEADER:\\authorsnames{Judah Sotomayor}
,#+LATEX_HEADER: \\authorsaffiliations{}
,#+LATEX_HEADER: \\professor{}
,#+LATEX_HEADER: \\usepackage{times}
,#+LATEX_HEADER: \\duedate{}
,#+OPTIONS: toc:nil\n")
:unnarrowed t)
("c" "encrypted" plain "%?" ("m" "Markdown" plain ""
:target (file+head "%<%Y%m%d-%H%M%S>.sec.org.age" :target
"#+TITLE: ${title}\n#+FILETAGS: :secure:noexport:\n#+HTML_HEAD: <link rel=\"stylesheet\" type=\"text/css\" href=\"css/retro.css\" />\n\n\n* No Export Below This Line") (file+head "training-resources/content/${title}.md"
:unnarrowed t)))) "---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: \n---\n")
:unnarrowed t)
("w" "Website" plain "%?"
:target
(file+head "website/src/posts/%<%Y%m%d-%H%M%S>.org"
"#+TITLE: ${title}\n#+DRAFT: true\n")
:unnarrowed t))))
#+end_src #+end_src
#+RESULTS:
| d | default | plain | %? | :target | (file+head %<%Y%m%d-%H%M%S>.org #+TITLE: ${title} |
*** Keybinds *** Keybinds
Org-roam has many commands, of which I have bound the most important below. Org-roam has many commands, of which I have bound the most important below.
This entails creating a local leader. This entails creating a local leader.
@ -768,7 +857,7 @@ I use =r= for this purpose. It is close and goes well with *roam*.
)))) ))))
#+END_SRC #+END_SRC
**** Function to pull up org-roam ui **** COMMENT Function to pull up org-roam ui
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun open-org-roam-ui () (defun open-org-roam-ui ()
(interactive) (interactive)
@ -833,12 +922,28 @@ Adding up values for one key is supported."
*** ox-extra for ":ignore:" tags *** ox-extra for ":ignore:" tags
I want to be able to ignore headings on export. I want to be able to ignore headings on export.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! org
(use-package! ox-extra (use-package! ox-extra
:after (org)
:config :config
(ox-extras-activate '(latex-header-blocks ignore-headlines)))) (ox-extras-activate '(latex-header-blocks ignore-headlines)))
#+end_src #+end_src
*** Resume template *** McDowell Resume Template
This template is supposed to be the standard.
#+begin_src emacs-lisp
(add-to-list 'org-latex-classes
'("mcdowellcv"
"\\documentclass[]{mcdowellcv}
\\usepackage{amsmath}
\\usepackage[]{multicol}
\\usepackage[hidelinks]{hyperref}
[NO-DEFAULT-PACKAGES]
[NO-PACKAGES]"
("\\begin{cvsection}{%s}" "\\end{cvsection}")
("\\begin{cvsubsection}{%s}" "\\end{cvsubsection}")))
#+end_src
*** Altacv template :ARCHIVE:
This is no longer really used.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-to-list 'org-latex-classes (add-to-list 'org-latex-classes
'("altacv" "\\documentclass[10pt,a4paper,ragged2e,withhyper]{altacv} '("altacv" "\\documentclass[10pt,a4paper,ragged2e,withhyper]{altacv}
@ -884,33 +989,6 @@ I want to be able to ignore headings on export.
("\\cvsection{%s}" . "\\cvsection*{%s}") ("\\cvsection{%s}" . "\\cvsection*{%s}")
("\\cvevent{%s}" . "\\cvevent*{%s}"))) ("\\cvevent{%s}" . "\\cvevent*{%s}")))
#+end_src #+end_src
*** McDowell Resume Template
This template is supposed to be the standard.
#+begin_src emacs-lisp
(add-to-list 'org-latex-classes
'("mcdowellcv"
"\\documentclass[]{mcdowellcv}
\\usepackage{amsmath}
\\usepackage[]{multicol}
\\usepackage[hidelinks]{hyperref}
[NO-DEFAULT-PACKAGES]
[NO-PACKAGES]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}")
("\\cvsection{%s}" . "\\cvsection*{%s}")
("\\cvevent{%s}" . "\\cvevent*{%s}")))
#+end_src
** Better EViL keybinds
*** Remapping =g-j/k=
#+begin_src emacs-lisp
(map! :n "g j" #'evil-next-visual-line)
(map! :n "g k" #'evil-previous-visual-line)
#+end_src
* Company-mode for great autocompletes * Company-mode for great autocompletes
I don't really want company-mode to run on timeouts. I don't really want company-mode to run on timeouts.
I want VIM-like autocompletion, where =C-x o= and friends gives me my autocompletion. I want VIM-like autocompletion, where =C-x o= and friends gives me my autocompletion.
@ -939,6 +1017,9 @@ We need to bring in the correct SSH agent values, so that Emacs is aware of wher
#+end_src #+end_src
* Md-roam * Md-roam
:PROPERTIES:
:CUSTOM_ID: md-roam-config
:END:
** Packages ** Packages
#+begin_src emacs-lisp :tangle "packages.el" #+begin_src emacs-lisp :tangle "packages.el"
(package! md-roam (package! md-roam
@ -957,15 +1038,6 @@ We need to bring in the correct SSH agent values, so that Emacs is aware of wher
(setq md-roam-use-org-extract-ref nil) (setq md-roam-use-org-extract-ref nil)
(org-roam-db-autosync-mode 1)) (org-roam-db-autosync-mode 1))
#+end_src #+end_src
** COMMENT Capture template for documentation
#+begin_src emacs-lisp
(add-to-list 'org-roam-capture-templates
'("m" "Markdown" plain "" :target
(file+head "training-resources/content/${title}.md"
"---\ntitle: ${title}\nid: %<%Y-%m-%dT%H%M%S>\ncategory: \n---\n")
:unnarrowed t))
#+end_src
* Funny Stuff * Funny Stuff
** Spray ** Spray
#+begin_src emacs-lisp #+begin_src emacs-lisp

Binary file not shown.