From d951d543edffd36ab9396ac31ca63a18712bebe9 Mon Sep 17 00:00:00 2001 From: J S Date: Mon, 1 Jan 2024 16:14:39 -0500 Subject: [PATCH] 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 --- config.org | 84 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/config.org b/config.org index 0874d59..6d8417e 100644 --- a/config.org +++ b/config.org @@ -36,10 +36,13 @@ Some basic settings for Emacs Set the theme. /Use something dark/ +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 -(setq doom-theme 'doom-homage-black) -(setq doom-font (font-spec :family "Hack Nerd Font Mono" :size 16 :weight 'medium)) +(setq doom-theme 'doom-one) +(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. #+end_src ** Doom splash screen @@ -122,6 +125,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" "i d" #'insert-current-date) #+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 ** TODO set default values using org-babel's features for that. @@ -149,8 +160,6 @@ Because I sometimes use Fish or another shell, it's good to make sure bash is ru :END: 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]]. - - #+begin_src zsh :tangle "/home/user/age-preprocessor.zsh" #!/usr/bin/env zsh @@ -191,7 +200,6 @@ Emacs has better default values now, so it will ask to evaluate local variables. * Org-mode for a great todo list ** Making the Agenda features more efficient Using ripgrep we can automatically narrow org-agenda files. - *** Finding Files with Ripgrep :PROPERTIES: :CUSTOM_ID: agenda-efficient @@ -218,6 +226,15 @@ And then we want to call this before building the agenda: #+begin_src emacs-lisp (add-hook 'org-agenda-mode-hook 'set-org-agenda-files-ripgrep) #+end_src +*** Filtering the agenda +I don't want the agenda to show more than one day be default. +#+begin_src emacs-lisp +(setq org-agenda-start-day "-8d") +(setq org-agenda-span 9) +#+end_src + +#+RESULTS: +: 9 ** Basic settings @@ -322,18 +339,19 @@ In order for editorconfig to do its thing, indentation by the lsp must be disabl * Website ** Capture template #+begin_src emacs-lisp -(setq templates/post-capture-props "#+date: [%<%Y-%m-%d %a>]\n#+lastmod:\n#+categories[]:\n#+tags[]:\n#+images[]: ") -(setq templates/post-capture-title "#+TITLE: ${title}\n") -(setq templates/post-capture-template (concat templates/post-capture-title templates/post-capture-props)) +;(setq templates/post-capture-props "#+date: [%<%Y-%m-%d %a>]\n#+lastmod:\n#+categories[]:\n#+tags[]:\n#+images[]: ") +;(setq templates/post-capture-title "#+TITLE: ${title}\n") +;(setq templates/post-capture-template (concat templates/post-capture-title templates/post-capture-props)) #+end_src #+begin_src emacs-lisp +(after! org-roam (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)) + :unnarrowed t))) #+end_src @@ -526,8 +544,35 @@ We'll want a handy shortcut for this. #+end_src #+RESULTS: : /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* +:PROPERTIES: +:custom_id: citation-settings +:END: 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]], and a default set of styles. @@ -674,21 +719,7 @@ Org-roam enables features essential to a Zettelkasten such as inter-ID linking. `( ("d" "default" plain "%?" :target (file+head "%<%Y%m%d-%H%M%S>.org" - "#+TITLE: ${title}\n#+HTML_HEAD: \n") - :unnarrowed t) - - ("s" "school" plain "%?" - :target (file+head "%<%Y%m%d-%H%M%S>.org" -"#+TITLE: ${title} -,#+LATEX_CLASS: student-apa7 -,#+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") + "#+TITLE: ${title}\n") :unnarrowed t) ("c" "encrypted" plain "%?" @@ -836,7 +867,8 @@ I want to be able to ignore headings on export. (after! org (use-package! ox-extra :config - (ox-extras-activate '(latex-header-blocks ignore-headlines)))) + (ox-extras-activate '(latex-header-blocks ignore-headlines) + ))) #+end_src *** Resume template #+begin_src emacs-lisp