51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
---
|
|
name: emacs-svg-maps
|
|
description: Emacs workflows for SVG map editing — nxml-mode, EWW preview, Inkscape integration, and emacsclient commands for itinerary map projects.
|
|
---
|
|
|
|
# Emacs SVG Map Editing
|
|
|
|
## Quick Emacs Commands for SVG Work
|
|
|
|
### Open SVG for source editing (nxml-mode)
|
|
```bash
|
|
emacsclient --socket-name=water --eval '(find-file "netherlands3.svg")'
|
|
```
|
|
|
|
### Quick preview in EWW (limited but fast)
|
|
```bash
|
|
emacsclient --socket-name=water --eval '(eww-open-file (expand-file-name "netherlands3.svg"))'
|
|
```
|
|
Tell Fénix to press `g` in EWW to reload after changes.
|
|
|
|
### Navigate to MARKERS layer in SVG source
|
|
```bash
|
|
emacsclient --socket-name=water --eval '(progn (find-file "netherlands3.svg") (goto-char (point-min)) (search-forward "ITINERARY MARKERS"))'
|
|
```
|
|
|
|
### Check marker count
|
|
```bash
|
|
emacsclient --socket-name=water --eval '(with-current-buffer (find-file-noselect "netherlands3.svg") (count-matches "marker-" (point-min) (point-max)))'
|
|
```
|
|
|
|
## SVG + nxml-mode Tips
|
|
|
|
- SVG files open in `nxml-mode` automatically — syntax highlighting and tag matching
|
|
- `C-c C-f` / `C-c C-b` — fold/unfold XML elements (navigate large SVG layers)
|
|
- `C-c C-n` — narrow to current element (focus on one marker)
|
|
- `M-x nxml-balanced-close-start-tag` — auto-close SVG tags
|
|
|
|
## Integration with geo2svg.py
|
|
|
|
After running `python3 geo2svg.py --builtin netherlands3.svg`:
|
|
1. Emacs auto-reverts if `auto-revert-mode` is on
|
|
2. Otherwise: `M-x revert-buffer` in the SVG buffer
|
|
3. Check diff: `M-x magit-diff-buffer-file` or `C-x v =`
|
|
|
|
## Inkscape ↔ Emacs Handoff
|
|
|
|
When editing in Inkscape:
|
|
- Save in Inkscape → Emacs auto-reverts the buffer
|
|
- Edit source in Emacs → reload in Inkscape (`F5` or reopen)
|
|
- Use `git diff` before committing to filter Inkscape metadata noise
|