Skip to content

Latest commit

 

History

590 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Emacs Doom Config

Dependencies

ugrep

fd

fzf

Environment Variables

nightNotes

Brish

night.sh

[help:night/codestral-key-get], etc. use z var-get

@todo
Create a helper function `night/z-var-get` which, when brish is available (`night/brish-p`), uses `z var-get`, but falls back on `getenv` when it's not. Use it everywhere we currently use `z var-get`.

[help:night/org-link-browser-current]

Converts Google search URLs to search: Org links, including UTF-8 queries such as Persian text. See docs/org-link-browser-current.md.

[help:night/paste-yank-html]

[agfi:pbpaste-html]
[help:night/org-insert-and-fix-levels]
Falls back to doing nothing and returning the input as is

[help:night/pbpaste]

Wraps current-kill while locally clearing osx-clipboard-last-selected-text so terminal macOS clipboard sync is not suppressed as already seen.

[help:night/h-kill-skip-whitespace]

Wraps kill-new and must forward optional arguments with &rest so boolean REPLACE values from kill-append remain valid apply tails.

[help:night/paste-md2org-sentencecased]

Converts Markdown clipboard text to Org, sentence-cases it, and inserts it with Org level adjustment.
With a prefix argument, joins the clipboard’s lines with newline2space first.

[help:night/newline2space]

Text-in/text-out wrapper around the zsh newline2space filter, for callers that already hold the text. [help:night/p-newline2space] is the clipboard-reading command.

[help:night/org-paste-escaped-in-md-code-block]

Bound to leader , <. Pastes the clipboard as a Markdown fenced code block, the Emacs counterpart of the Hammerspoon pasteBlockified on hyper+=,=.
Comma-escapes lines starting with * or #+ only in Org buffers, where they would otherwise be parsed as a heading or a keyword. Elsewhere the content goes in byte for byte, since a comma would corrupt it.
[help:night/h-md-code-fence] drops trailing whitespace so the closing fence always starts its own line, and grows the fence past the longest backtick run in the content so that fenced text nests correctly. A newline is opened first when point is mid-line.

[help:night/smart-text-paste]

Bound to leader , s.
In Org buffers outside md=/=markdown source blocks, converts Markdown clipboard text to Org before sentence-cased insertion.
Elsewhere, sentence-cases and inserts the clipboard text directly.
C-u leader , s first joins the clipboard’s lines with newline2space, for text copied out of a hard-wrapped terminal or a PDF. It is opt-in because that filter also flattens lists and paragraph breaks; see docs/smart-text-paste.md.

macOS

[help:night/org-link-safari-current]

Uses Applescript directly

[help:night/hs-alert]

Asynchronous wrapper over [agfi:hs-alert]; a wedged Hammerspoon must never block Emacs.

Keywords cover the whole hs-alert-v2 surface: :dur, :flash, :pos, :id, :markup, :color. Anything omitted keeps the zsh-side default.

Notes

Mobile line numbers

emc-mobile hides line numbers in marked terminal frames except at the final line; desktop buffer settings are preserved. See docs/mobile-line-numbers.md.

Yasnippet

Stale active field state

Org LaTeX preview

[help:night/org-latex-fix-begin-env-bug]

Rewrites \[...\] display math that Org mis-parses into \begin{equation*}...\end{equation*}.

A line starting with \begin{...} opens a latex-environment element, which ends the paragraph and strands the closing \], so only the inner environment previews or exports. Hits math written straight into org files by coding agents, which never passes through [agfi:md2org].

Lazy previewing on large files

audiofile: links and the audio mpv server

Following a link to a missing file used to kill the mpv server, breaking every later hear-* call for the rest of the session.

[agfi:hear-start-server] must pass --idle=yes: loadfile ... replace discards the playlist first, so any failed load left mpv with nothing to play and it exited, taking $mpv_audio_ipc with it.

[agfi:hear-loadfile] is the chokepoint; it now rejects missing files and prunes dead entries out of playlists.

[help:night/hear] checks too, so something lands in the echo area; [help:night/path-checkable-p] decides what Emacs may check, excluding URLs and zsh named dirs such as ~mu/.

[help:night/org-link-audiofile-follow] calls [help:night/hear] directly, so following a link never visits a buffer. [help:night/file-extension-actions2] is now just the fallback for media opened some other way.

Redis from Emacs

eredis cannot AUTH on connect, returns error replies as ordinary strings, and never reconnects. So an unauthenticated Emacs did not fail, it lied: [help:night/path-unabbrev] returned another process’s path, the password cache handed back NOAUTH Authentication required. as a passphrase, and [help:night/redis-lock] never acquired while with-redis-lock ran its body anyway.

[help:night/redis-connect] connects, AUTHs from ~/.redis-auth and confirms with PING; [help:night/redis-reconnect] is the recovery command.

Prefer the checked wrappers [help:night/redis-set], [help:night/redis-setnx], [help:night/redis-expire], [help:night/redis-get] over raw eredis calls.

A daemon that connected before requirepass was set stays authenticated, so it proves nothing. Test in a freshly connected Emacs.

Pasting into a search minibuffer

[help:night/pns] quotes the clipboard so it matches itself, but the correct quoting depends on who reads the pattern, and the same keystroke feeds four consumers.

Doom sets evil-ex-search-vim-style-regexp to t, so evil rewrote the (){}|+ that regexp-quote deliberately leaves bare. Pasting \hat{t} into / turned the braces into an interval and the search died with “Invalid content of \{\}”. [help:night-evil] now sets it nil.

[help:night/h-regex-dialect] names the dialect: emacs for evil and consult-line, and for consult’s ripgrep builder too, since [help:consult–compile-regexp] converts to PCRE itself. Only [help:night/consult-ugrep] binds it, to ugrep-bool, as its builder hands the input to ugrep unconverted.

