adding some tweaks to a lot of things

This commit is contained in:
Chris Cochrun 2025-01-08 09:50:39 -06:00
parent fdb4c2ecc8
commit 0394d80a50
5 changed files with 320 additions and 33 deletions

155
init.el
View file

@ -679,7 +679,8 @@ much faster. The hope is to also make this a faster version of imenu."
org-latex-active-timestamp-format "\\textit{%s}"
org-enforce-todo-dependencies t
org-export-preserve-breaks t
org-directory "~/docs/notes")
org-directory "~/docs/notes"
org-pretty-entities t)
(add-hook 'org-mode-hook 'chris/org-mode-setup)
(setq org-refile-targets '((org-agenda-files :maxlevel . 6) ("/home/chris/docs/todo/archive.org" :maxlevel . 6)))
@ -845,6 +846,39 @@ much faster. The hope is to also make this a faster version of imenu."
(setq org-latex-packages-alist '(("margin=2cm" "geometry" nil)))
(setq org-latex-title-command "\\maketitle\\vspace{-4em}")
(defun chris/org-publish-site ()
"Publish my website by pushing files to specific locations"
(interactive)
(let ((notes (directory-files "~/docs/notes" t ".*.org"))
(lessons (directory-files "~/docs/notes/lessons" t ".*.org"))
(denote-directory "~/docs/notes/site/content"))
(cl-loop for file in notes
do (let ((filename (f-filename file)))
(copy-file file (concat "~/docs/notes/site/content/notes/" filename) t)))
(cl-loop for file in lessons
do (let ((filename (f-filename file)))
(copy-file file (concat "~/docs/notes/site/content/teaching/" filename) t)))
(find-file "~/docs/notes/site/content/index.org")
(org-update-all-dblocks)
(save-buffer)
(org-publish "cochrun.xyz")))
(defun chris/website-dynamic-block ()
"A function to load up the links on the homepage for the website"
(let (files (directory-files "~/docs/notes/site/content/notes/" t ".*.org"))
(cl-loop for file in files
do (insert (denote--link-get-description file)))))
(defun org-dblock-write:chris-site-notes ()
"A function to load up the links on the homepage for the website"
(let (files (directory-files "~/docs/notes/site/content/notes/" t ".*.org"))
(cl-loop for file in files
do (insert (denote--link-get-description file)))))
(add-to-list 'org-dynamic-block-alist '("chris-site-notes" . chris/website-dynamic-block))
(setq org-publish-project-alist
`(("home"
:base-directory "~/docs/notes/site/content"
@ -854,18 +888,30 @@ much faster. The hope is to also make this a faster version of imenu."
:html-html5-fancy t
:html-self-link-headlines t
:html-head "<link rel=\"stylesheet\" href=\"pico.css\" type=\"text/css\"/>"
:html-head "<link rel=\"stylesheet\" href=\"my.css\" type=\"text/css\"/>"
:publishing-directory "~/docs/notes/site/public/"
:publishing-function org-html-publish-to-html)
("posts"
:base-directory "~/docs/notes/site/content/posts"
:base-directory "~/docs/notes/site/content/notes"
:base-extension "org"
:recursive t
:recursive nil
:html-doctype "html5"
:html-html5-fancy t
:html-self-link-headlines t
:htmlized-source t
:html-head "<link rel=\"stylesheet\" href=\"../pico.css\" type=\"text/css\"/>"
:publishing-directory "~/docs/notes/site/public/content/"
:publishing-directory "~/docs/notes/site/public/notes/"
:publishing-function org-html-publish-to-html)
("teaching/preaching"
:base-directory "~/docs/notes/site/content/teaching"
:base-extension "org"
:recursive nil
:html-doctype "html5"
:html-html5-fancy t
:html-self-link-headlines t
:htmlized-source t
:html-head "<link rel=\"stylesheet\" href=\"../pico.css\" type=\"text/css\"/>"
:publishing-directory "~/docs/notes/site/public/teaching/"
:publishing-function org-html-publish-to-html)
("static"
:base-directory "~/docs/notes/site/assets/"
@ -873,9 +919,9 @@ much faster. The hope is to also make this a faster version of imenu."
:recursive t
:html-doctype "html5"
:html-html5-fancy t
:publishing-directory "~/docs/notes/site/public/"
:publishing-directory "~/docs/notes/site/public/static/"
:publishing-function org-publish-attachment)
("cochrun.xyz" :components ("home" "posts" "static"))))
("cochrun.xyz" :components ("home" "posts" "static" "teaching/preaching"))))
(setq org-html-postamble t
org-html-postamble-format '(("en"
@ -1074,6 +1120,36 @@ much faster. The hope is to also make this a faster version of imenu."
"nk" 'denote-keywords-add
"nl" 'denote-link-or-create))
(use-package consult-denote
:config
(setq consult-denote-find-command 'consult-fd
consult-denote-grep-command 'consult-ripgrep)
(consult-denote-mode +1))
(defun chris/docx-to-denote-lesson ()
"Converts the docx file at point in dired to a denote
lesson file in my notes/lessons folder"
(interactive)
(let* ((file (expand-file-name (dired-file-name-at-point)))
(filename (f-filename file))
(orgname (string-replace "docx" "org" filename))
(process (call-process
"pandoc" nil nil nil "--wrap=none" "-o" orgname file)))
;; (cl-loop while (not (eq 'run (process-status process)))
;; do (message ""))
(save-excursion
(find-file orgname)
(revert-buffer t t nil)
(with-current-buffer (buffer-name)
(goto-char (point-min))
(replace-regexp " " " ")
(goto-char (point-min))
(replace-regexp "\n \n" "")
(save-buffer)
(goto-char (point-min))
(kill-ring-save (point-min) (point-max))
(org-capture)))))
(use-package org-present
:commands org-present
:config
@ -1645,6 +1721,30 @@ Optional BACKEND must be `re-reveal' or a backend derived from it."
(setq org-hugo-base-dir "/home/chris/dev/cochrun.xyz"
org-hugo-section "blog"))
(defun chris/window-delete-popup-frame (&rest _)
"Kill selected selected frame if it has parameter `chris/window-popup-frame'.
Use this function via a hook."
(when (frame-parameter nil 'chris/window-popup-frame)
(delete-frame)))
(defmacro chris/window-define-with-popup-frame (command)
"Define interactive function which calls COMMAND in a new frame.
Make the new frame have the `chris/window-popup-frame' parameter."
`(defun ,(intern (format "chris/window-popup-%s" command)) ()
,(format "Run `%s' in a popup frame with `chris/window-popup-frame' parameter.
Also see `chris/window-delete-popup-frame'." command)
(interactive)
(let ((frame (make-frame '((chris/window-popup-frame . t)))))
(select-frame frame)
(switch-to-buffer " chris/window-hidden-buffer-for-popup-frame")
(condition-case nil
(call-interactively ',command)
((quit error user-error)
(delete-frame frame))))))
(chris/window-define-with-popup-frame org-capture)
(add-hook 'org-capture-after-finalize-hook #'chris/window-delete-popup-frame)
(use-package gptel
:init
(setq gptel-model "llama3.2:3b-instruct-fp16"
@ -1764,7 +1864,7 @@ Describe everything that follows in the present tense, in response to what I typ
(use-package vertico-posframe
:after vertico
:config
(setq vertico-posframe-min-height 30)
(setq vertico-posframe-min-height 15)
(vertico-posframe-mode +1))
(setq home-directory "~/")
@ -1835,7 +1935,7 @@ Describe everything that follows in the present tense, in response to what I typ
;; (setq vertico-scroll-margin 0)
;; Show more candidates
(setq vertico-count 30)
(setq vertico-count 15)
;; Grow and shrink the Vertico minibuffer
(setq vertico-resize t)
@ -2499,36 +2599,50 @@ targets."
('normal lisp-mode-map
"gl" 'paredit-forward-slurp-sexp
"gh" 'paredit-backward-slurp-sexp
"C-M-l" 'paredit-forward-barf-sexp
"C-M-h" 'paredit-backward-barf-sexp
"C-l" 'paredit-forward
"C-h" 'paredit-backward)
('normal emacs-lisp-mode-map
"gl" 'paredit-forward-slurp-sexp
"gh" 'paredit-backward-slurp-sexp
"C-M-l" 'paredit-forward-barf-sexp
"C-M-h" 'paredit-backward-barf-sexp
"C-l" 'paredit-forward
"C-h" 'paredit-backward)
('normal lisp-shared-mode-map
"gl" 'paredit-forward-slurp-sexp
"gh" 'paredit-backward-slurp-sexp
"C-M-l" 'paredit-forward-barf-sexp
"C-M-h" 'paredit-backward-barf-sexp
"C-l" 'paredit-forward
"C-h" 'paredit-backward)
('normal sly-mrepl-mode-map
"gl" 'paredit-forward-slurp-sexp
"gh" 'paredit-backward-slurp-sexp
"C-M-l" 'paredit-forward-barf-sexp
"C-M-h" 'paredit-backward-barf-sexp
"C-l" 'paredit-forward
"C-h" 'paredit-backward)
('normal scheme-mode-map
"gl" 'paredit-forward-slurp-sexp
"gh" 'paredit-backward-slurp-sexp
"C-M-l" 'paredit-forward-barf-sexp
"C-M-h" 'paredit-backward-barf-sexp
"C-l" 'paredit-forward
"C-h" 'paredit-backward)
('normal geiser-mode-map
"gl" 'paredit-forward-slurp-sexp
"gh" 'paredit-backward-slurp-sexp
"C-M-l" 'paredit-forward-barf-sexp
"C-M-h" 'paredit-backward-barf-sexp
"C-l" 'paredit-forward
"C-h" 'paredit-backward)
('normal cider-repl-mode-map
"gl" 'paredit-forward-slurp-sexp
"gh" 'paredit-backward-slurp-sexp
"C-M-l" 'paredit-forward-barf-sexp
"C-M-h" 'paredit-backward-barf-sexp
"C-l" 'paredit-forward
"C-h" 'paredit-backward))
;; (remove-hook 'prog-mode-hook 'enable-paredit-mode)
@ -2714,6 +2828,8 @@ targets."
(rustic-mode . eglot-ensure)
(rust-ts-mode . eglot-ensure)
:config
(setq eglot-autoshutdown t)
(defun chris/eglot-capf ()
(setq-local completion-at-point-functions
@ -2905,6 +3021,8 @@ targets."
dired-kill-when-opening-new-dired-buffer t)
(add-hook 'dired-mode-hook 'chris/setup-dired)
(custom-set-faces '(dired-directory ((t :foreground "#57c7ff" :inherit dired-header))))
:general
(chris/leader-keys
:states 'normal
@ -2948,10 +3066,6 @@ targets."
(use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode))
(use-package diredfl
:after dired
:config (diredfl-global-mode +1))
(use-package dired-rsync
:general
(general-def 'normal dired-mode-map
@ -3521,14 +3635,15 @@ targets."
(use-package nov
:mode ("\\.epub\\'" . nov-mode)
:config
(setq nov-text-width 80)
(defun chris/setup-nov-mode
(defun chris/setup-nov-mode ()
(interactive)
(setq visual-fill-column-width 90
visual-fill-column-center-text t)
(visual-fill-column-mode +1)
(display-line-numbers-mode -1)
(variable-pitch-mode +1)
(setq visual-fill-column-width 130
visual-fill-column-center-text t))
(variable-pitch-mode +1))
(add-hook 'nov-mode-hook 'chris/setup-nov-mode))
@ -3601,6 +3716,11 @@ targets."
(let* ((file (dired-get-filename)))
(empv-play-or-enqueue file)))
(defun chris/empv-seek-forward ()
"Seek forward 20 seconds"
(interactive)
(empv-seek "20"))
:general
(chris/leader-keys
:states 'normal
@ -3612,7 +3732,8 @@ targets."
"vy" 'empv-youtube-tabulated
"vn" 'empv-playlist-next
"vp" 'empv-playlist-prev
"vs" 'empv-playlist-select)
"vs" 'empv-playlist-select
"vS" 'chris/empv-seek-forward)
(general-def
:states 'normal
:keymaps 'empv-youtube-results-mode-map