skip to content

Groundhog Emacs

Groundhog Emacs is my (emsenn's) Emacsen.

Plans

Figure out org-attach

User Guide

I don't plan on writing on even starting writing a guide until the end of Winter, 2020, since that'll only mark three months of using the system and my procedures have been churning heavily since then. What's below are some notes to self, that I wanted to make sure I had when it comes time to write the guide:

Note-taking

Reference notes

  • Link up every precise term that's mentioned

Term notes

  • Link up every precise term that's mentioned

Comment notes

  • Link to references
  • Include definitions as asides under the paragraph where they're mentioned.

Configuration

Email

(setq user-mail-address "emsenn@emsenn.net")

Save configuration

(setq make-backup-files nil)

Startup configuration

(setq inhibit-startup-message t)
(setq visible-bell 1)
(setq inhibit-startup-screen t)

Scratch configuration

(setq initial-scratch-message ";; Groundhog Emacs has some bugs\n;; Press C-x C-e after the following lines to fix them\n(ivy-mode)\n")

Interface configuration

(menu-bar-mode -1)
(tool-bar-mode -1)
(show-paren-mode 1)
(setq line-number-mode t)
(setq column-number-mode t)
(setq-default truncate-lines t)
(setq-default line-spacing 1)
(setq sentence-end-double-space nil)
(global-visual-line-mode t)

Basic behavior configuration

(setq echo-keystrokes 0.1)
(setq fill-column 68)
(setq mouse-wheel-scroll-amount '(1 ((shift) .1)))

Org-mode configuration

(setq org-directory "~/org")
(setq org-startup-folded 'fold)
(setq org-hide-block-startup 'hideblocks)
(setq org-catch-invisible-edits 'show-and-error)
(setq org-agenda-files (list "~/org"))
(setq org-export-with-section-numbers nil)
(setq org-export-with-smart-quotes nil)
(setq org-export-with-toc nil)
(setq org-html-htmlize-output-type 'nil)
(setq org-html-validation-link nil)
(setq org-log-done 'time)
(setq org-log-into-drawer 'LOGBOOK)
(setq org-image-actual-width '(400))

Org-mode capture templates

Source block (s)

("s" "Capture source code block")
Elisp source block (se)
("se" "Elisp code block"
	     plain (clock)
	     ,(concat "#+name: %^{NAME}-elisp\n"
		      "#+caption: %^{CAPTION}\n"
		    "#+begin_src elisp %^{HEADER-ARGS}\n"
		    "%?\n"
		    "#+end_src\n"))

Org-mode projects

Records catalog project

("records" :components ("all-records" "term-records" "comment-records" "reference-records" "daily-records"))

All records project

("all-records"
 :base-extension "org"
 :publishing-function org-html-publish-to-html
 :html-doctype "html5"
 :html-html5-fancy t
 :html-container "section"
 :headline-levels 6
 :recursive t
 :html-divs ((preamble "section" "preamble")
	    (content "main" "content")
	    (postamble "section" "postamble"))
 :publishing-function org-html-publish-to-html
 :html-format-drawer-function ghe-org-html-format-drawer
 :html-head-include-scripts nil
 :html-head-include-default-style nil
 :html-head ,ghe-org-html-head
 :exclude ,(regexp-opt '("README.org" "PRIVATE"))
 :with-footnotes t
 :with-toc nil
 :with-drawers t
 :base-directory "~/org/s/"
 :publishing-directory "~/org/p"
 :makeindex t
 :html-preamble ,ghe-org-html-base-preamble)

Term records project

("term-records"
 :base-extension "org"
 :publishing-function org-html-publish-to-html
 :html-doctype "html5"
 :html-html5-fancy t
 :html-container "section"
 :headline-levels 6
 :recursive t
 :html-divs ((preamble "section" "preamble")
	    (content "main" "content")
	    (postamble "section" "postamble"))
 :publishing-function org-html-publish-to-html
 :html-format-drawer-function ghe-org-html-format-drawer
 :sitemap-function ghe-org-publish-format-sitemap
 :html-head-include-scripts nil
 :html-head-include-default-style nil
 :html-head ,ghe-org-html-head
 :exclude ,(regexp-opt '("README.org" "PRIVATE"))
 :auto-sitemap t
 :with-footnotes t
 :with-toc nil
 :with-drawers t
 :base-directory "~/org/s/term"
 :publishing-directory "~/org/p/term"
 :html-preamble ,ghe-org-html-subdir-preamble
 :sitemap-filename "index.org"
 :sitemap-sort-files alphabetically
 :sitemap-title "Term Index")

Comment records project

("comment-records"
 :base-extension "org"
 :publishing-function org-html-publish-to-html
 :html-doctype "html5"
 :html-html5-fancy t
 :html-container "section"
 :headline-levels 6
 :recursive t
 :html-divs ((preamble "section" "preamble")
	    (content "main" "content")
	    (postamble "section" "postamble"))
 :publishing-function org-html-publish-to-html
 :html-format-drawer-function ghe-org-html-format-drawer
 :sitemap-function ghe-org-publish-format-sitemap
 :html-head-include-scripts nil
 :html-head-include-default-style nil
 :html-head ,ghe-org-html-head
 :exclude ,(regexp-opt '("README.org" "PRIVATE"))
 :auto-sitemap t
 :with-footnotes t
 :with-toc nil
 :with-drawers t
 :base-directory "~/org/s/com"
 :publishing-directory "~/org/p/com"
 :html-preamble ,ghe-org-html-subdir-preamble
 :sitemap-filename "index.org"
 :sitemap-sort-files anti-chronologically
 :sitemap-title "Communications Index")

Reference records project

("reference-records"
 :base-extension "org"
 :publishing-function org-html-publish-to-html
 :html-doctype "html5"
 :html-html5-fancy t
 :html-container "section"
 :headline-levels 6
 :recursive t
 :html-divs ((preamble "section" "preamble")
	    (content "main" "content")
	    (postamble "section" "postamble"))
 :publishing-function org-html-publish-to-html
 :html-format-drawer-function ghe-org-html-format-drawer
 :sitemap-function ghe-org-publish-format-sitemap
 :html-head-include-scripts nil
 :html-head-include-default-style nil
 :html-head ,ghe-org-html-head
 :exclude ,(regexp-opt '("README.org" "PRIVATE"))
 :auto-sitemap t
 :with-footnotes t
 :with-toc nil
 :with-drawers t
 :base-directory "~/org/s/ref"
 :publishing-directory "~/org/p/ref"
 :html-preamble ,ghe-org-html-subdir-preamble
 :sitemap-filename "index.org"
 :sitemap-sort-files alphabetically
 :sitemap-title "Reference Index")

Daily records project

("daily-records"
 :base-extension "org"
 :publishing-function org-html-publish-to-html
 :html-doctype "html5"
 :html-html5-fancy t
 :html-container "section"
 :headline-levels 6
 :recursive t
 :html-divs ((preamble "section" "preamble")
	    (content "main" "content")
	    (postamble "section" "postamble"))
 :publishing-function org-html-publish-to-html
 :html-format-drawer-function ghe-org-html-format-drawer
 :sitemap-function ghe-org-publish-format-sitemap
 :html-head-include-scripts nil
 :html-head-include-default-style nil
 :html-head ,ghe-org-html-head
 :exclude ,(regexp-opt '("README.org" "PRIVATE"))
 :auto-sitemap t
 :with-footnotes t
 :with-toc nil
 :with-drawers t
 :base-directory "~/org/s/daily"
 :publishing-directory "~/org/p/daily"
 :html-preamble ,ghe-org-html-subdir-preamble
 :sitemap-filename "index.org"
 :sitemap-sort-files anti-chronologically
 :sitemap-title "Daily Index")

Teraum project

("teraum"
 :base-extension "org"
 :publishing-function org-html-publish-to-html
 :html-doctype "html5"
 :html-html5-fancy t
 :html-container "section"
 :headline-levels 6
 :recursive t
 :html-divs ((preamble "section" "preamble")
	     (content "main" "content")
	     (postamble "section" "postamble"))
 :publishing-function org-html-publish-to-html
 :html-format-drawer-function ghe-org-html-format-drawer
 :sitemap-function ghe-org-publish-format-sitemap
 :html-head-include-scripts nil
 :html-head-include-default-style nil
 :html-head ,ghe-org-html-head
 :exclude ,(regexp-opt '("README.org" "PRIVATE"))
 :auto-sitemap t
 :with-footnotes t
 :with-toc nil
 :with-drawers t
 :base-directory "~/org/s/teraum"
 :publishing-directory "~/org/p/teraum"
 :html-preamble ,ghe-org-html-subdir-preamble
 :sitemap-filename "index.org"
 :sitemap-sort-files anti-chronologically
 :sitemap-title "Teraum Index")

Org-roam configuration

Org-roam immediate capture template

("B" "blank term" plain
 (function org-roam--capture-get-point)
 "*/[[file:${slug}.org][${title}]]/* hasn't been defined yet.\n"
 :file-name "term/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+index: ${title}\n"
		"#+name: ${slug}-definition\n")
 :unnarrowed t
 :immediate-finish t)

Org-roam capture templates

Org-roam term capture template
("t" "term" plain
 (function org-roam--capture-get-point)
 "*/[[file:${slug}.org][${title}]]/* %?\n"
 :file-name "term/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+index: ${title}\n"
		"#+name: ${slug}-definition\n")
 :unnarrowed t)
Org-roam reference capture template
("r" "reference" plain
 (function org-roam--capture-get-point)
 ,(concat "#+author: %^{Author?}\n"
	  "#+date: %^{Date?}\n"
	  "#+roam_tags: unincorporated-reference\n"
	  "#+index: %^{Index?}!references!${title}\n"
	  "#+name: ${slug}-definition\n"
	  "*/[[file:${slug}.org][${title}]]/* is an [[file:../term/unincorporated-reference.org][unincorporated reference]].\n")
 :file-name "ref/${slug}"
 :head ,(concat "#+title: ${title}\n")
 :unnarrowed t)
Org-roam comment capture template
("c" "comment" plain
 (function org-roam--capture-get-point)
		"#+index: %^{Index?}!comments!${slug}\n\n%?\n"
 :file-name "com/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+roam_tags: comment\n")
 :unnarrowed t)
Org-roam Teraum capture templates
Org-roam Teraum term capture template
("Tt" "term" plain
 (function org-roam--capture-get-point)
 "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an term of [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %f\n\n      %?\n   :END:\n"
 :file-name "teraum/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum\n"
		"#+end_head\n\n")
 :unnarrowed t)
Org-roam Teraum area capture template
("Ta" "area" plain
 (function org-roam--capture-get-point)
 "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an area of [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
 :file-name "teraum/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum area\n"
		"#+end_head\n\n")
 :unnarrowed t)
Org-roam Teraum year capture template
("Ty" "year" plain
 (function org-roam--capture-get-point)
 "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is a year in [[file:teraum_s_history.org][Teraum's history]].\n\n#+toc: headlines 2\n\n%?\n\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
 :file-name "teraum/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum year\n"
		"#+end_head\n\n")
 :unnarrowed t)
Org-roam Teraum date capture template
("Td" "date" plain
 (function org-roam--capture-get-point)
 "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is a date in [[file:teraum_s_history.org][Teraum's history]].\n\n#+toc: headlines 2\n\n%?\n\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
 :file-name "teraum/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum date\n"
		"#+end_head\n\n")
 :unnarrowed t)
Org-roam Teraum species capture template
("Ts" "species" plain
 (function org-roam--capture-get-point)
 "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an species from [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
 :file-name "teraum/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum species\n"
		"#+end_head\n\n")
 :unnarrowed t)
Org-roam Teraum person capture template
("Tp" "species" plain
 (function org-roam--capture-get-point)
 "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an person from [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n   :END:\n"
 :file-name "teraum/${slug}"
 :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum person\n"
		"#+end_head\n\n")
 :unnarrowed t)

Org-roam dailies capture templates

("d" "daily" plain
 #'org-roam-capture--get-point
 "- [[%f][%?]]\n"
 :file-name "daily/%<%Y-%m-%d>"
 :head ,(concat "#+title: %<%Y-%m-%d>\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+roam_tags: daily\n"
		"This is some changes that were made to this record catalog on %u.\n"))

Components

Bugfixes & Version-handling

Isearch occurence bug

  • Note taken on [2021-01-01 Fri 17:34]

When I was first setting up Groundhog Emacs, I looked at Alex Schröder's Emacs configuration, and it had code for fixing a bug with Isearch's behavior. I copied the code into GHE without really thinking about it, but having taken the time to look at bug's thread, I'm not convinced it's necessary to use this.

(defadvice isearch-occur (after isearch-occur-fix activate)
  "Fixes bug #20971: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20971"
  (setq buffer-read-only nil))

TLS fix for Emacs <26.3

(if (and (version< emacs-version "26.3") (>= libgnutls-version 30600))
    (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))

Straight.el and use-package

Requires Git be installed.

Straight.el bootstrapping

(defvar straight-install-script-path
  "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el")

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
    (url-retrieve-synchronously straight-install-script-path
     'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

Use-package bootstrapping

(straight-use-package 'use-package)

Tao theme

(use-package darktooth-theme :straight t
  :config
  (load-theme 'darktooth t))

HTMLize

(use-package htmlize :straight t)

Ivy

(use-package ivy
      :straight t
      :diminish (ivy-mode . "")
      :bind (("C-c C-r" . ivy-resume))
      :config (ivy-mode 1)
      (setq ivy-use-virtual-buffers t)
      (setq ivy-height 12)
      (setq ivy-count-format "(%d/%d) ")
      (setq ivy-initial-inputs-alist nil)
      (setq ivy-re-builders-alist
	'((read-file-name-internal . ivy--regex-fuzzy)
	  (t . ivy--regex-ignore-order))))

Fennel-mode

(use-package fennel-mode :straight t
  :mode "\\.fnl\\'"
  :interpreter "fennel"
  :custom
  (inferior-lisp-program "/home/emsenn/.luarocks/bin/fennel"))

Lua-mode

(use-package lua-mode :straight t
  :mode "\\.lua\\'"
  :interpreter "lua")

Racket-mode

(use-package racket-mode :straight t
  :mode "\\.rkt\\'"
  :interpreter "racket")

rcIRC

(use-package rcirc :straight t
  :custom
  (rcirc-time-format "%Y-%m-%d %H:%M ")
  (rcirc-default-nick "emsenn")
  (rcirc-default-user-name "emsenn")
  (rcirc-default-full-name "emsenn")
  (rcirc-server-alist '(("irc.freenode.net" :channels ("webgaz" "qtops"))))
  :config
  (rcirc-connect "irc.freenode.net"))

Magit

(use-package magit :straight t)

Olivetti

(use-package olivetti :straight t)

Org-mode

(use-package
 org :straight t
 :config 
 (setq org-directory "~/org")
 (setq org-startup-folded 'fold)
 (setq org-hide-block-startup 'hideblocks)
 (setq org-catch-invisible-edits 'show-and-error)
 (setq org-agenda-files (list "~/org"))
 (setq org-export-with-section-numbers nil)
 (setq org-export-with-smart-quotes nil)
 (setq org-export-with-toc nil)
 (setq org-html-htmlize-output-type 'nil)
 (setq org-html-validation-link nil)
 (setq org-log-done 'time)
 (setq org-log-into-drawer 'LOGBOOK)
 (setq org-image-actual-width '(400))
 (setq ghe-org-html-base-preamble
     (concat "<a href=\"#content\" class=\"skip-to-content\">skip to content</a>"
	    "<section class=\"nav\"><strong>Website navigation:</strong> "
	    "<a href=\"./index.html\">"
	    "homepage</a> | "
	    "<a href=\"./term/index.html\">"
	    "definitions</a> | "
	    "<a href=\"./ref/index.html\">"
	    "references"
	    "</a> | "
	    "<a href=\"./com/index.html\">"
	    "communication"
	    "</a> | "
	    "<a href=\"./daily/index.html\">"
	    "daily summary"
	    "</a>"
	    "<p>"
	    "This Website was cultivated as a public asset with <a href=\"https://ko-fi.com/emsenn\">support</a> from people like you. <strong><em>Thank you!</em></strong>"
	    "</p>"
	    "<details>"
	    "<summary>Click this sentence for information about this Website.</summary>"
	    "<p>Click each sentence below for more information about each topic.</p>"
	    "<ul>"
	    "<li>"
	    "<details>"
	    "<summary>This Website is a collection of records linked through their relationship to each other.</summary>"
	    "<p>Each page on this Website is <em>record</em> of <em>information</em>. (There are <a href=\"./record.html\">records</a> with more <a href=\"./information.html\">information</a> about both of those concepts.) On the <a href=\"./Web.html\">Web</a>, these records are <a href=\"hypertext\">hypertext</a>: they contain links to each other (and other resources). The table below demonstrates link styling."
	    "<table>"
	    "<thead><tr>"
	    "<th scope=\"col\">Color</th>"
	    "<th scope=\"col\">Link type</th>"
	    "</tr></thead>"
	    "<tbody>"
	    "<tr>"
	    "<td class=\"link\">Sample</td>"
	    "<td>Unvisited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-link\">Sample</td>"
	    "<td>Visited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"external-link\">Sample</td>"
	    "<td>Unvisited external resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-external-link\">Sample</td>"
	    "<td>Visited external resource</td>"
	    "</tr>"
	    "</table>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>It was created by one human person wishing to communicate with others.</summary>"
	    "<p>It was created by me, <a href=\"./emsenn.html\">emsenn</a>, to share some of my <a href=\"./knowledge.html\">knowledge</a> with <a href=\"./person.html\">people</a> on the <a href=\"Web.html\">Web</a>.</p>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>Each Webpage contains a <em>record</em> of <em>information</em>.</summary>"
	    "<p>Each Webpage on my Website is a <a href=\"./record.html\">record</a> of <a  href=\"information.html\">information</a>. These records have different components, depending on what type they are, but here's some common components:"
	    "<dl>"
	    "<dt>Introduction</dt>"
	    "<dd>A record's <em>introduction</em> describes the record, including what <a href=\"./permission.html\">permissions</a> are granted.</dd>"
	    "<dt>Backlinks</dt>"
	    "<dd>A record's <a href=\"./backlink.html\">backlinks</a> shows which other records link to this one.</dd>"
	    "</dl>"
	    "</details>"
	    "</li>"
	    "</ul>"
	    "</section>"
      ))
 (setq ghe-org-html-subdir-preamble
     (concat "<a href=\"#content\" class=\"skip-to-content\">skip to content</a>"
	    "<section class=\"nav\"><strong>Website navigation:</strong> "
	    "<a href=\"../index.html\">"
	    "homepage</a> | "
	    "<a href=\"../term/index.html\">"
	    "definitions</a> | "
	    "<a href=\"../ref/index.html\">"
	    "references"
	    "</a> | "
	    "<a href=\"../com/index.html\">"
	    "communication"
	    "</a> | "
	    "<a href=\"../daily/index.html\">"
	    "daily summary"
	    "</a>"
	    "<p>"
	    "This Website was cultivated as a public asset with <a href=\"https://ko-fi.com/emsenn\">support</a> from people like you. <strong><em>Thank you!</em></strong>"
	    "</p>"
	    "<details>"
	    "<summary>Click this sentence for information about this Website.</summary>"
	    "<p>Click each sentence below for more information about each topic.</p>"
	    "<ul>"
	    "<li>"
	    "<details>"
	    "<summary>This Website is a collection of records linked through their relationship to each other.</summary>"
	    "<p>Each page on this Website is <em>record</em> of <em>information</em>. (There are <a href=\"../record.html\">records</a> with more <a href=\"../information.html\">information</a> about both of those concepts.) On the <a href=\"../Web.html\">Web</a>, these records are <a href=\"hypertext\">hypertext</a>: they contain links to each other (and other resources). The table below demonstrates link styling."
	    "<table>"
	    "<thead><tr>"
	    "<th scope=\"col\">Color</th>"
	    "<th scope=\"col\">Link type</th>"
	    "</tr></thead>"
	    "<tbody>"
	    "<tr>"
	    "<td class=\"link\">Sample</td>"
	    "<td>Unvisited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-link\">Sample</td>"
	    "<td>Visited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"external-link\">Sample</td>"
	    "<td>Unvisited external resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-external-link\">Sample</td>"
	    "<td>Visited external resource</td>"
	    "</tr>"
	    "</table>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>It was created by one human person wishing to communicate with others.</summary>"
	    "<p>It was created by me, <a href=\"../emsenn.html\">emsenn</a>, to share some of my <a href=\"../knowledge.html\">knowledge</a> with <a href=\"../person.html\">people</a> on the <a href=\"../Web.html\">Web</a>.</p>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>Each Webpage contains a <em>record</em> of <em>information</em>.</summary>"
	    "<p>Each Webpage on my Website is a <a href=\"../record.html\">record</a> of <a  href=\"information.html\">information</a>. These records have different components, depending on what type they are, but here's some common components:"
	    "<dl>"
	    "<dt>Introduction</dt>"
	    "<dd>A record's <em>introduction</em> describes the record, including what <a href=\"../permission.html\">permissions</a> are granted.</dd>"
	    "<dt>Backlinks</dt>"
	    "<dd>A record's <a href=\"../backlink.html\">backlinks</a> shows which other records link to this one.</dd>"
	    "</dl>"
	    "</details>"
	    "</li>"
	    "</ul>"
	    "</section>"
	    ))
    (setq ghe-org-html-head
	 (concat "<style>
	 @charset \"UTF-8\";

	 :root {
	     --body-font: sans-serif;
	     --header-font: sans-serif;
	     --code-font: monospace;
	     --primary-color: #eed;
	     --primary-dim-color: #ffe;
	     --secondary-color: #312;
	     --secondary-dim-color: #756;
	     --link-color: #320;
	     --link-hover-color: #862;
	     --link-visited-color: #400;
	     --link-visited-hover-color: #822;
	     --external-link-color: #004;
	     --external-link-hover-color: #228;
	     --external-link-visited-color: #030;
	     --external-link-visited-hover-color: #141;
	 }
	 @media(prefers-color-scheme:dark){
	     :root {
		--body-font: sans-serif;
		--header-font: sans-serif;
		--code-font: monospace;
		--primary-color: #756;
		--primary-dim-color: #312;
		--secondary-color: #eed;
		--secondary-dim-color: #ffe;
		--link-color: #880;
		--link-hover-color: #aa2;
		--link-visited-color: #934;
		--link-visited-hover-color: #b56;
	     }}
	 body {
	     position: relative;
	     min-height: 100%;
	     background-color: var(--primary-color);
	     color: var(--secondary-color);
	     margin: 0 auto;
	     font-family: sans-serif;
	 }
	 main, #content {
	     background-color: var(--primary-dim-color);
	     border-left: 1.5em dotted var(--primary-color);
	     padding: 1em;
	 }
	 header {
	     border-bottom: 0.8em dotted var(--secondary-dim-color);
	 }
	 h1 { font-size: 2em; margin-bottom: 0; }
	 h2 {
	     border-bottom: 0.3em dotted var(--secondary-dim-color);
	 }
	 h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
	     width: 60%;
	 }
	 ul ul { width: auto; }
	 aside {
	     float: right;
	     width: 35%;
	 }
	 aside p { width: 100%; }
	 @media screen and (max-width:760px) {
	     h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
		width: 90%;
	     }
	     aside {
		float: inherit;
		width: 90%;
		border-top: 0.2em dotted var(--secondary-dim-color);
		border-bottom: 0.2em dotted var(--secondary-dim-color);
		font-size: 0.8em;
		  }
	 }

	 footer, #postamble, #preamble {
	     padding: 0.5em;
	 }
	 table {
	     border-collapse: collapse;
	     border-spacing: 0;
	     empty-cells: show;
	     border: 0.1em solid var(--secondary-color);
	 }
	 thead { font-family: sans-serif; }
	 th, td {
	     padding: 0 0.3em;
	     border: 0.01em solid var(--secondary-color);
	 }
	 img {
	     max-width: 80vw;
	     vertical-align: middle;
	 }
	 pre, .src {
	     padding: 0.5em;
	     border: 0.1em solid var(--secondary-color);
	     white-space: pre-wrap;
	     overflow-x: scroll;
	     text-overflow: clip;
	     scrollbar-width: none;
	 }
	 pre::-webkit-scrollbar, .src::-webkit-scrollbar {
	     display: none;
	 }


	 dt {
	     font-weight: normal;
	     display: inline-block;
	     border-bottom: 0.1rem dotted var(--secondary-color);
	 }
	 #text-index dt { border-bottom: none; }
	 h2, h3, h4, h5, h6, h7, h8, h9, h10 {
	     display: block;
	     font-family: sans-serif;
	     margin: 0.2em auto 0.5em 0;
	 }
	 a, .link {
	     text-decoration: none;
	     color: var(--link-color);
	     display: inline;
	     position: relative;
	     border-bottom: 0.1rem dotted;
	     line-height: 1.2;
	     transition: border 0.3s;
	 }
	 a:hover {
	     color: var(--link-hover-color);
	     outline-style: none;
	     border-bottom: 0.1rem solid;
	 }
	 a:visited, .visited-link { color: var(--link-visited-color); }
	 a:visited:hover { color: var(--link-visited-hover-color); }
	 a:focus {
	     outline-style: none;
	     border-bottom: 0.1rem solid;
	 }
	 ::selection { background-color: var(--secondary-color); color: var(--secondary-color-dim); }
	 a::selection { background-color: var(--secondary-color-dim); }
	 .org-todo {
	     background-color: var(--secondary-color);
	     color: var(--secondary-color-dim);
	     font-size: .8rem;
	     float: right;
	 }
	 .org-src-container + .example {
	     margin-left: 8em;
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):after, a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:after, .external-link:after, .visited-external-link:after { 
	     content: \"^\";
	     font-size: 0.5em;
	     vertical-align: super;
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]), .external-link {
	     color: var(--external-link-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):hover{ 
	     color: var(--external-link-hover-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited, .visited-external-link { 
	     color: var(--external-link-visited-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:hover{ 
	     color: var(--external-link-visited-hover-color);
	 }
	 blockquote {
	     border: 0.1em dashed var(--secondary-dim-color);
	     padding-left: 0.2em;
	 }
	 label.org-src-name {
	     margin: 0 0 0 3em;
	     font-family: sans-serif;
	     font-size: 1rem;
	     line-height: 0;
	 }
	 .skip-to-content {
	     opacity: 0;
	     position: absolute;
	     left: 0.2em;
	 }
	 .skip-to-content:focus{
	     opacity: 1;
	     background-color: var(--secondary-dim-color);
	     color: var(--primary-color);
	 }
	 ul { max-width: 85%; }
 </style>"))

 (org-babel-do-load-languages 'org-babel-load-languages
			       '((shell . t)))

 (defun ghe-org-capture-capture-at-point ()
    "Insert an org capture template at point."
    (interactive)
    (org-capture 0))
 (defun ghe-org-export-preprocessor (backend)
   (let ((links (ghe-org-roam-format-backlinks-list (buffer-file-name))))
     (unless (string= links "")
       (save-excursion
	 (goto-char (point-max))
	 (insert (concat "\n* Backlinks\n   :PROPERTIES:\n   :CUSTOM_ID:   backlinks\n   :END:\n") links)))))

 (defun ghe-org-html-format-drawer (name contents)
   (format "<section class=\"org-drawer\"> %s </section>" contents))

 ;; from https://www.john2x.com/blog/blogging-with-orgmode.html
  (defun ghe-org-publish-format-sitemap (title sitemap)
    (let ((posts (cdr sitemap)))
      (concat
       (format "#+title: %s\n" title)
       "#+author: emsenn\n"
       "#+email: emsenn@emsenn.net\n"
       (format "#+date: %s\n" (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)))
       "#+roam_tags: meta\n"
       (org-list-to-org (cons (car sitemap) posts)))))

  (setq org-capture-templates
       `(
	 ("s" "Capture source code block")
	 ("se" "Elisp code block"
		     plain (clock)
		     ,(concat "#+name: %^{NAME}-elisp\n"
			      "#+caption: %^{CAPTION}\n"
			    "#+begin_src elisp %^{HEADER-ARGS}\n"
			    "%?\n"
			    "#+end_src\n"))
	 ))
 (setq org-publish-project-alist
       `(
	 ("records" :components ("all-records" "term-records" "comment-records" "reference-records" "daily-records"))
	 ("all-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/"
	  :publishing-directory "~/org/p"
	  :makeindex t
	  :html-preamble ,ghe-org-html-base-preamble)
	 ("term-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/term"
	  :publishing-directory "~/org/p/term"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files alphabetically
	  :sitemap-title "Term Index")
	 ("comment-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/com"
	  :publishing-directory "~/org/p/com"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files anti-chronologically
	  :sitemap-title "Communications Index")
	 ("daily-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/daily"
	  :publishing-directory "~/org/p/daily"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files anti-chronologically
	  :sitemap-title "Daily Index")
	 ("reference-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/ref"
	  :publishing-directory "~/org/p/ref"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files alphabetically
	  :sitemap-title "Reference Index")
	 ("teraum"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		     (content "main" "content")
		     (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/teraum"
	  :publishing-directory "~/org/p/teraum"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files anti-chronologically
	  :sitemap-title "Teraum Index")
    ))
 :hook 
	(org-export-before-processing . ghe-org-export-preprocessor)
 :bind (
	("C-c l" . org-store-link)
	    ("C-c a" . org-agenda)
	    ("C-c c" . org-capture)
	    ("C-c t" . org-toggle-link-display)
	    ("C-c C-q" . counsel-org-tag)
	    ("<f8>" . ghe-org-capture-capture-at-point)
	))

Org-attach-screenshot

(use-package org-attach-screenshot :straight t
   :config (setq
	org-attach-screenshot-command-line "spectacle -rbno $f"))

Org-roam

(use-package
  org-roam :straight t
  :hook (after-init . org-roam-mode)
  :bind (
	 ("<f5>" . org-roam-dailies-capture-today)
	 ("<f9>" . org-roam-dailies-find-today)
	 ("C-c n l" . org-roam)
	 ("C-c n f" . org-roam-find-file)
	 ("C-c n g" . org-roam-graph)
	 ("C-c n i" . org-roam-insert)
	 ("C-c n I" . org-roam-insert-immediate))
  :custom
  (org-roam-directory "~/org/s")
  (org-roam-dailies-directory "d/")
  (org-roam-capture-immediate-template
   (backquote
    ("B" "blank term" plain
     (function org-roam--capture-get-point)
     "*/[[file:${slug}.org][${title}]]/* hasn't been defined yet.\n"
     :file-name "term/${slug}"
     :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+index: ${title}\n"
		"#+name: ${slug}-definition\n")
     :unnarrowed t
     :immediate-finish t)
    ))
  (org-roam-capture-templates
   `(
     ("t" "term" plain
      (function org-roam--capture-get-point)
      "*/[[file:${slug}.org][${title}]]/* %?\n"
      :file-name "term/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+index: ${title}\n"
		"#+name: ${slug}-definition\n")
      :unnarrowed t)
     ("r" "reference" plain
      (function org-roam--capture-get-point)
      ,(concat "#+author: %^{Author?}\n"
	  "#+date: %^{Date?}\n"
	  "#+roam_tags: unincorporated-reference\n"
	  "#+index: %^{Index?}!references!${title}\n"
	  "#+name: ${slug}-definition\n"
	  "*/[[file:${slug}.org][${title}]]/* is an [[file:../term/unincorporated-reference.org][unincorporated reference]].\n")
      :file-name "ref/${slug}"
      :head ,(concat "#+title: ${title}\n")
      :unnarrowed t)
     ("c" "comment" plain
      (function org-roam--capture-get-point)
		"#+index: %^{Index?}!comments!${slug}\n\n%?\n"
      :file-name "com/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+roam_tags: comment\n")
      :unnarrowed t)
     ("T" "Teraum")
     ("Tt" "term" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an term of [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %f\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Ta" "area" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an area of [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum area\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Ty" "year" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is a year in [[file:teraum_s_history.org][Teraum's history]].\n\n#+toc: headlines 2\n\n%?\n\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum year\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Td" "date" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is a date in [[file:teraum_s_history.org][Teraum's history]].\n\n#+toc: headlines 2\n\n%?\n\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum date\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Ts" "species" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an species from [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum species\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ))
  (org-roam-dailies-capture-templates
   `(
     ("d" "daily" plain
      #'org-roam-capture--get-point
      "- [[%f][%?]]\n"
      :file-name "daily/%<%Y-%m-%d>"
      :head ,(concat "#+title: %<%Y-%m-%d>\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+roam_tags: daily\n"
		"This is some changes that were made to this record catalog on %u.\n"))
     ))
  :config
  (defun org-roam--title-to-slug (title)
    "Convert TITLE to a filename-suitable slug. Uses hyphens rather than underscores."
    (cl-flet* ((nonspacing-mark-p
		(char)
		(eq 'Mn (get-char-code-property char 'general-category)))
	       (strip-nonspacing-marks
		(s)
		(apply #'string (seq-remove #'nonspacing-mark-p
					    (ucs-normalize-NFD-string s))))
	       (cl-replace (title pair)
			   (replace-regexp-in-string (car pair)
						     (cdr pair)
						     title)))
      (let* ((pairs `(("[^[:alnum:][:digit:]]" . "-")
		      ;; convert anything not alphanumeric
		      ("--*" . "-")  ;; remove sequential underscores
		      ("^-" . "")  ;; remove starting underscore
		      ("-$" . "")))  ;; remove ending underscore
	     (slug (-reduce-from #'cl-replace
				 (strip-nonspacing-marks title)
				 pairs)))
	(s-downcase slug))))
  ;; from neil mather's commonplace wiki
  (defun ghe-org-roam-format-backlinks-list (file)
    (if (org-roam--org-roam-file-p file)
	(--reduce-from
	 (concat acc
		 (format
		  "- [[file:%s][%s]]\n"
		  (if (or (string= (org-roam-dailies-directory--get-absolute-path)
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/term/"
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/ref/"
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/com/"
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/daily/"
				   (file-name-directory file))
			  )
		      (file-relative-name (car it))
		    (file-relative-name (car it) org-roam-directory))
		  (org-roam-db--get-title (car it))))
	 "" (org-roam-db-query
	     [:select [source]
		      :from links
		      :where (= dest $s1)] file))
      "")))

Org-roam-server

(use-package org-roam-server :straight t)

Org-mode export HTML & CSS chunks

HTML base preamble

(setq ghe-org-html-base-preamble
    (concat "<a href=\"#content\" class=\"skip-to-content\">skip to content</a>"
	    "<section class=\"nav\"><strong>Website navigation:</strong> "
	    "<a href=\"./index.html\">"
	    "homepage</a> | "
	    "<a href=\"./term/index.html\">"
	    "definitions</a> | "
	    "<a href=\"./ref/index.html\">"
	    "references"
	    "</a> | "
	    "<a href=\"./com/index.html\">"
	    "communication"
	    "</a> | "
	    "<a href=\"./daily/index.html\">"
	    "daily summary"
	    "</a>"
	    "<p>"
	    "This Website was cultivated as a public asset with <a href=\"https://ko-fi.com/emsenn\">support</a> from people like you. <strong><em>Thank you!</em></strong>"
	    "</p>"
	    "<details>"
	    "<summary>Click this sentence for information about this Website.</summary>"
	    "<p>Click each sentence below for more information about each topic.</p>"
	    "<ul>"
	    "<li>"
	    "<details>"
	    "<summary>This Website is a collection of records linked through their relationship to each other.</summary>"
	    "<p>Each page on this Website is <em>record</em> of <em>information</em>. (There are <a href=\"./record.html\">records</a> with more <a href=\"./information.html\">information</a> about both of those concepts.) On the <a href=\"./Web.html\">Web</a>, these records are <a href=\"hypertext\">hypertext</a>: they contain links to each other (and other resources). The table below demonstrates link styling."
	    "<table>"
	    "<thead><tr>"
	    "<th scope=\"col\">Color</th>"
	    "<th scope=\"col\">Link type</th>"
	    "</tr></thead>"
	    "<tbody>"
	    "<tr>"
	    "<td class=\"link\">Sample</td>"
	    "<td>Unvisited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-link\">Sample</td>"
	    "<td>Visited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"external-link\">Sample</td>"
	    "<td>Unvisited external resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-external-link\">Sample</td>"
	    "<td>Visited external resource</td>"
	    "</tr>"
	    "</table>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>It was created by one human person wishing to communicate with others.</summary>"
	    "<p>It was created by me, <a href=\"./emsenn.html\">emsenn</a>, to share some of my <a href=\"./knowledge.html\">knowledge</a> with <a href=\"./person.html\">people</a> on the <a href=\"Web.html\">Web</a>.</p>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>Each Webpage contains a <em>record</em> of <em>information</em>.</summary>"
	    "<p>Each Webpage on my Website is a <a href=\"./record.html\">record</a> of <a  href=\"information.html\">information</a>. These records have different components, depending on what type they are, but here's some common components:"
	    "<dl>"
	    "<dt>Introduction</dt>"
	    "<dd>A record's <em>introduction</em> describes the record, including what <a href=\"./permission.html\">permissions</a> are granted.</dd>"
	    "<dt>Backlinks</dt>"
	    "<dd>A record's <a href=\"./backlink.html\">backlinks</a> shows which other records link to this one.</dd>"
	    "</dl>"
	    "</details>"
	    "</li>"
	    "</ul>"
	    "</section>"
     ))

HTML subdir preamble

(setq ghe-org-html-subdir-preamble
    (concat "<a href=\"#content\" class=\"skip-to-content\">skip to content</a>"
	    "<section class=\"nav\"><strong>Website navigation:</strong> "
	    "<a href=\"../index.html\">"
	    "homepage</a> | "
	    "<a href=\"../term/index.html\">"
	    "definitions</a> | "
	    "<a href=\"../ref/index.html\">"
	    "references"
	    "</a> | "
	    "<a href=\"../com/index.html\">"
	    "communication"
	    "</a> | "
	    "<a href=\"../daily/index.html\">"
	    "daily summary"
	    "</a>"
	    "<p>"
	    "This Website was cultivated as a public asset with <a href=\"https://ko-fi.com/emsenn\">support</a> from people like you. <strong><em>Thank you!</em></strong>"
	    "</p>"
	    "<details>"
	    "<summary>Click this sentence for information about this Website.</summary>"
	    "<p>Click each sentence below for more information about each topic.</p>"
	    "<ul>"
	    "<li>"
	    "<details>"
	    "<summary>This Website is a collection of records linked through their relationship to each other.</summary>"
	    "<p>Each page on this Website is <em>record</em> of <em>information</em>. (There are <a href=\"../record.html\">records</a> with more <a href=\"../information.html\">information</a> about both of those concepts.) On the <a href=\"../Web.html\">Web</a>, these records are <a href=\"hypertext\">hypertext</a>: they contain links to each other (and other resources). The table below demonstrates link styling."
	    "<table>"
	    "<thead><tr>"
	    "<th scope=\"col\">Color</th>"
	    "<th scope=\"col\">Link type</th>"
	    "</tr></thead>"
	    "<tbody>"
	    "<tr>"
	    "<td class=\"link\">Sample</td>"
	    "<td>Unvisited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-link\">Sample</td>"
	    "<td>Visited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"external-link\">Sample</td>"
	    "<td>Unvisited external resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-external-link\">Sample</td>"
	    "<td>Visited external resource</td>"
	    "</tr>"
	    "</table>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>It was created by one human person wishing to communicate with others.</summary>"
	    "<p>It was created by me, <a href=\"../emsenn.html\">emsenn</a>, to share some of my <a href=\"../knowledge.html\">knowledge</a> with <a href=\"../person.html\">people</a> on the <a href=\"../Web.html\">Web</a>.</p>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>Each Webpage contains a <em>record</em> of <em>information</em>.</summary>"
	    "<p>Each Webpage on my Website is a <a href=\"../record.html\">record</a> of <a  href=\"information.html\">information</a>. These records have different components, depending on what type they are, but here's some common components:"
	    "<dl>"
	    "<dt>Introduction</dt>"
	    "<dd>A record's <em>introduction</em> describes the record, including what <a href=\"../permission.html\">permissions</a> are granted.</dd>"
	    "<dt>Backlinks</dt>"
	    "<dd>A record's <a href=\"../backlink.html\">backlinks</a> shows which other records link to this one.</dd>"
	    "</dl>"
	    "</details>"
	    "</li>"
	    "</ul>"
	    "</section>"
	    ))

CSS stylesheet

@charset \"UTF-8\";

:root {
    --body-font: sans-serif;
    --header-font: sans-serif;
    --code-font: monospace;
    --primary-color: #eed;
    --primary-dim-color: #ffe;
    --secondary-color: #312;
    --secondary-dim-color: #756;
    --link-color: #320;
    --link-hover-color: #862;
    --link-visited-color: #400;
    --link-visited-hover-color: #822;
    --external-link-color: #004;
    --external-link-hover-color: #228;
    --external-link-visited-color: #030;
    --external-link-visited-hover-color: #141;
}
@media(prefers-color-scheme:dark){
    :root {
	--body-font: sans-serif;
	--header-font: sans-serif;
	--code-font: monospace;
	--primary-color: #756;
	--primary-dim-color: #312;
	--secondary-color: #eed;
	--secondary-dim-color: #ffe;
	--link-color: #880;
	--link-hover-color: #aa2;
	--link-visited-color: #934;
	--link-visited-hover-color: #b56;
    }}
body {
    position: relative;
    min-height: 100%;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    margin: 0 auto;
    font-family: sans-serif;
}
main, #content {
    background-color: var(--primary-dim-color);
    border-left: 1.5em dotted var(--primary-color);
    padding: 1em;
}
header {
    border-bottom: 0.8em dotted var(--secondary-dim-color);
}
h1 { font-size: 2em; margin-bottom: 0; }
h2 {
    border-bottom: 0.3em dotted var(--secondary-dim-color);
}
h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
    width: 60%;
}
ul ul { width: auto; }
aside {
    float: right;
    width: 35%;
}
aside p { width: 100%; }
@media screen and (max-width:760px) {
    h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
	width: 90%;
    }
    aside {
	float: inherit;
	width: 90%;
	border-top: 0.2em dotted var(--secondary-dim-color);
	border-bottom: 0.2em dotted var(--secondary-dim-color);
	font-size: 0.8em;
	  }
}

footer, #postamble, #preamble {
    padding: 0.5em;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
    empty-cells: show;
    border: 0.1em solid var(--secondary-color);
}
thead { font-family: sans-serif; }
th, td {
    padding: 0 0.3em;
    border: 0.01em solid var(--secondary-color);
}
img {
    max-width: 80vw;
    vertical-align: middle;
}
pre, .src {
    padding: 0.5em;
    border: 0.1em solid var(--secondary-color);
    white-space: pre-wrap;
    overflow-x: scroll;
    text-overflow: clip;
    scrollbar-width: none;
}
pre::-webkit-scrollbar, .src::-webkit-scrollbar {
    display: none;
}


dt {
    font-weight: normal;
    display: inline-block;
    border-bottom: 0.1rem dotted var(--secondary-color);
}
#text-index dt { border-bottom: none; }
h2, h3, h4, h5, h6, h7, h8, h9, h10 {
    display: block;
    font-family: sans-serif;
    margin: 0.2em auto 0.5em 0;
}
a, .link {
    text-decoration: none;
    color: var(--link-color);
    display: inline;
    position: relative;
    border-bottom: 0.1rem dotted;
    line-height: 1.2;
    transition: border 0.3s;
}
a:hover {
    color: var(--link-hover-color);
    outline-style: none;
    border-bottom: 0.1rem solid;
}
a:visited, .visited-link { color: var(--link-visited-color); }
a:visited:hover { color: var(--link-visited-hover-color); }
a:focus {
    outline-style: none;
    border-bottom: 0.1rem solid;
}
::selection { background-color: var(--secondary-color); color: var(--secondary-color-dim); }
a::selection { background-color: var(--secondary-color-dim); }
.org-todo {
    background-color: var(--secondary-color);
    color: var(--secondary-color-dim);
    font-size: .8rem;
    float: right;
}
.org-src-container + .example {
    margin-left: 8em;
}
a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):after, a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:after, .external-link:after, .visited-external-link:after { 
    content: \"^\";
    font-size: 0.5em;
    vertical-align: super;
}
a[href^=\"https://\"]:not([href*=\"emsenn.net\"]), .external-link {
    color: var(--external-link-color);
}
a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):hover{ 
    color: var(--external-link-hover-color);
}
a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited, .visited-external-link { 
    color: var(--external-link-visited-color);
}
a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:hover{ 
    color: var(--external-link-visited-hover-color);
}
blockquote {
    border: 0.1em dashed var(--secondary-dim-color);
    padding-left: 0.2em;
}
label.org-src-name {
    margin: 0 0 0 3em;
    font-family: sans-serif;
    font-size: 1rem;
    line-height: 0;
}
.skip-to-content {
    opacity: 0;
    position: absolute;
    left: 0.2em;
}
.skip-to-content:focus{
    opacity: 1;
    background-color: var(--secondary-dim-color);
    color: var(--primary-color);
}
ul { max-width: 85%; }

HTML head

   (setq ghe-org-html-head
	 (concat "<style>
	 @charset \"UTF-8\";

	 :root {
	     --body-font: sans-serif;
	     --header-font: sans-serif;
	     --code-font: monospace;
	     --primary-color: #eed;
	     --primary-dim-color: #ffe;
	     --secondary-color: #312;
	     --secondary-dim-color: #756;
	     --link-color: #320;
	     --link-hover-color: #862;
	     --link-visited-color: #400;
	     --link-visited-hover-color: #822;
	     --external-link-color: #004;
	     --external-link-hover-color: #228;
	     --external-link-visited-color: #030;
	     --external-link-visited-hover-color: #141;
	 }
	 @media(prefers-color-scheme:dark){
	     :root {
		--body-font: sans-serif;
		--header-font: sans-serif;
		--code-font: monospace;
		--primary-color: #756;
		--primary-dim-color: #312;
		--secondary-color: #eed;
		--secondary-dim-color: #ffe;
		--link-color: #880;
		--link-hover-color: #aa2;
		--link-visited-color: #934;
		--link-visited-hover-color: #b56;
	     }}
	 body {
	     position: relative;
	     min-height: 100%;
	     background-color: var(--primary-color);
	     color: var(--secondary-color);
	     margin: 0 auto;
	     font-family: sans-serif;
	 }
	 main, #content {
	     background-color: var(--primary-dim-color);
	     border-left: 1.5em dotted var(--primary-color);
	     padding: 1em;
	 }
	 header {
	     border-bottom: 0.8em dotted var(--secondary-dim-color);
	 }
	 h1 { font-size: 2em; margin-bottom: 0; }
	 h2 {
	     border-bottom: 0.3em dotted var(--secondary-dim-color);
	 }
	 h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
	     width: 60%;
	 }
	 ul ul { width: auto; }
	 aside {
	     float: right;
	     width: 35%;
	 }
	 aside p { width: 100%; }
	 @media screen and (max-width:760px) {
	     h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
		width: 90%;
	     }
	     aside {
		float: inherit;
		width: 90%;
		border-top: 0.2em dotted var(--secondary-dim-color);
		border-bottom: 0.2em dotted var(--secondary-dim-color);
		font-size: 0.8em;
		  }
	 }

	 footer, #postamble, #preamble {
	     padding: 0.5em;
	 }
	 table {
	     border-collapse: collapse;
	     border-spacing: 0;
	     empty-cells: show;
	     border: 0.1em solid var(--secondary-color);
	 }
	 thead { font-family: sans-serif; }
	 th, td {
	     padding: 0 0.3em;
	     border: 0.01em solid var(--secondary-color);
	 }
	 img {
	     max-width: 80vw;
	     vertical-align: middle;
	 }
	 pre, .src {
	     padding: 0.5em;
	     border: 0.1em solid var(--secondary-color);
	     white-space: pre-wrap;
	     overflow-x: scroll;
	     text-overflow: clip;
	     scrollbar-width: none;
	 }
	 pre::-webkit-scrollbar, .src::-webkit-scrollbar {
	     display: none;
	 }


	 dt {
	     font-weight: normal;
	     display: inline-block;
	     border-bottom: 0.1rem dotted var(--secondary-color);
	 }
	 #text-index dt { border-bottom: none; }
	 h2, h3, h4, h5, h6, h7, h8, h9, h10 {
	     display: block;
	     font-family: sans-serif;
	     margin: 0.2em auto 0.5em 0;
	 }
	 a, .link {
	     text-decoration: none;
	     color: var(--link-color);
	     display: inline;
	     position: relative;
	     border-bottom: 0.1rem dotted;
	     line-height: 1.2;
	     transition: border 0.3s;
	 }
	 a:hover {
	     color: var(--link-hover-color);
	     outline-style: none;
	     border-bottom: 0.1rem solid;
	 }
	 a:visited, .visited-link { color: var(--link-visited-color); }
	 a:visited:hover { color: var(--link-visited-hover-color); }
	 a:focus {
	     outline-style: none;
	     border-bottom: 0.1rem solid;
	 }
	 ::selection { background-color: var(--secondary-color); color: var(--secondary-color-dim); }
	 a::selection { background-color: var(--secondary-color-dim); }
	 .org-todo {
	     background-color: var(--secondary-color);
	     color: var(--secondary-color-dim);
	     font-size: .8rem;
	     float: right;
	 }
	 .org-src-container + .example {
	     margin-left: 8em;
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):after, a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:after, .external-link:after, .visited-external-link:after { 
	     content: \"^\";
	     font-size: 0.5em;
	     vertical-align: super;
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]), .external-link {
	     color: var(--external-link-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):hover{ 
	     color: var(--external-link-hover-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited, .visited-external-link { 
	     color: var(--external-link-visited-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:hover{ 
	     color: var(--external-link-visited-hover-color);
	 }
	 blockquote {
	     border: 0.1em dashed var(--secondary-dim-color);
	     padding-left: 0.2em;
	 }
	 label.org-src-name {
	     margin: 0 0 0 3em;
	     font-family: sans-serif;
	     font-size: 1rem;
	     line-height: 0;
	 }
	 .skip-to-content {
	     opacity: 0;
	     position: absolute;
	     left: 0.2em;
	 }
	 .skip-to-content:focus{
	     opacity: 1;
	     background-color: var(--secondary-dim-color);
	     color: var(--primary-color);
	 }
	 ul { max-width: 85%; }
</style>"))

Full Source

(if (and (version< emacs-version "26.3") (>= libgnutls-version 30600))
    (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))


(defvar straight-install-script-path
  "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el")

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
    (url-retrieve-synchronously straight-install-script-path
     'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

(setq user-mail-address "emsenn@emsenn.net")
(setq make-backup-files nil)
(setq inhibit-startup-message t)
(setq visible-bell 1)
(setq inhibit-startup-screen t)

(setq initial-scratch-message ";; Groundhog Emacs has some bugs\n;; Press C-x C-e after the following lines to fix them\n(ivy-mode)\n")

(menu-bar-mode -1)
(tool-bar-mode -1)
(show-paren-mode 1)
(setq line-number-mode t)
(setq column-number-mode t)
(setq-default truncate-lines t)
(setq-default line-spacing 1)
(setq sentence-end-double-space nil)
(global-visual-line-mode t)
(setq echo-keystrokes 0.1)
(setq fill-column 68)
(setq mouse-wheel-scroll-amount '(1 ((shift) .1)))


(use-package darktooth-theme :straight t
  :config
  (load-theme 'darktooth t))

(use-package htmlize :straight t)


(use-package fennel-mode :straight t
  :mode "\\.fnl\\'"
  :interpreter "fennel"
  :custom
  (inferior-lisp-program "/home/emsenn/.luarocks/bin/fennel"))

(use-package lua-mode :straight t
  :mode "\\.lua\\'"
  :interpreter "lua")
(use-package racket-mode :straight t
  :mode "\\.rkt\\'"
  :interpreter "racket")


(use-package ivy
      :straight t
      :diminish (ivy-mode . "")
      :bind (("C-c C-r" . ivy-resume))
      :config (ivy-mode 1)
      (setq ivy-use-virtual-buffers t)
      (setq ivy-height 12)
      (setq ivy-count-format "(%d/%d) ")
      (setq ivy-initial-inputs-alist nil)
      (setq ivy-re-builders-alist
	'((read-file-name-internal . ivy--regex-fuzzy)
	  (t . ivy--regex-ignore-order))))

(use-package magit :straight t)


(use-package
 org :straight t
 :config 
 (setq org-directory "~/org")
 (setq org-startup-folded 'fold)
 (setq org-hide-block-startup 'hideblocks)
 (setq org-catch-invisible-edits 'show-and-error)
 (setq org-agenda-files (list "~/org"))
 (setq org-export-with-section-numbers nil)
 (setq org-export-with-smart-quotes nil)
 (setq org-export-with-toc nil)
 (setq org-html-htmlize-output-type 'nil)
 (setq org-html-validation-link nil)
 (setq org-log-done 'time)
 (setq org-log-into-drawer 'LOGBOOK)
 (setq org-image-actual-width '(400))
 (setq ghe-org-html-base-preamble
     (concat "<a href=\"#content\" class=\"skip-to-content\">skip to content</a>"
	    "<section class=\"nav\"><strong>Website navigation:</strong> "
	    "<a href=\"./index.html\">"
	    "homepage</a> | "
	    "<a href=\"./term/index.html\">"
	    "definitions</a> | "
	    "<a href=\"./ref/index.html\">"
	    "references"
	    "</a> | "
	    "<a href=\"./com/index.html\">"
	    "communication"
	    "</a> | "
	    "<a href=\"./daily/index.html\">"
	    "daily summary"
	    "</a>"
	    "<p>"
	    "This Website was cultivated as a public asset with <a href=\"https://ko-fi.com/emsenn\">support</a> from people like you. <strong><em>Thank you!</em></strong>"
	    "</p>"
	    "<details>"
	    "<summary>Click this sentence for information about this Website.</summary>"
	    "<p>Click each sentence below for more information about each topic.</p>"
	    "<ul>"
	    "<li>"
	    "<details>"
	    "<summary>This Website is a collection of records linked through their relationship to each other.</summary>"
	    "<p>Each page on this Website is <em>record</em> of <em>information</em>. (There are <a href=\"./record.html\">records</a> with more <a href=\"./information.html\">information</a> about both of those concepts.) On the <a href=\"./Web.html\">Web</a>, these records are <a href=\"hypertext\">hypertext</a>: they contain links to each other (and other resources). The table below demonstrates link styling."
	    "<table>"
	    "<thead><tr>"
	    "<th scope=\"col\">Color</th>"
	    "<th scope=\"col\">Link type</th>"
	    "</tr></thead>"
	    "<tbody>"
	    "<tr>"
	    "<td class=\"link\">Sample</td>"
	    "<td>Unvisited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-link\">Sample</td>"
	    "<td>Visited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"external-link\">Sample</td>"
	    "<td>Unvisited external resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-external-link\">Sample</td>"
	    "<td>Visited external resource</td>"
	    "</tr>"
	    "</table>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>It was created by one human person wishing to communicate with others.</summary>"
	    "<p>It was created by me, <a href=\"./emsenn.html\">emsenn</a>, to share some of my <a href=\"./knowledge.html\">knowledge</a> with <a href=\"./person.html\">people</a> on the <a href=\"Web.html\">Web</a>.</p>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>Each Webpage contains a <em>record</em> of <em>information</em>.</summary>"
	    "<p>Each Webpage on my Website is a <a href=\"./record.html\">record</a> of <a  href=\"information.html\">information</a>. These records have different components, depending on what type they are, but here's some common components:"
	    "<dl>"
	    "<dt>Introduction</dt>"
	    "<dd>A record's <em>introduction</em> describes the record, including what <a href=\"./permission.html\">permissions</a> are granted.</dd>"
	    "<dt>Backlinks</dt>"
	    "<dd>A record's <a href=\"./backlink.html\">backlinks</a> shows which other records link to this one.</dd>"
	    "</dl>"
	    "</details>"
	    "</li>"
	    "</ul>"
	    "</section>"
      ))
 (setq ghe-org-html-subdir-preamble
     (concat "<a href=\"#content\" class=\"skip-to-content\">skip to content</a>"
	    "<section class=\"nav\"><strong>Website navigation:</strong> "
	    "<a href=\"../index.html\">"
	    "homepage</a> | "
	    "<a href=\"../term/index.html\">"
	    "definitions</a> | "
	    "<a href=\"../ref/index.html\">"
	    "references"
	    "</a> | "
	    "<a href=\"../com/index.html\">"
	    "communication"
	    "</a> | "
	    "<a href=\"../daily/index.html\">"
	    "daily summary"
	    "</a>"
	    "<p>"
	    "This Website was cultivated as a public asset with <a href=\"https://ko-fi.com/emsenn\">support</a> from people like you. <strong><em>Thank you!</em></strong>"
	    "</p>"
	    "<details>"
	    "<summary>Click this sentence for information about this Website.</summary>"
	    "<p>Click each sentence below for more information about each topic.</p>"
	    "<ul>"
	    "<li>"
	    "<details>"
	    "<summary>This Website is a collection of records linked through their relationship to each other.</summary>"
	    "<p>Each page on this Website is <em>record</em> of <em>information</em>. (There are <a href=\"../record.html\">records</a> with more <a href=\"../information.html\">information</a> about both of those concepts.) On the <a href=\"../Web.html\">Web</a>, these records are <a href=\"hypertext\">hypertext</a>: they contain links to each other (and other resources). The table below demonstrates link styling."
	    "<table>"
	    "<thead><tr>"
	    "<th scope=\"col\">Color</th>"
	    "<th scope=\"col\">Link type</th>"
	    "</tr></thead>"
	    "<tbody>"
	    "<tr>"
	    "<td class=\"link\">Sample</td>"
	    "<td>Unvisited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-link\">Sample</td>"
	    "<td>Visited local resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"external-link\">Sample</td>"
	    "<td>Unvisited external resource</td>"
	    "</tr>"
	    "<tr>"
	    "<td class=\"visited-external-link\">Sample</td>"
	    "<td>Visited external resource</td>"
	    "</tr>"
	    "</table>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>It was created by one human person wishing to communicate with others.</summary>"
	    "<p>It was created by me, <a href=\"../emsenn.html\">emsenn</a>, to share some of my <a href=\"../knowledge.html\">knowledge</a> with <a href=\"../person.html\">people</a> on the <a href=\"../Web.html\">Web</a>.</p>"
	    "</details>"
	    "</li>"
	    "<li>"
	    "<details>"
	    "<summary>Each Webpage contains a <em>record</em> of <em>information</em>.</summary>"
	    "<p>Each Webpage on my Website is a <a href=\"../record.html\">record</a> of <a  href=\"information.html\">information</a>. These records have different components, depending on what type they are, but here's some common components:"
	    "<dl>"
	    "<dt>Introduction</dt>"
	    "<dd>A record's <em>introduction</em> describes the record, including what <a href=\"../permission.html\">permissions</a> are granted.</dd>"
	    "<dt>Backlinks</dt>"
	    "<dd>A record's <a href=\"../backlink.html\">backlinks</a> shows which other records link to this one.</dd>"
	    "</dl>"
	    "</details>"
	    "</li>"
	    "</ul>"
	    "</section>"
	    ))
    (setq ghe-org-html-head
	 (concat "<style>
	 @charset \"UTF-8\";

	 :root {
	     --body-font: sans-serif;
	     --header-font: sans-serif;
	     --code-font: monospace;
	     --primary-color: #eed;
	     --primary-dim-color: #ffe;
	     --secondary-color: #312;
	     --secondary-dim-color: #756;
	     --link-color: #320;
	     --link-hover-color: #862;
	     --link-visited-color: #400;
	     --link-visited-hover-color: #822;
	     --external-link-color: #004;
	     --external-link-hover-color: #228;
	     --external-link-visited-color: #030;
	     --external-link-visited-hover-color: #141;
	 }
	 @media(prefers-color-scheme:dark){
	     :root {
		--body-font: sans-serif;
		--header-font: sans-serif;
		--code-font: monospace;
		--primary-color: #756;
		--primary-dim-color: #312;
		--secondary-color: #eed;
		--secondary-dim-color: #ffe;
		--link-color: #880;
		--link-hover-color: #aa2;
		--link-visited-color: #934;
		--link-visited-hover-color: #b56;
	     }}
	 body {
	     position: relative;
	     min-height: 100%;
	     background-color: var(--primary-color);
	     color: var(--secondary-color);
	     margin: 0 auto;
	     font-family: sans-serif;
	 }
	 main, #content {
	     background-color: var(--primary-dim-color);
	     border-left: 1.5em dotted var(--primary-color);
	     padding: 1em;
	 }
	 header {
	     border-bottom: 0.8em dotted var(--secondary-dim-color);
	 }
	 h1 { font-size: 2em; margin-bottom: 0; }
	 h2 {
	     border-bottom: 0.3em dotted var(--secondary-dim-color);
	 }
	 h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
	     width: 60%;
	 }
	 ul ul { width: auto; }
	 aside {
	     float: right;
	     width: 35%;
	 }
	 aside p { width: 100%; }
	 @media screen and (max-width:760px) {
	     h2, h3, h4, h5, h6, p, table, ul, ol, .org-src-container {
		width: 90%;
	     }
	     aside {
		float: inherit;
		width: 90%;
		border-top: 0.2em dotted var(--secondary-dim-color);
		border-bottom: 0.2em dotted var(--secondary-dim-color);
		font-size: 0.8em;
		  }
	 }

	 footer, #postamble, #preamble {
	     padding: 0.5em;
	 }
	 table {
	     border-collapse: collapse;
	     border-spacing: 0;
	     empty-cells: show;
	     border: 0.1em solid var(--secondary-color);
	 }
	 thead { font-family: sans-serif; }
	 th, td {
	     padding: 0 0.3em;
	     border: 0.01em solid var(--secondary-color);
	 }
	 img {
	     max-width: 80vw;
	     vertical-align: middle;
	 }
	 pre, .src {
	     padding: 0.5em;
	     border: 0.1em solid var(--secondary-color);
	     white-space: pre-wrap;
	     overflow-x: scroll;
	     text-overflow: clip;
	     scrollbar-width: none;
	 }
	 pre::-webkit-scrollbar, .src::-webkit-scrollbar {
	     display: none;
	 }


	 dt {
	     font-weight: normal;
	     display: inline-block;
	     border-bottom: 0.1rem dotted var(--secondary-color);
	 }
	 #text-index dt { border-bottom: none; }
	 h2, h3, h4, h5, h6, h7, h8, h9, h10 {
	     display: block;
	     font-family: sans-serif;
	     margin: 0.2em auto 0.5em 0;
	 }
	 a, .link {
	     text-decoration: none;
	     color: var(--link-color);
	     display: inline;
	     position: relative;
	     border-bottom: 0.1rem dotted;
	     line-height: 1.2;
	     transition: border 0.3s;
	 }
	 a:hover {
	     color: var(--link-hover-color);
	     outline-style: none;
	     border-bottom: 0.1rem solid;
	 }
	 a:visited, .visited-link { color: var(--link-visited-color); }
	 a:visited:hover { color: var(--link-visited-hover-color); }
	 a:focus {
	     outline-style: none;
	     border-bottom: 0.1rem solid;
	 }
	 ::selection { background-color: var(--secondary-color); color: var(--secondary-color-dim); }
	 a::selection { background-color: var(--secondary-color-dim); }
	 .org-todo {
	     background-color: var(--secondary-color);
	     color: var(--secondary-color-dim);
	     font-size: .8rem;
	     float: right;
	 }
	 .org-src-container + .example {
	     margin-left: 8em;
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):after, a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:after, .external-link:after, .visited-external-link:after { 
	     content: \"^\";
	     font-size: 0.5em;
	     vertical-align: super;
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]), .external-link {
	     color: var(--external-link-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):hover{ 
	     color: var(--external-link-hover-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited, .visited-external-link { 
	     color: var(--external-link-visited-color);
	 }
	 a[href^=\"https://\"]:not([href*=\"emsenn.net\"]):visited:hover{ 
	     color: var(--external-link-visited-hover-color);
	 }
	 blockquote {
	     border: 0.1em dashed var(--secondary-dim-color);
	     padding-left: 0.2em;
	 }
	 label.org-src-name {
	     margin: 0 0 0 3em;
	     font-family: sans-serif;
	     font-size: 1rem;
	     line-height: 0;
	 }
	 .skip-to-content {
	     opacity: 0;
	     position: absolute;
	     left: 0.2em;
	 }
	 .skip-to-content:focus{
	     opacity: 1;
	     background-color: var(--secondary-dim-color);
	     color: var(--primary-color);
	 }
	 ul { max-width: 85%; }
 </style>"))

 (org-babel-do-load-languages 'org-babel-load-languages
			       '((shell . t)))

 (defun ghe-org-capture-capture-at-point ()
    "Insert an org capture template at point."
    (interactive)
    (org-capture 0))
 (defun ghe-org-export-preprocessor (backend)
   (let ((links (ghe-org-roam-format-backlinks-list (buffer-file-name))))
     (unless (string= links "")
       (save-excursion
	 (goto-char (point-max))
	 (insert (concat "\n* Backlinks\n   :PROPERTIES:\n   :CUSTOM_ID:   backlinks\n   :END:\n") links)))))

 (defun ghe-org-html-format-drawer (name contents)
   (format "<section class=\"org-drawer\"> %s </section>" contents))

 ;; from https://www.john2x.com/blog/blogging-with-orgmode.html
  (defun ghe-org-publish-format-sitemap (title sitemap)
    (let ((posts (cdr sitemap)))
      (concat
       (format "#+title: %s\n" title)
       "#+author: emsenn\n"
       "#+email: emsenn@emsenn.net\n"
       (format "#+date: %s\n" (format-time-string "[%Y-%m-%d %a %H:%M:%S]" (current-time)))
       "#+roam_tags: meta\n"
       (org-list-to-org (cons (car sitemap) posts)))))

  (setq org-capture-templates
       `(
	 ("s" "Capture source code block")
	 ("se" "Elisp code block"
		     plain (clock)
		     ,(concat "#+name: %^{NAME}-elisp\n"
			      "#+caption: %^{CAPTION}\n"
			    "#+begin_src elisp %^{HEADER-ARGS}\n"
			    "%?\n"
			    "#+end_src\n"))
	 ))
 (setq org-publish-project-alist
       `(
	 ("records" :components ("all-records" "term-records" "comment-records" "reference-records" "daily-records"))
	 ("all-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/"
	  :publishing-directory "~/org/p"
	  :makeindex t
	  :html-preamble ,ghe-org-html-base-preamble)
	 ("term-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/term"
	  :publishing-directory "~/org/p/term"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files alphabetically
	  :sitemap-title "Term Index")
	 ("comment-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/com"
	  :publishing-directory "~/org/p/com"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files anti-chronologically
	  :sitemap-title "Communications Index")
	 ("daily-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/daily"
	  :publishing-directory "~/org/p/daily"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files anti-chronologically
	  :sitemap-title "Daily Index")
	 ("reference-records"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		    (content "main" "content")
		    (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/ref"
	  :publishing-directory "~/org/p/ref"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files alphabetically
	  :sitemap-title "Reference Index")
	 ("teraum"
	  :base-extension "org"
	  :publishing-function org-html-publish-to-html
	  :html-doctype "html5"
	  :html-html5-fancy t
	  :html-container "section"
	  :headline-levels 6
	  :recursive t
	  :html-divs ((preamble "section" "preamble")
		     (content "main" "content")
		     (postamble "section" "postamble"))
	  :publishing-function org-html-publish-to-html
	  :html-format-drawer-function ghe-org-html-format-drawer
	  :sitemap-function ghe-org-publish-format-sitemap
	  :html-head-include-scripts nil
	  :html-head-include-default-style nil
	  :html-head ,ghe-org-html-head
	  :exclude ,(regexp-opt '("README.org" "PRIVATE"))
	  :auto-sitemap t
	  :with-footnotes t
	  :with-toc nil
	  :with-drawers t
	  :base-directory "~/org/s/teraum"
	  :publishing-directory "~/org/p/teraum"
	  :html-preamble ,ghe-org-html-subdir-preamble
	  :sitemap-filename "index.org"
	  :sitemap-sort-files anti-chronologically
	  :sitemap-title "Teraum Index")
    ))
 :hook 
	(org-export-before-processing . ghe-org-export-preprocessor)
 :bind (
	("C-c l" . org-store-link)
	    ("C-c a" . org-agenda)
	    ("C-c c" . org-capture)
	    ("C-c t" . org-toggle-link-display)
	    ("C-c C-q" . counsel-org-tag)
	    ("<f8>" . ghe-org-capture-capture-at-point)
	))

(use-package org-attach-screenshot :straight t
   :config (setq
	org-attach-screenshot-command-line "spectacle -rbno $f"))

(use-package
  org-roam :straight t
  :hook (after-init . org-roam-mode)
  :bind (
	 ("<f5>" . org-roam-dailies-capture-today)
	 ("<f9>" . org-roam-dailies-find-today)
	 ("C-c n l" . org-roam)
	 ("C-c n f" . org-roam-find-file)
	 ("C-c n g" . org-roam-graph)
	 ("C-c n i" . org-roam-insert)
	 ("C-c n I" . org-roam-insert-immediate))
  :custom
  (org-roam-directory "~/org/s")
  (org-roam-dailies-directory "d/")
  (org-roam-capture-immediate-template
   (backquote
    ("B" "blank term" plain
     (function org-roam--capture-get-point)
     "*/[[file:${slug}.org][${title}]]/* hasn't been defined yet.\n"
     :file-name "term/${slug}"
     :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+index: ${title}\n"
		"#+name: ${slug}-definition\n")
     :unnarrowed t
     :immediate-finish t)
    ))
  (org-roam-capture-templates
   `(
     ("t" "term" plain
      (function org-roam--capture-get-point)
      "*/[[file:${slug}.org][${title}]]/* %?\n"
      :file-name "term/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+index: ${title}\n"
		"#+name: ${slug}-definition\n")
      :unnarrowed t)
     ("r" "reference" plain
      (function org-roam--capture-get-point)
      ,(concat "#+author: %^{Author?}\n"
	  "#+date: %^{Date?}\n"
	  "#+roam_tags: unincorporated-reference\n"
	  "#+index: %^{Index?}!references!${title}\n"
	  "#+name: ${slug}-definition\n"
	  "*/[[file:${slug}.org][${title}]]/* is an [[file:../term/unincorporated-reference.org][unincorporated reference]].\n")
      :file-name "ref/${slug}"
      :head ,(concat "#+title: ${title}\n")
      :unnarrowed t)
     ("c" "comment" plain
      (function org-roam--capture-get-point)
		"#+index: %^{Index?}!comments!${slug}\n\n%?\n"
      :file-name "com/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+roam_tags: comment\n")
      :unnarrowed t)
     ("T" "Teraum")
     ("Tt" "term" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an term of [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %f\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Ta" "area" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an area of [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum area\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Ty" "year" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is a year in [[file:teraum_s_history.org][Teraum's history]].\n\n#+toc: headlines 2\n\n%?\n\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum year\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Td" "date" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is a date in [[file:teraum_s_history.org][Teraum's history]].\n\n#+toc: headlines 2\n\n%?\n\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum date\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ("Ts" "species" plain
      (function org-roam--capture-get-point)
      "#+name: ${slug}-definition\n*/[[file:${slug}.org][${title}]]/* is an species from [[file:../teraum.org][Teraum]].\n\n#+toc: headlines 2\n\n%?\n* Supplements\n** Record history\n   :PROPERTIES:\n   :CUSTOM_ID: record-history\n   :END:\n   :LOGBOOK:\n   - Note taken on %U \\\\\n      Created from %a\n\n      %?\n   :END:\n"
      :file-name "teraum/${slug}"
      :head ,(concat "#+title: ${title}\n"
		"#+begin_head\n"
		"#+ghe_schema: "
		"\n"
		"#+author: " (user-full-name) "\n"
		"#+email: " user-mail-address "\n"
		"#+date: %U\n"
		"#+roam_tags: Teraum species\n"
		"#+end_head\n\n")
      :unnarrowed t)
     ))
  (org-roam-dailies-capture-templates
   `(
     ("d" "daily" plain
      #'org-roam-capture--get-point
      "- [[%f][%?]]\n"
      :file-name "daily/%<%Y-%m-%d>"
      :head ,(concat "#+title: %<%Y-%m-%d>\n"
		"#+author: " (user-full-name) "\n"
		"#+date: %U\n"
		"#+roam_tags: daily\n"
		"This is some changes that were made to this record catalog on %u.\n"))
     ))
  :config
  (defun org-roam--title-to-slug (title)
    "Convert TITLE to a filename-suitable slug. Uses hyphens rather than underscores."
    (cl-flet* ((nonspacing-mark-p
		(char)
		(eq 'Mn (get-char-code-property char 'general-category)))
	       (strip-nonspacing-marks
		(s)
		(apply #'string (seq-remove #'nonspacing-mark-p
					    (ucs-normalize-NFD-string s))))
	       (cl-replace (title pair)
			   (replace-regexp-in-string (car pair)
						     (cdr pair)
						     title)))
      (let* ((pairs `(("[^[:alnum:][:digit:]]" . "-")
		      ;; convert anything not alphanumeric
		      ("--*" . "-")  ;; remove sequential underscores
		      ("^-" . "")  ;; remove starting underscore
		      ("-$" . "")))  ;; remove ending underscore
	     (slug (-reduce-from #'cl-replace
				 (strip-nonspacing-marks title)
				 pairs)))
	(s-downcase slug))))
  ;; from neil mather's commonplace wiki
  (defun ghe-org-roam-format-backlinks-list (file)
    (if (org-roam--org-roam-file-p file)
	(--reduce-from
	 (concat acc
		 (format
		  "- [[file:%s][%s]]\n"
		  (if (or (string= (org-roam-dailies-directory--get-absolute-path)
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/term/"
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/ref/"
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/com/"
				   (file-name-directory file))
			  (string= "/home/emsenn/org/s/daily/"
				   (file-name-directory file))
			  )
		      (file-relative-name (car it))
		    (file-relative-name (car it) org-roam-directory))
		  (org-roam-db--get-title (car it))))
	 "" (org-roam-db-query
	     [:select [source]
		      :from links
		      :where (= dest $s1)] file))
      "")))

(use-package org-roam-server :straight t)


Date: 2021-01-26 Tue 13:13

Author: emsenn

Created: 2021-01-30 Sat 11:33