diff --git a/README.org b/README.org index d106b413..a0360085 100644 --- a/README.org +++ b/README.org @@ -1626,17 +1626,16 @@ Org-Superstar makes the stars at the beginning of the line in =org-mode= a lot p *** Org Modern #+BEGIN_SRC emacs-lisp (use-package org-modern + :custom + (org-modern-timestamp nil) + (org-modern-table nil) + (org-modern-keyword nil) + (org-modern-star '("◉" "○" "◈" "◇" "✳")) :config - - (setq org-modern-timestamp nil - org-modern-table nil - org-modern-star '("◉" "○" "◈" "◇" "✳")) - (custom-set-faces '(org-modern-tag ((t :background "#9aedfe" :foreground "#282a36"))) ) - (global-org-modern-mode +1) - ) + (global-org-modern-mode +1)) #+END_SRC *** Org Additions from Doom Emacs @@ -2782,6 +2781,12 @@ Vertico is an alternative to Selectrum. Maybe using it will give me an even bett ;; A few more useful configurations... (use-package emacs + :defer nil + :bind + (:map evil-normal-state-map + ("SPC r j" . jump-to-register) + ("SPC r s" . copy-to-register) + ("SPC r m" . bookmark-set)) :init ;; Add prompt indicator to `completing-read-multiple'. ;; Alternatively try `consult-completing-read-multiple'. @@ -2808,6 +2813,9 @@ Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searc #+begin_src emacs-lisp (use-package consult :after vertico + :bind + (:map evil-normal-state-map + ("SPC s m" . consult-bookmark)) :config (setq consult-narrow-key "<" consult-project-root-function 'projectile-project-root) @@ -2852,7 +2860,6 @@ Consult has a lot of nice functions like Ivy's Counsel functions (enhanced searc "si" 'consult-imenu "so" 'consult-org-heading "sf" 'consult-fd - "sm" 'bookmark-jump "sF" 'consult-flymake "sx" 'xref-show-xrefs "sy" 'consult-yank-from-kill-ring diff --git a/init.el b/init.el index 690be41a..99e61f68 100644 --- a/init.el +++ b/init.el @@ -1127,17 +1127,16 @@ lesson file in my notes/lessons folder" )) (use-package org-modern + :custom + (org-modern-timestamp nil) + (org-modern-table nil) + (org-modern-keyword nil) + (org-modern-star '("◉" "○" "◈" "◇" "✳")) :config - - (setq org-modern-timestamp nil - org-modern-table nil - org-modern-star '("◉" "○" "◈" "◇" "✳")) - (custom-set-faces '(org-modern-tag ((t :background "#9aedfe" :foreground "#282a36"))) ) - (global-org-modern-mode +1) - ) + (global-org-modern-mode +1)) ;;; lang/org/autoload/org.el -*- lexical-binding: t; -*- @@ -1968,6 +1967,12 @@ Describe everything that follows in the present tense, in response to what I typ ;; A few more useful configurations... (use-package emacs + :defer nil + :bind + (:map evil-normal-state-map + ("SPC r j" . jump-to-register) + ("SPC r s" . copy-to-register) + ("SPC r m" . bookmark-set)) :init ;; Add prompt indicator to `completing-read-multiple'. ;; Alternatively try `consult-completing-read-multiple'. @@ -1990,6 +1995,9 @@ Describe everything that follows in the present tense, in response to what I typ (use-package consult :after vertico + :bind + (:map evil-normal-state-map + ("SPC s m" . consult-bookmark)) :config (setq consult-narrow-key "<" consult-project-root-function 'projectile-project-root) @@ -2034,7 +2042,6 @@ Describe everything that follows in the present tense, in response to what I typ "si" 'consult-imenu "so" 'consult-org-heading "sf" 'consult-fd - "sm" 'bookmark-jump "sF" 'consult-flymake "sx" 'xref-show-xrefs "sy" 'consult-yank-from-kill-ring diff --git a/org-publish.el b/org-publish.el index 9f040524..04f91ef3 100644 --- a/org-publish.el +++ b/org-publish.el @@ -6,6 +6,70 @@ (require 's) (require 'f) +(defun async-export-function (chunk index) + "A function to build a future that will export all it's chunk's files" + (let ((func `(lambda () + (setq lexical-binding t) + (shell-command (format "emacsclient -e '(message \"%s\")'" ',chunk)) + (require 's) + (require 'org) + (require 'ox) + (require 'ox-html) + (require 'htmlize) + (require 'denote) + (require 'denote-org) + (cl-loop for file in ',chunk do + (setq find-file-hook '()) + (setq org-mode-hook '()) + ;; (message "%s" file) + (shell-command (format "emacsclient -e '(message \"%s\")" file)) + (with-current-buffer (find-file file) + (re-search-forward ".*EXPORT_FILE_NAME:" nil t) + (beginning-of-line) + (let* ((export-line? (search-forward "EXPORT_FILE_NAME" (line-end-position) t)) + (export-line (when export-line? + (delete-and-extract-region + (line-beginning-position) (line-end-position)))) + (find-file-hook '()) + (gc-cons-threshold 50000000) + (org-mode-hook '()) + (create-lockfiles nil) + (org-export-with-broken-links 'mark) + (org-export-with-section-numbers nil) + (org-html-html5-fancy t) + (org-html-validation-link nil) + (make-backup-files nil) + (org-export-with-title t) + (org-html-head-include-default-style nil) + (org-html-head "") + (denote-directory "/home/chris/docs/site/content") + (export-directory + (concat "/home/chris/" + "docs/site/public/" + (if (s-contains? "content/teaching" file) + "teaching/" + "notes/"))) + (html-file (concat export-directory + (org-export-output-file-name ".html"))) + (org-export-coding-system org-html-coding-system)) + (denote-org-convert-links-to-file-type) + (widen) + (org-update-all-dblocks) + (replace-string-in-region "../site/content/" "./" + (point-min) (point-max)) + (org-export-to-file 'html html-file) + (when export-line? (insert export-line)) + (save-buffer) + (kill-buffer))))))) + + (message "Exporting chunk %s out of %s with files: %s" index (- (length chunks) 1) + (mapcar (lambda (file) + (concat "\n" file)) chunk)) + + (async-start + func + 'ignore))) + (defun chris/org-publish-site () "Publish my website by pushing files to specific locations" (interactive) @@ -18,6 +82,8 @@ (denote-directory "~/docs/site/content") (current-notes (directory-files "~/docs/site/content/notes" t ".*.org$")) (current-lessons (directory-files "~/docs/site/content/teaching" t ".*.org$")) + (warning-minimum-level :error) + (inhibit-message) (create-lockfiles nil) (org-export-with-broken-links 'mark) (org-export-with-section-numbers nil) @@ -72,174 +138,12 @@ 'list (directory-files "~/docs/site/content/notes" t ".*.org$") (directory-files "~/docs/site/content/teaching" t ".*.org$"))) - (counter 0)) - (cl-loop for file in files and index from 0 - do (let* ((func `(lambda () - (setq lexical-binding t) - (require 's) - (require 'org) - (require 'ox) - (require 'ox-html) - (require 'htmlize) - (require 'denote) - (require 'denote-org) - (setq find-file-hook '()) - (setq org-mode-hook '()) - (with-current-buffer (find-file ,file) - (re-search-forward "EXPORT_FILE_NAME" nil t) - (beginning-of-line) - (let* ((export-line (delete-and-extract-region - (line-beginning-position) (line-end-position))) - (create-lockfiles nil) - (org-export-with-broken-links 'mark) - (org-export-with-section-numbers nil) - (org-html-html5-fancy t) - (org-html-validation-link nil) - (make-backup-files nil) - (org-export-with-title t) - (org-html-head-include-default-style nil) - (org-html-head "") - (denote-directory "/home/chris/docs/site/content") - (export-directory - (concat "/home/chris/" - "docs/site/public/" - (if (s-contains? "content/teaching" ,file) - "teaching/" - "notes/"))) - (html-file (concat export-directory - (org-export-output-file-name ".html"))) - (org-export-coding-system org-html-coding-system)) - (denote-org-convert-links-to-file-type) - (widen) - (org-update-all-dblocks) - (replace-string-in-region "../site/content/" "./" - (point-min) (point-max)) - (org-export-to-file 'html html-file) - (insert export-line) - (save-buffer) - (kill-buffer)))))) + (workers 8) + (chunks (seq-split files (ceiling (/ (length files) workers)))) + (futures (cl-loop for chunk in chunks and index from 0 + collect (async-export-function chunk index)))) + (mapcar #'async-get futures) + (message "Finished exporting all files")))) - (message "Exporting %s out of %s files: %s" index (length files) file) - (setq counter (+ counter 1)) - (while (> counter 12) - (sit-for 0.5)) - (message "Exporting %s out of %s files: %s" index (length files) file) - (async-start - func - (lambda (result) - (message "Finished %s" index (length files) file) - (setq counter (- counter 1)))) - - ))))) - -(defun chris/website-dynamic-block () - "A function to load up the links on the homepage for the website" - (let (files (directory-files "~/docs/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/site/content/notes/" t ".*.org")) - (cl-loop for file in files - do (insert (denote--link-get-description file))))) - -(let ((func (lambda () - (let ((lexical-binding t) - (find-file-hook '()) - (gc-cons-threshold 50000000) - (org-mode-hook '())) - (require 's) - (require 'org) - (require 'ox) - (require 'ox-html) - (require 'htmlize) - (require 'denote) - (require 'denote-org) - (with-current-buffer (find-file "/home/chris/docs/site/content/teaching/20260311T141831--zealots-and-cripples__lesson_project_tfc.org") - (re-search-forward "EXPORT_FILE_NAME" nil t) - (beginning-of-line) - (let* ((export-line (delete-and-extract-region - (line-beginning-position) (line-end-position))) - (create-lockfiles nil) - (org-export-with-broken-links 'mark) - (org-export-with-section-numbers nil) - (org-html-html5-fancy t) - (org-html-validation-link nil) - (make-backup-files nil) - (org-export-with-title t) - (org-html-head-include-default-style nil) - (org-html-head "") - (denote-directory "/home/chris/docs/site/content") - (export-directory - (concat "/home/chris/" - "docs/site/public/" - (if (s-contains? "content/teaching" "/home/chris/docs/site/content/teaching/20260311T141831--zealots-and-cripples__lesson_project_tfc.org") - "teaching/" - "notes/"))) - (html-file (concat export-directory - (org-export-output-file-name ".html"))) - (org-export-coding-system org-html-coding-system)) - (denote-org-convert-links-to-file-type) - (widen) - (org-update-all-dblocks) - (message "%s" html-file) - (replace-string-in-region "../site/content/" "./" - (point-min) (point-max)) - (org-export-to-file 'html html-file) - (insert export-line) - (save-buffer) - (kill-buffer))))))) - (save-excursion - (funcall func))) -;; (add-to-list 'org-dynamic-block-alist '("chris-site-notes" . chris/website-dynamic-block)) - -;; (setq org-publish-project-alist -;; `(("home" -;; :base-directory "~/docs/site/content" -;; :base-extension "org" -;; :recursive nil -;; :html-doctype "html5" -;; :html-html5-fancy t -;; :html-self-link-headlines t -;; :html-head "" -;; :html-head "" -;; :publishing-directory "~/docs/notes/site/public/" -;; :publishing-function org-html-publish-to-html) -;; ("posts" -;; :base-directory "~/docs/site/content/notes" -;; :base-extension "org" -;; :recursive nil -;; :html-doctype "html5" -;; :html-html5-fancy t -;; :html-self-link-headlines t -;; :htmlized-source t -;; :html-head "" -;; :publishing-directory "~/docs/site/public/notes/" -;; :publishing-function org-html-publish-to-html) -;; ("teaching" -;; :base-directory "~/docs/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 "" -;; :publishing-directory "~/docs/site/public/teaching/" -;; :publishing-function org-html-publish-to-html) -;; ("static" -;; :base-directory "~/docs/site/assets/" -;; :base-extension "css\\|txt\\|jpg\\|gif\\|png" -;; :recursive t -;; :html-doctype "html5" -;; :html-html5-fancy t -;; :publishing-directory "~/docs/site/public/static/" -;; :publishing-function org-publish-attachment) -;; ("cochrun.xyz" :components ("home" "posts" "static" "teaching")))) - -;; (setq org-html-postamble t -;; org-html-postamble-format '(("en" -;; ""))) (chris/org-publish-site)