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>
2025-12-08 22:38:18 -08:00
|
|
|
# -*- mode: snippet -*-
|
|
|
|
|
# name: perl
|
|
|
|
|
# key: perl
|
|
|
|
|
# --
|
|
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
use warnings;
|