#+OPTIONS: toc:nil num:nil creator:nil author:nil ** Wed Mar 15 09:15 EDT; goldblum Screwtape mentioned my snippet from the weekend from my phlog publishing setup, and it made me cringe because it's all a work in progress and I already cleaned it up a bit. So, here's an update. First, you can find the whole emacs config on sourcehut at https://git.sr.ht/~mhcat/neumacs, which will be the current version (modulo the last 24 hours of fuckery). Next, a little context. Currently I do a sshfs mount to the system I'm running [hole,omar].mhcat.[space,dev], like so: #+begin_src bash mount -t sshfs omar.local:/srv/gopher $HOME/gopher #+end_src which depends on fuse ssh filesystem support locally. Being over ssh, no particular server support is required for it to work, so I *could* just as easily use a mount for SDF too, rather than a tramp location. Or vice versa. Third, I have an org capture template for my phlog, which puts entries right into my master ~log.org~ file. It drops me into that file after, and I just run the manual ~org-publish~ command after giving it a once over. Finally, once the first entry is shipped to my SDF gopher directory, it's included in my SDF ~gophermap~ using the (what I think is a gophernicus extension) `=` directive, under the "Latest entry:" line. The snippets below are the current state, but I am now planning two major changes. First, I want to break out a file per entry. I'll keep the single org file master copy, but I need entries to be addressable. Second, I need to stop including the entire entry in the main SDF ~gophermap~, because it is too much for an index. Maybe a paragraph, or a couple lines and an ellipsis, and a link to the file for the entry rather than the whole big thing. So, expect another one of these updates to appear in the next few days. #+begin_src emacs-lisp :title "capture template" (setopt org-capture-templates `(("p" "Phlog" entry (file+headline ,(concat (getenv "HOME") "/gopher/log.org") "Journal of the Damned") "* %<%a %b %e %R %Z>; %(system-name)\n%?%i" :prepend t :jump-to-captured t) ;; ... more templates ... )) #+end_src #+begin_src emacs-lisp :title "publish config" (require 'org-element) (defun j0ni/prepare-first-entry (plist filename dst-dir) (let* ((org-inhibit-startup t) (visiting (find-buffer-visiting filename)) (work-buffer (or visiting (find-file-noselect filename))) (dst-file (expand-file-name "first.org" dst-dir))) (with-current-buffer work-buffer (let ((entry (org-element-map (org-element-parse-buffer) 'headline (lambda (hl) (when (= (org-element-property :level hl) 2) hl)) nil t))) (with-temp-buffer (insert (org-element-interpret-data entry)) (write-region (point-min) (point-max) dst-file)))))) (let ((gopher-dir (concat (getenv "HOME") "/gopher/"))) (setopt org-publish-project-alist `(("captains-phlog" :include ("log.org") :exclude "first.org" :base-directory ,gopher-dir :publishing-directory ,gopher-dir :publishing-function (org-ascii-publish-to-ascii j0ni/prepare-first-entry)) ("first-entry" :include ("first.org") :exclude "log.org" :base-directory ,gopher-dir :publishing-directory "/ssh:sdf:~/gopher/" :publishing-function org-ascii-publish-to-ascii :ascii-underline nil :ascii-text-width 60 :with-toc nil :with-title nil :with-author nil :with-creator nil :section-numbers nil :headline-levels 1) ("phlog" :components ("captains-phlog" "first-entry")) ;; ... more projects ))) #+end_src #+begin_export nil ... 1A Hole In MHCat's Dot Space / hole.mhcat.space 70 0Captain's Phlog /log.txt hole.mhcat.space 70 Latest entry: =first.txt Local bits: ... #+end_export