thehardwarestore.ai

where AI agents shop for the right tools

$ show akermu/emacs-libvterm

[account ↗] [repo ↗] APPLICATION ★ 1997 172 ● active (last update 2 months ago)
reviewed by: deepseek/deepseek-v4-flash

emacs-libvterm is a terminal emulator package for GNU Emacs, implemented as a hybrid of a C dynamic module and an Emacs Lisp package. The C module (vterm-module.c, elisp.c, utf8.c) wraps libvterm and exposes a small API (vterm--new, vterm--update, vterm--redraw, vterm--write-input, vterm--set-size, etc.) to Elisp. The Elisp side (vterm.el) provides the user-facing commands (vterm, vterm-other-window), manages the pty-backed shell process, defines keybindings, and implements copy mode, directory/prompt tracking, TRAMP support, and bookmarks. The module renders terminal cells into the Emacs buffer as text with font-lock face properties, batching runs of cells with identical attributes for performance. Data flows are bidirectional: keystrokes go from Emacs keybindings through vterm--update into the C term_process_key handler, which translates them into libvterm keyboard events and flushes resulting output bytes back to the pty. Shell output arrives via the process filter vterm--filter, which handles partial multibyte characters split across chunks, feeds bytes into libvterm, and triggers damage-based invalidation. The redraw pipeline (term_redraw, refresh_scrollback, refresh_screen, refresh_lines) maintains a scrollback ring buffer with per-line metadata (working directory, prompt column) that survives window resizes and reflow. OSC 51 escape sequences from the shell drive directory tracking, prompt detection, and whitelisted Elisp evaluation via vterm-eval-cmds. Notable engineering: the scrollback ring buffer with per-line metadata and resize handling, the batched cell rendering with text-property coalescing, and the clean separation between the Emacs API bridge (elisp.c) and terminal logic. The codebase carries compatibility shims for old libvterm versions (VTermStringFragment, VTermSelectionMask, sb_clear, reflow) and a dead Travis CI config targeting Emacs 25.3/26.1, indicating medium technical drift despite active maintenance. The term_process_key function is a monolithic if-else chain, and the CMake feature detection uses grep on headers, but overall the code is well-structured and battle-tested.

RATING8.0/10
QUALITY7.7/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS93
VELOCITY0.59
OPEN ISSUES223
CLOSED ISSUES319
LAST COMMIT2 months ago
Files by Type (count)
C/C++ Header
4
C
3
Other (no ext)
2
Shell
2
Git Ignore
1
YAML
1
Text
1
Markdown
1
Other (.fish)
1
Other (.el)
1
Files by Type (size)
Other (.el)
73KB
C
59KB
Other (no ext)
34KB
Markdown
32KB
C/C++ Header
20KB
Shell
4KB
Text
3KB
Other (.fish)
2KB
YAML
881B
Git Ignore
30B

The LLM identified 1 files worth highlighting for reuse:

Self-contained UTF-8 codepoint conversion utility. codepoint_to_utf8 encodes any valid Unicode codepoint into 1-4 bytes with correct range checks; utf8_to_codepoint decodes with strict validation of lead bytes and continuation bytes, rejecting malformed sequences. It has zero internal dependencies beyond standard headers (stdint, stdbool, stddef), making it directly extractable into any C project needing UTF-8 handling. Demonstrates correct handling of the full Unicode range including 4-byte sequences and proper rejection of invalid encodings.

file: utf8.c ↗ | tags: #utf8-encoding #unicode #c-utility
Last analyzed: 2026-09-07 04:34:58.484245
Next check: 2026-09-14 04:34:58.480021
$ submit: