docs: sanitize public config and refresh README
This commit is contained in:
+161
-131
@@ -1,155 +1,185 @@
|
||||
#+TITLE: Mostalive's emacs configuration
|
||||
#+DATE: March 21, 2021
|
||||
#+SINCE: November 20, 2020
|
||||
#+STARTUP: inlineimages nofold
|
||||
#+TITLE: Willem's Doom Emacs configuration
|
||||
#+STARTUP: overview
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#maintainers][Maintainers]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#hacks][Hacks]]
|
||||
- [[#org-roam-server][Org-roam-server]]
|
||||
- [[#links-removal-for-blogposts-and-other-exports][Links removal for blogposts and other exports]]
|
||||
- [[#diff-hl-errors-in-magit-workaround][Diff-hl errors in magit workaround]]
|
||||
- [[#shorter-previews-for-backlinks-in-roam-buffer][Shorter previews for backlinks in roam-buffer]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#features][Features]]
|
||||
- [[#pdf-export-from-latex-in-tufte-style][PDF export from latex, in tufte style]]
|
||||
- [[#how-to-test][How to test]]
|
||||
- [[#instal-texlive-on-macos-or-ubuntu-for-pdf][Instal texlive on MacOS or Ubuntu for PDF]]
|
||||
- [[#instal-fonts-for-tufte-style][Instal fonts for tufte style]]
|
||||
- [[#pretty-deltas-with-magit-delta][Pretty deltas with magit-delta]]
|
||||
- [[#features-1][Features]]
|
||||
- [[#configuration][Configuration]]
|
||||
- [[#troubleshooting][Troubleshooting]]
|
||||
* Overview
|
||||
|
||||
* Description
|
||||
My doom emacs configuration.
|
||||
This is a personal Doom Emacs configuration for macOS and GNU/Linux, not a
|
||||
universal drop-in distribution. It includes shared editor configuration,
|
||||
separate machine module lists, OS-specific settings, and personal extensions.
|
||||
|
||||
Mostly standard stuff, some functions that were not available as packages.
|
||||
The known working setup uses Emacs 30.2 and a Doom fork at
|
||||
=~/.emacs.d/sources/doom+=. This is a description of the current working
|
||||
machine, not a tested minimum version or a claim about stock Doom.
|
||||
|
||||
The README was generated by doom emacs when creating a README.org file with it.
|
||||
** Maintainers
|
||||
+ @mostalive (on gitlab, github and twitter)
|
||||
* Installation and configuration
|
||||
|
||||
A fresh clone does not contain a root =init.el=. That file is an ignored
|
||||
symlink to the selected machine's module list. From the intended Doom
|
||||
configuration checkout, link the machine configuration before syncing:
|
||||
|
||||
** Plugins
|
||||
# A list of linked plugins
|
||||
+ [[https://orgmode.org/][org-plus-contrib]]
|
||||
+ [[https://github.com/sabof/org-bullets][org-bullets]]
|
||||
+ [[https://github.com/sebastiencs/company-box][company-box]]* (=+childframe=)
|
||||
+ =+present=
|
||||
+ [[https://github.com/anler/centered-window-mode][centered-window]]
|
||||
+ [[https://github.com/takaxp/org-tree-slide][org-tree-slide]]
|
||||
+ [[https://gitlab.com/oer/org-re-reveal][org-re-reveal]]
|
||||
|
||||
** Hacks
|
||||
*** Org-roam-server
|
||||
Some in file:config.el. Port settings for ~org-roam-server~ are not standard, so need a function.
|
||||
*** Links removal for blogposts and other exports
|
||||
Also some functions for replacing org-roam links with links to their website, useful for exports such as blog posts, where links to internal pages are not visible.
|
||||
*** Diff-hl errors in magit workaround
|
||||
|
||||
**** Why
|
||||
I think diff-hl shows changes at the side of a buffer, which I quite like. It seems configured with Doom emacs.
|
||||
For inside magit we now have `magit-delta` so it is not needed there. But for now, use one of the workarounds.
|
||||
**** Manual workaround: enable global mode - ~(global-diff-hl-mode)~
|
||||
**** Config workaround - disable diff-hl in magit
|
||||
file:config.el
|
||||
#+begin_src emacs-lisp
|
||||
(after! (magit)
|
||||
(remove-hook 'magit-post-refresh-hook 'diff-hl-magit-post-refresh))
|
||||
#+begin_src sh
|
||||
./bin/link-machine.sh
|
||||
doom sync
|
||||
#+end_src
|
||||
|
||||
adding diff-hl to the after! list did not seem to work. it is all a bit mysterious.
|
||||
*** Shorter previews for backlinks in roam-buffer
|
||||
Do not run =doom sync= until the root =init.el= symlink exists: Doom can
|
||||
regenerate an empty module list if it is missing. The script links either
|
||||
=mac/init.el= or =linux/init.el= as the root =init.el= based on the host OS.
|
||||
|
||||
From https://github.com/org-roam/org-roam/issues/1934 by Jethro Kuan
|
||||
#+begin_quote
|
||||
(defun my/preview-fetcher ()
|
||||
(let* ((elem (org-element-context))
|
||||
(parent (org-element-property :parent elem)))
|
||||
;; TODO: alt handling for non-paragraph elements
|
||||
(string-trim-right (buffer-substring-no-properties
|
||||
(org-element-property :begin parent)
|
||||
(org-element-property :end parent)))))
|
||||
The expected installed location is =~/.doom.d= (also Doom's normal user
|
||||
configuration directory in this setup). Several shared configuration paths
|
||||
assume that location. The staging/publication checkout is not a standalone
|
||||
=DOOMDIR= just because it exists at another path; adapting the hard-coded
|
||||
load paths and personal directories would be needed to run it elsewhere.
|
||||
|
||||
(setq org-roam-preview-function #'my/preview-fetcher)
|
||||
#+end_quote
|
||||
Configuration is split as follows:
|
||||
|
||||
=======
|
||||
Some in file:config.el. Port settings for ~org-roam-server~ are not standard, so need a function. Also some functions for replacing org-roam links with links to their website, for useto export as blog posts.
|
||||
>>>>>>> 6056fb8 (changes to my desktop config)
|
||||
* Prerequisites
|
||||
Doom Emacs installation
|
||||
- =config.el= and =packages.el= are shared.
|
||||
- =mac/init.el= and =linux/init.el= are the machine-specific module lists.
|
||||
- =config-mac.el= and =config-linux.el= load OS-specific configuration from
|
||||
the shared config dispatcher.
|
||||
- =config-local.el= is optional, ignored by Git, and loaded last. Copy
|
||||
=config-local.example.el= to =config-local.el= for private settings such as
|
||||
=user-mail-address=, API keys, or machine-specific overrides. Keep secrets
|
||||
out of tracked files.
|
||||
|
||||
The shared Org and Org-roam directories currently point under
|
||||
=~/MyDocuments/qwan/essays/willem=. The Linux blog configuration already uses
|
||||
=~/Documents= for the Jekyll checkout, while macOS uses =~/MyDocuments=.
|
||||
Adapt these personal paths for your machine. Note that shared configuration
|
||||
loads and queries Org-roam before the OS configuration and final
|
||||
=config-local.el= are loaded. A late local override alone may therefore not
|
||||
make every first-start path or dependency work; ensure the required paths and
|
||||
packages are usable early in startup.
|
||||
|
||||
After changing Doom modules in an =init.el= or package declarations in
|
||||
=packages.el=, run =doom sync= (only after confirming root =init.el= is linked),
|
||||
then restart Emacs or use =M-x doom/reload= for configuration changes where
|
||||
appropriate.
|
||||
|
||||
* Features
|
||||
# An in-depth list of features, how to use them, and their dependencies.
|
||||
|
||||
** PDF export from latex, in tufte style
|
||||
** Org-roam and publishing
|
||||
|
||||
*** How to test
|
||||
Render to pdf, and open preview : ~SPC m e l o~ (m e - export. l - latex, o - open in pdf viewer)
|
||||
*** Instal texlive on MacOS or Ubuntu for PDF
|
||||
**** What is it
|
||||
Texlive is a popular Latex distribution.
|
||||
**** How to test
|
||||
Expect ~which tex~ to return ~/opt/homebrew/bin/tex~
|
||||
**** MacOs
|
||||
#+begin_src bash
|
||||
brew install texlive
|
||||
- Insert a node link immediately with =SPC n r I=.
|
||||
- Export an Org-roam note as a Firehose draft with =SPC n r b= or
|
||||
=M-x org-roam-export-blog=.
|
||||
- Export as a Jekyll draft with =SPC n r j= or
|
||||
=M-x org-roam-export-jekyll=.
|
||||
|
||||
The exporters resolve public links where possible, degrade or drop private
|
||||
references, copy linked images, and open the generated draft for review.
|
||||
They report warnings, and their output should be checked carefully before
|
||||
publishing. This is a personal publishing helper, not a universal privacy
|
||||
guarantee.
|
||||
|
||||
The Org-roam preview helper is =qwan/brief-preview=. Journelly entries can be
|
||||
converted to Org-roam notes with =journelly-convert-entry-to-org-roam=; its
|
||||
example excerpt is retained as a public example.
|
||||
|
||||
** Markdown and text helpers
|
||||
|
||||
=qwan/qwan-markdown-dnd.el= adds file drag-and-drop support to Markdown and
|
||||
GFM buffers. Its current handler copies the dropped file into the configured
|
||||
attachment directory (default =attachments=) and inserts a Markdown link or
|
||||
image link. The directory must already exist; the handler does not create it
|
||||
or resolve name collisions automatically.
|
||||
|
||||
=M-x qwan/one-line-per-sentence= reformats a selected prose region by putting
|
||||
sentences on separate lines. It is not a full Org-aware formatter.
|
||||
|
||||
Other personal helpers live under =qwan/=, =mostalive/=, =lisp/=, and
|
||||
=coe-xx/=. The =coe-xx/= directory contains the cross-stitch pattern editor
|
||||
and preserves its own attribution and license.
|
||||
|
||||
** gptel and Pi
|
||||
|
||||
The macOS setup defines local OpenAI-compatible backends and Ollama; successive
|
||||
assignments mean the final normal =gptel-backend= binding is currently
|
||||
=mlx-studio= on =localhost:8080=. The Linux setup leaves backend choices to
|
||||
local configuration. These require the corresponding local or remote model
|
||||
servers, and private API keys belong in ignored =config-local.el=. Custom
|
||||
presets include code explanation, Elixir/Elisp help, and GLM workflows, but
|
||||
some model/backend references may be stale and should be checked against the
|
||||
models actually served.
|
||||
|
||||
Custom gptel tools include project search and a private Org-roam note search.
|
||||
The GLM search command also invokes an external Python script that is not
|
||||
included in this repository. Do not assume these tools or presets work without
|
||||
their personal files, note database, executables, and compatible model server.
|
||||
|
||||
Pi integration is available through =M-x pi= when the external pi CLI is
|
||||
installed and configured.
|
||||
|
||||
** Speech and dictation
|
||||
|
||||
The leader prefix =SPC A= provides Whisper actions: =w= records/transcribes,
|
||||
=W= transcribes a file, =l= selects language, and =d= toggles live dictation.
|
||||
FFmpeg and a suitable microphone/audio backend are required; macOS also needs
|
||||
Emacs microphone permission. =M-x live-dictate-diagnose= checks the live
|
||||
capture setup.
|
||||
|
||||
On macOS, =whisper.el= uses whisper.cpp remote mode at =localhost:13305=.
|
||||
Linux uses a Lemonade/OpenAI-compatible transcription API. The separate
|
||||
=lisp/live-dictate.el= client posts multipart WAV requests to whisper.cpp's
|
||||
=/inference= endpoint; a Linux installation must point it at a compatible
|
||||
endpoint separately. The Linux whisper.el setup does not automatically make
|
||||
that live-dictate endpoint compatible.
|
||||
|
||||
** Magit and presentation
|
||||
|
||||
The configuration retains a Magit =diff-hl= refresh workaround and enables
|
||||
=magit-delta=. Terminal delta formatting comes from settings outside this
|
||||
repository (for example, the user's =~/.gitconfig=), not from this checkout.
|
||||
|
||||
The macOS Org module enables =+present=; Linux does not. The installed Doom
|
||||
fork's presentation support includes centered-window, org-tree-slide, and
|
||||
org-re-reveal.
|
||||
|
||||
* LaTeX and PDF export
|
||||
|
||||
Org's LaTeX export uses =latexmk= with =xelatex= and an =article= class with
|
||||
Tufte-inspired styling (it is not a Tufte document class). The configured
|
||||
fonts are ETBembo RomanOSF, Raleway, and Fira Code. Install those fonts on
|
||||
whichever OS exports PDFs; the shared font setup is not inherently portable.
|
||||
|
||||
Check the tools with:
|
||||
|
||||
#+begin_src sh
|
||||
command -v latexmk
|
||||
command -v xelatex
|
||||
#+end_src
|
||||
|
||||
On macOS, configuration appends =/Library/TeX/texbin= to =PATH=. Install a
|
||||
TeX distribution that provides both tools using the appropriate method for
|
||||
your platform; this repository does not prescribe an unverified package
|
||||
manager recipe. Export/open a PDF through the Org export menu (=SPC m e=, then
|
||||
=l o= with the configured Doom bindings).
|
||||
|
||||
*** Instal fonts for tufte style
|
||||
Source of inspiration: https://so.nwalsh.com/2020/01/05-latex . Put the code in file:config.el on [[file:20201021093300-macos.org][MacOS]]. Looks like fonts need to go in ~$HOME/Library/Fonts~. And then one needs to run ~sudo texhash~ to actually add the fonts. (https://tex.stackexchange.com/questions/93983/xetex-use-otf-font-macports comment by Alan Munn).
|
||||
* Tests
|
||||
|
||||
**** Added fonts:
|
||||
***** ET Bembo:
|
||||
https://github.com/DavidBarts/ET_Bembo ([[file:20210510110643-edward_tufte.org][Tufte]] font)
|
||||
***** Raleway:
|
||||
google fonts had it: https://fonts.google.com/specimen/Raleway Readme included https://support.apple.com/en-us/HT201749 documentation on how to install fonts on mac os.
|
||||
xetex does not seem to support variable size fonts (see README in Raleway folder), so in ~Downloads~
|
||||
ERT tests are defined alongside several helpers and in
|
||||
=qwan/org-roam-export-blog-test.el=. Run the self-contained suites from the
|
||||
repository root with explicit loads:
|
||||
|
||||
#+begin_src bash
|
||||
open Raleway/static
|
||||
#+begin_src sh
|
||||
emacs --batch -Q -l ert -l qwan/qwan-dictation.el \
|
||||
-f ert-run-tests-batch-and-exit
|
||||
|
||||
emacs --batch -Q -L qwan -l org-roam-export-blog \
|
||||
-l qwan/org-roam-export-blog-test.el \
|
||||
-f ert-run-tests-batch-and-exit
|
||||
|
||||
emacs --batch -Q -l ert -l mostalive/journelly-convert-entry-to-org-roam.el \
|
||||
-f ert-run-tests-batch-and-exit
|
||||
#+end_src
|
||||
|
||||
select all, and then right-click open. 'install' on the first should install all of them.
|
||||
The Journelly parser tests can run without Org-roam, but invoking the
|
||||
conversion command requires Org-roam and its capture/property functions. These
|
||||
commands run selected standalone suites; they do not load every test in the
|
||||
repository or imply that the entire existing test suite passes.
|
||||
|
||||
***** Fira Code
|
||||
Because Operator Mono Ssm is not a free font.
|
||||
FYI : I initially replaced with Fira Mono from google fonts, made by mozilla apparently. Now Fira Code by mozilla works:
|
||||
#+begin_src latex
|
||||
\\setmonofont[Scale=MatchLowercase]{Fira Code}
|
||||
#+end_src
|
||||
* License
|
||||
|
||||
** Pretty deltas with magit-delta
|
||||
|
||||
Package added in file:packages.el enabled after magit in file:config.el.
|
||||
Highlighting / theme settings in file:~/.gitconfig.
|
||||
|
||||
*** Features
|
||||
- Line numbers are disabled in Magit and expanding/collapsing of diffs works correctly.
|
||||
- Line numbers and side-by-side view are enabled in the terminal.
|
||||
Reason / explanation in https://scripter.co/using-git-delta-with-magit/
|
||||
|
||||
Magit does not need line numbers, the line where one can expand/collapse already shows them.
|
||||
|
||||
=======
|
||||
Render to pdf, and open preview : ~SPC m e l o~ (m e - export. l - latex, o - open in pdf viewer)
|
||||
|
||||
putting https://so.nwalsh.com/2020/01/05-latex in my config.el on [[file:20201021093300-macos.org][MacOS]]. Looks like fonts need to go in ~$HOME/Library/Fonts~. And then one needs to run ~sudo texhash~ to actually add the fonts. (https://tex.stackexchange.com/questions/93983/xetex-use-otf-font-macports comment by Alan Munn).
|
||||
|
||||
Added fonts:
|
||||
- ET Bembo: https://github.com/DavidBarts/ET_Bembo ([[file:20210510110643-edward_tufte.org][Tufte]] font)
|
||||
- Raleway: google fonts had it: https://fonts.google.com/specimen/Raleway Readme included https://support.apple.com/en-us/HT201749 documentation on how to install fonts on mac os.
|
||||
- Operator Mono Ssm - this is not a free font apparently. maybe try Fira code instead.
|
||||
- replaced with Fira Mono from google fonts, made by mozilla apparently.
|
||||
|
||||
|
||||
* Configuration
|
||||
# How to configure this module, including common problems and how to address them.
|
||||
|
||||
* Troubleshooting
|
||||
# Common issues and their solution, or places to look for help.
|
||||
The top-level [[file:LICENSE][GPL-3.0 license]] applies to this repository. The
|
||||
=coe-xx/= directory retains its own license and attribution.
|
||||
|
||||
Reference in New Issue
Block a user