Fixed publishing bug.

This commit is contained in:
Howard Abrams 2024-02-23 22:20:25 -08:00
parent 2778151656
commit 9a6d555b71
2 changed files with 31 additions and 27 deletions

View file

@ -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:

View file

@ -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