Skip to content

Build habit graph strings without aset - #12

Merged
colonelpanic8 merged 1 commit into
masterfrom
fix/emacs31-graph-string
Sep 3, 2026
Merged

Build habit graph strings without aset#12
colonelpanic8 merged 1 commit into
masterfrom
fix/emacs31-graph-string

Conversation

@colonelpanic8

Copy link
Copy Markdown
Owner

Problem

org-window-habit-make-graph-string allocated its buffer with make-string, which returns a unibyte string, then wrote the glyphs in with aset. Emacs 30 silently widened the string to multibyte on the first non-ASCII store. Emacs 31 does not, and signals:

Attempt to store non-byte value into unibyte string

Since the default glyphs are (org-window-habit-completed-glyph) and (org-window-habit-completion-needed-today-glyph), this breaks habit rendering outright on Emacs 31. It took down every /agenda request on a deployed org-agenda-api instance as soon as its container picked up Emacs 31.1.

Passing the multibyte flag to make-string is not a fix either: Emacs 31 also rejects an aset that changes a character's byte length.

Fix

Build the string from the glyphs with concat up front, then attach the face properties. No in-place character mutation.

Testing

nix flake check (byte-compile, checkdoc, package-lint, 277 ERT tests) passes against both Emacs 30.2 and Emacs 31.1. Added owh-test-make-graph-string-non-ascii-glyphs, which fails on the old implementation under Emacs 31 and asserts the glyphs, per-character faces, and the graph text property.

🤖 Generated with Claude Code

`make-string` returns a unibyte string, and Emacs 31 no longer lets
`aset` widen it when storing a non-ASCII glyph such as the default ✓ or
☐; it signals "Attempt to store non-byte value into unibyte string".
Passing the multibyte flag is not enough either, since Emacs 31 also
rejects an `aset` that changes a character's byte length. Concatenate
the glyphs up front and only attach text properties afterwards.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@colonelpanic8
colonelpanic8 merged commit a4ee615 into master Sep 3, 2026
1 check passed
@colonelpanic8
colonelpanic8 deleted the fix/emacs31-graph-string branch September 3, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant