From 9a6d555b718a3c66518a85274bcfbaeac779640d Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Fri, 23 Feb 2024 22:20:25 -0800 Subject: [PATCH] Fixed publishing bug. --- bootstrap.org | 43 +++++++++++++++++++++++++------------------ ha-org-publishing.org | 15 ++++++--------- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/bootstrap.org b/bootstrap.org index c8da13a..845c560 100644 --- a/bootstrap.org +++ b/bootstrap.org @@ -149,8 +149,8 @@ Hopefully, this will tie me over while I transition. I actually run two instances of Emacs on some systems, where one instance has all my work-related projects, perspectives, and packages installed (like LSP), and my personal instance has other packages running (like IRC and Mail). I need a function that can make that distinction, and based on that, it will set =server-start= appropriately, so that =emacsclient= can call into the correct one. #+begin_src emacs-lisp (defun ha-emacs-for-work? () - "Return non-nil when the Emacs application's location matches as one for work. - Based on initially running the app with a `FOR_WORK' environment variable." + "Return non-nil when the Emacs instance is for work. + Matches based on a `FOR_WORK' environment variable." (and (f-dir? "~/work") (getenv "FOR_WORK"))) #+end_src @@ -222,8 +222,10 @@ The list of /hamacs/ org-formatted files stored in =ha-hamacs-files= is selectiv With this function, we can test/debug/reload any individual file, via: #+begin_src emacs-lisp (defun ha-hamacs-load (file) - "Load or reload an org-mode FILE containing literate Emacs configuration code." - (interactive (list (completing-read "Org file: " (ha-hamacs-files :all)))) + "Load or reload an org-mode FILE containing literate + Emacs configuration code." + (interactive (list (completing-read "Org file: " + (ha-hamacs-files :all)))) (let ((full-file (f-join hamacs-source-dir file))) (when (f-exists? full-file) (ignore-errors @@ -233,8 +235,10 @@ With this function, we can test/debug/reload any individual file, via: And the ability to edit the file: #+begin_src emacs-lisp (defun ha-hamacs-find-file (file) - "Call `find-file' on relative org-mode FILE containing literate Emacs configuration code." - (interactive (list (completing-read "Org file: " (ha-hamacs-files :all)))) + "Call `find-file' on relative org-mode FILE containing + literate Emacs configuration code." + (interactive (list (completing-read "Org file: " + (ha-hamacs-files :all)))) (let ((full-file (f-join hamacs-source-dir file))) (find-file full-file))) #+end_src @@ -242,18 +246,21 @@ And the ability to edit the file: And this similar function, will /tangle/ one of my files. Notice that in order to increase the speed of the tangling process (and not wanting to pollute a project perspective), I use a /temporary buffer/ instead of =find-file=. #+begin_src emacs-lisp -(defun ha-hamacs-tangle (file) - "Tangle an org-mode FILE containing literate Emacs configuration code." - (interactive (list (completing-read "Org file: " (ha-hamacs-files :all)))) - (let ((full-file (f-join hamacs-source-dir file)) - (target (file-name-concat "~/emacs.d/elisp" - (concat (file-name-sans-extension file) ".el")))) - (when (f-exists? full-file) - (ignore-errors - (with-temp-buffer - (insert-file-contents full-file) - (with-current-buffer (concat temporary-file-directory file) - (org-babel-tangle nil target (rx "emacs-lisp")))))))) + (defun ha-hamacs-tangle (file) + "Tangle an org-mode FILE containing literate Emacs + configuration code." + (interactive (list (completing-read "Org file: " + (ha-hamacs-files :all)))) + (let ((full-file (f-join hamacs-source-dir file)) + (target (file-name-concat "~/emacs.d/elisp" + (concat (file-name-sans-extension file) + ".el")))) + (when (f-exists? full-file) + (ignore-errors + (with-temp-buffer + (insert-file-contents full-file) + (with-current-buffer (concat temporary-file-directory file) + (org-babel-tangle nil target (rx "emacs-lisp")))))))) #+end_src And we can now reload /all/ startup files: diff --git a/ha-org-publishing.org b/ha-org-publishing.org index 8c8718b..a264f3c 100644 --- a/ha-org-publishing.org +++ b/ha-org-publishing.org @@ -313,19 +313,15 @@ Using =rsync= to keep published files in sync with my website: (cdr))) (parent (plist-get conf :publishing-directory)) (combos (cond - ((equal project "blog-content") + ((s-starts-with? "blog" project) '("Technical" "howardism" "Personal" "howardism" "index.html" "howardism" "about-me.html" "howardabrams")) - ((equal project "blog-static") "howardism") - ((equal project "blog-rss") "howardism") - ((equal project "tech-notes") "howardabrams/technical") - ((equal project "tech-notes-static") "howardabrams/technical") - ((equal project "hamacs") "howardabrams/hamacs") - ((equal project "hamacs-static") "howardabrams/hamacs") - ((equal project "airbnb") "howardabrams/airbnb") - ((equal project "airbnb-static") "howardabrams/airbnb")))) + ((s-starts-with? "tech" project) + '("" "howardabrams")) + ((s-starts-with? "hamacs" project) '("" "howardabrams")) + ((s-starts-with? "airbnb" project) '("" "howardabrams"))))) ;; (dolist (tuple (seq-partition combos 2)) ;; (seq-let (src dest) tuple ;; (format "rsync -az %s/%s %s:%s" parent src host dest))) @@ -333,6 +329,7 @@ Using =rsync= to keep published files in sync with my website: (seq-map (lambda (tuple) (seq-let (src dest) tuple (format "rsync -avz %s%s %s:%s" parent src host dest)))) (s-join "; ") + (message) (async-shell-command)))) #+end_src * Keybindings