[help:night/regex-group-shy] spells the non-capturing group per dialect. [help:night/h-arxiv-regex-canonizer] used to hardcode // where \\ was meant, so every non-ugrep search for an arxiv URL matched nothing.

ivy-rg (remote dirs) stays broken: [help:counsel–elisp-to-pcre] drops one backslash of a literal \\, and no input quoting survives that.

Fill-in-the-middle completion

[help:night/fim-providers] is the whole provider abstraction: every native FIM API takes the same body (model, prompt, suffix, max_tokens, stop), so an entry only names the endpoint, the key getter, the model, and whether the text is at choices[0].message.content (:extract chat, Mistral) or choices[0].text (:extract text, OpenAI-style). Configured: codestral (~0.3s), deepseek (deepseek-v4-pro, ~2s, better output), deepseek-flash (~1s).

[help:night/fim-provider-select] at leader . f and [help:night/fim-provider-show] at leader . F; f=/=F because p=/=P are taken by ellama-command-map. C-u M-. overrides the provider for one call only.

No FIM API exists from Google (Gemini is generateContent only; Codey code-gecko had real prefix=/=suffix but is PaLM-era and deprecated; CodeGemma is FIM-trained but self-hosted; Vertex’s answer is reselling Codestral), OpenRouter or Groq (chat-only), or Anthropic. So those keys are of no use here.

No automatic fallback to a second provider on error: a hotkey that silently switches models hides an expired key for weeks.

Not minuet-ai.el, which is the only real multi-provider FIM package but has no direct-insert command – its UX is ghost text plus minuet-accept-suggestion-line, and its failures go to a *minuet* buffer rather than the echo area. Worth installing separately on another key if ghost text is ever wanted.

[help:night/fim-insert-at-point] used to say nothing at all. It now reports FIM: requesting … with a indicator at the insertion point, then the outcome with its elapsed time.

Failures were doubly invisible. plz without :else hands the plz-error struct to :then instead of a body, so a 401 signalled wrong-type-argument inside the process sentinel; and the eight in-band error branches were (funcall callback (error "…")), where error signals during argument evaluation and the callback is never reached.

[help:night/fim-get] takes :on-error and :finally alongside :callback, mirroring plz’s own then/else split. [help:night/h-fim–api-message] tries Mistral’s detail, plain message, and DeepSeek’s OpenAI-shaped error.message, so a bad key reads FIM: HTTP 401 — Authentication Fails, Your api key: ****-key is invalid.

[help:night/h-fim–cancel] drops the buffer-local pending slot before killing curl. Killing it makes plz report a curl failure, and that handler must already look stale or every cancellation would announce itself as an error.

[help:night/fim-insert-at-point] claims that slot before sending, for the mirror reason: a missing key reports synchronously, and the guard has to see that report as current or it is swallowed as stale.

So a second M-. supersedes the first request rather than racing it, and C-g aborts. [help:night/h-fim-escape] returns nil, because doom-escape-hook runs under run-hook-with-args-until-success and a non-nil return would swallow the quit.

[help:night/fim-strip-leading-space] is nil. Dropping a leading space was unconditional, on the belief that Codestral prepended a stray one; over 29 contexts per provider all three do it at the same rate, and it is almost always right – ` 0’ after count =', or the whole indent when point is on an empty line. One sample in 87 was improved by stripping, three were broken by it. Binding it with =let does nothing, as the request is async; setq it.

A zsh twin lives on alt+.: [agfi:fim-get] in ~/scripts/zshlang/auto-load/others/fim.zsh, with the same provider table and the same request body, so the two want changing together. Callable from here as z fim-get <prefix> <suffix>.

The symbol at point in shell buffers

sh-mode-syntax-table gives symbol syntax to ! % : . ^ ~ ,, and - inherits it from the standard table, so the symbol at point inside ${alert_color:-red} was alert_color:-red.

That is not just a yio bug: * search ([help:evil-symbol-word-search] is t here), M-., company-dabbrev-code and [help:night/brishz-doc-at-point] all read the same table, so whichm was being asked about alert_color:-red too.

[help:night/sh-punctuation-chars] demotes : and % to punctuation in the table itself, which fixes all of those at once. - and . stay symbol constituents so night-foo, --color and a.txt remain whole; ! ^ ~ , are the next candidates if ${x^^} or {a,b} annoy.

sh-mode buffers share that table object, so mutating it reaches open buffers, and sh-set-shell only replaces it for shells listed in sh-mode-syntax-table-input (only rpm is).

SMIE tokenizes shell by syntax class, so this could have moved indentation. It does not: 100 real files under ~/scripts reindent identically under the old and new tables. Re-run that comparison if the char list grows.

- cannot go in that list – night-foo, --color and a-b need it – so ${alert_markup:-plain} still yanked -plain. A syntax table cannot express that; [help:night/sh-syntax-propertize-operators] does it per position instead, marking an operator that directly follows a : or a name inside ${}. Both are unambiguous: no construct has : followed directly by -+?= as part of a name, and a variable name cannot contain -.

Anchoring on : rather than on the surrounding construct is why ${(f)v:-w} works, which no bash parser could read. That, an uninstalled grammar, and the fact that *=/=M-.=/=whichm read syntax rather than a parse tree, are why this is not tree-sitter.

[help:night/sh-syntax-propertize-setup-h] must flush (`syntax-ppss-flush-cache’): if anything propertizes during mode setup, syntax-propertize--done is already at point-max and the rules silently never fire. It also runs over existing sh-mode buffers at load, since a mode hook alone leaves long-lived buffers on the old behaviour.

About

My somewhat modular emacs config.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages