feat(date): Add new date functions

- fix: Removed conditional statement that always failed
- add much better date functions
- Correct lualatex run command, needs two passes
- Configure org super-agenda mode
- Remove archive from agendafiles
This commit is contained in:
Judah Sotomayor 2024-07-11 18:53:55 -04:00
parent b55495cf0c
commit 5d364ba624
Signed by: judahsotomayor
SSH Key Fingerprint: SHA256:9Dq4ppxhfAjbX+7HLXEt+ROMiIojI6kqQgUyFUJb9lI

View File

@ -7,8 +7,6 @@ I hope you enjoy your time here :)
It's not all very well documented, but I have done my best to split everything into a logical order.
Perhaps in 10 years I will still be using it, but who knows.
* Task List
** TODO Reorganize into use-cases rather than packages
* Setting Basics
** Packages
#+begin_src emacs-lisp :tangle "packages.el"
@ -39,9 +37,7 @@ Set the theme.
Relative line numbers don't seem to work, because of folding in Org-mode.
#+begin_src emacs-lisp
(setq doom-theme 'doom-oksolar-dark)
(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
@ -155,19 +151,25 @@ I want to launch favagtk more easily. Let's do that here:
** Get the date from the shell
I want to grab the current date and put it in the buffer.
Because I sometimes use Fish or another shell, it's good to make sure bash is running the command using the src_bash{`-c`} flag.
#+begin_src emacs-lisp
(defun current-date () (interactive)
(shell-command-to-string "date '+%Y-%m-%d'"))
(defun insert-current-date () (interactive)
(insert (string-trim (current-date))))
(insert (string-trim (shell-command-to-string "date '+%Y-%m-%d'"))))
(map! :leader
:desc "Insert the current date into the buffer"
"i d" #'insert-current-date)
(defun insert-current-date-alt () (interactive)
(insert (string-trim (shell-command-to-string "date '+%B %d, %Y'"))))
(map! :leader (:prefix ("i" . "insert") (:prefix ("d" . "date")
:desc "ISO 8601 (%Y-%m-%d)"
"i" #'insert-current-date
:desc "Month Day, Year (%B %d, %Y)"
"m" #'insert-current-date-alt)))
#+end_src
#+RESULTS:
: insert-current-date-alt
** Convert regex strings to rx
#+begin_src elisp :tangle packages.el
(package! xr)
@ -266,9 +268,13 @@ The rubber hits the road here.
I'll call that shell command to set the agenda files correctly.
#+begin_src emacs-lisp
(defun set-org-agenda-files-ripgrep ()
(setq org-agenda-files (split-string (shell-command-to-string "rg --type-add \'aorg:*.org.age\' -torg -taorg --pre ~/age-preprocessor.zsh --pre-glob \'*.age\' -l TODO /home/user/org "))))
(setq org-agenda-files (split-string (shell-command-to-string "rg --type-add \'aorg:*.org.age\' -torg -taorg --pre ~/age-preprocessor.zsh --pre-glob \'*.age\' -l TODO /home/user/org ")))
(setq org-agenda-files (remove "/home/user/org/archive.sec.org.age" org-agenda-files)))
#+end_src
#+RESULTS:
: set-org-agenda-files-ripgrep
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)
@ -291,11 +297,15 @@ I don't want scheduled items to duplicate if the deadline is up.
(setq org-log-done 'time)
(after! org
(setq org-log-done 'time)
(setq org-archive-location "~/org/archive.org")
(setq org-archive-location "~/org/archive.sec.org.age")
(setq org-hide-emphasis-markers nil))
(setq org-directory "~/org/")
(setq org-roam-directory org-directory)
#+end_src
#+RESULTS:
: ~/org/
*** Keymap
#+begin_src emacs-lisp
(map!
@ -327,7 +337,9 @@ Super-agenda allows many nice configurations to the agenda buffer.
Is it working now? It sure seems to be, so IDK what was up with it earlier.
#+begin_src emacs-lisp
(use-package! org-super-agenda
:after org-roam)
:after org-roam
:config (org-super-agenda-mode))
#+end_src
Configure the Super Agenda to neatly organize everything.
@ -502,9 +514,13 @@ I've found that lualatex does a good job processing PDFs. $hi$
#+begin_src emacs-lisp
(after! ox-latex
(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
#+RESULTS:
| lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f | lualatex --output-directory=/home/user/Documents -shell-escape -interaction nonstopmode %f |
$x + 1 = 3$
#+RESULTS:
: luamagick
@ -1219,7 +1235,7 @@ SVGBob is an ASCII art renderer. It can do all kinds of nifty things with just a
* Archiving
#+begin_src emacs-lisp
(setq org-archive-location "/home/user/org/archive.org::")
(setq org-archive-location "/home/user/org/archive.sec.org.age::")
#+end_src
* Init.el