1
0

home/develop/emacs: add yasnippet snippets and make snippet dirs configurable

This commit makes two significant changes to the Emacs configuration:

1. Refactors emacs.nix to use proper NixOS module structure:
   - Converts from simple configuration to a module with options/config
   - Adds `tb.emacs.extraSnippetDirs` option to allow per-machine snippet
     directories (defaults to ~/.emacs.d/snippets/)
   - Moves yasnippet configuration from custom.el to nix-generated elisp,
     enabling dynamic snippet directory configuration via Nix

2. Adds a comprehensive collection of yasnippet snippets for multiple modes:
   - C++ mode: 50 snippets for common patterns (class, namespace, operators,
     copy/move semantics, debug helpers, documentation, threading primitives)
   - CC mode (shared C/C++): for, switch, main, include guards, etc.
   - CMake mode: if/else, foreach, function, macro, project boilerplate
   - LaTeX mode: document structure, beamer frames, figures, lists
   - Perl mode: package boilerplate, shebang
   - Python/Shell/Nix/Protobuf/Java/CSS/Dockerfile modes: horizontal rules
     and common patterns
   - Text mode: modeline snippets for locale settings

The snippets use yasnippet's inheritance system via .yas-parents files,
so c++-mode inherits from cc-mode and text-mode, reducing duplication.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-08 22:38:18 -08:00
parent 3d098013a9
commit af6c1ba4e9
111 changed files with 951 additions and 130 deletions

View File

@@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: ho
# key: ho
# --
// ---[ $1 ]---------------------------