aboutsummaryrefslogtreecommitdiffstats

emacs_setup

Git-tracked Emacs configuration. emacs.el is the source of truth; ~/.emacs is a symlink to it, so the live config is always the latest version in this repo.

Layout

File Purpose
emacs.el The init file itself (what ~/.emacs points to)
check.sh Validate the config loads cleanly
install.sh Back up old config, symlink ~/.emacs → emacs.el
backups/ Pre-install backups (gitignored)

Usage

./install.sh     # one-time: symlink ~/.emacs -> emacs.el (backs up the old file)
./check.sh       # or: make check -- run before committing
make status      # see uncommitted drift

Workflow after installing

  • Edit the config either in Emacs (C-x C-f ~/.emacs) or here — same file.
  • Changes made by M-x customize (custom-set-variables) land directly in this working tree; review with git diff, commit when happy.
  • To try a change: save, ./check.sh, then restart Emacs.
  • To roll back: git checkout <commit> -- emacs.el — the symlink picks it up immediately, no reinstall.
  • To restore the pre-repo config entirely: copy the newest file from backups/ back to ~/.emacs (replacing the symlink).

Findings from the initial check (2026-09-10)

Fixed in a follow-up commit:

  1. Missing lexical-binding cookie — startup warning on every launch. Added -*- lexical-binding: t; -*- to line 1 (verified the file loads cleanly under lexical binding).
  2. Unguarded Verilog LSP client — the config registers verible-verilog-ls and hooks lsp into verilog-mode, but the binary is not installed, so opening Verilog files errored. Now registered only when the binary exists (executable-find). Install verible to re-enable.
  3. Harmless native-comp warnings — packages like go-mode reference lsp-mode/eglot functions they don't require; the resulting (native-compiler) warnings cluttered Warnings. Now suppressed (warning-suppress-types, after the custom block).

Python: per-project micromamba environments

Python LSP is deliberately NOT enabled globally (see the comment on the eglot use-package form): mode hooks run before .dir-locals.el applies, so a global hook would always connect to the system pylsp. Instead each micromamba project carries a .dir-locals.el that points the interpreter, exec-path and eglot at the env, then starts eglot.

New project setup:

micromamba create -n ENVNAME -c conda-forge python=3.12 python-lsp-server <libs>
cp templates/python-project-dir-locals.el <project>/.dir-locals.el  # edit env path

First time you open a file in the project, Emacs asks to trust the eval forms — answer ! (trust always).

~/Projects/vkeHF is set up this way with env vkehf (numpy, control, matplotlib, python-lsp-server); verified that eglot spawns ~/.local/share/mamba/envs/vkehf/bin/pylsp.

Known quirks left as-is (deliberate-looking choices — revisit if annoying):

  • lsp-mode and eglot are both active: lsp-mode owns C/C++/Verilog/VHDL/ LaTeX, eglot owns Java/Scala/Clojure (Python is per-project, see above). The C/C++ overlap is noted in the config itself. Works, but pick one eventually.
  • jdtls is not installed, so Java files will fail to start eglot. Install jdtls (or drop java-mode from the eglot hook).
  • flycheck-c/c++-gcc-executable is set to /usr/bin/avr-gcc in custom-set-variables — flycheck uses avr-gcc for all C files, not just AVR projects. Consider moving it to per-project .dir-locals.el.
  • helm and vertico/consult are both configured (two completion stacks); helm is only used for gtags navigation.