diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-26 12:47:30 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-26 12:47:30 -0500 |
| commit | 53a447b36876b18302ac4f2d9b7cc1a6cb3407c5 (patch) | |
| tree | 7b9b607075aad03ac057a3708da080803eb3903e /modules | |
| parent | f23ca905740411f324c2d1fef9f9ffba4b7b7424 (diff) | |
| download | dotemacs-53a447b36876b18302ac4f2d9b7cc1a6cb3407c5.tar.gz dotemacs-53a447b36876b18302ac4f2d9b7cc1a6cb3407c5.zip | |
fix(text): compose every org src-block marker to the lambda glyph
The prettify-symbols alist already mapped #+begin_src and #+end_src to a lambda, but only some markers actually rendered as one. prettify-symbols-default-compose-p decides composition from a syntax heuristic on the characters around the match, and inside org's src-block fontification that heuristic vetoed most of the markers. In todo.org only one of five composed.
I added cj/prettify-compose-block-markers-p, a compose predicate that always composes the block markers (case-insensitive, since the alist carries upcased variants) and defers to the default for everything else like lambda. Every marker composes now. Tests cover the marker branch and the deferral to the default.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/text-config.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/text-config.el b/modules/text-config.el index 5a946d52..14e06f3e 100644 --- a/modules/text-config.el +++ b/modules/text-config.el @@ -89,6 +89,20 @@ PAIR is a cons cell of (string . symbol)." ("#+end_src" . "λ") ("lambda" . "λ"))))) +(defun cj/prettify-compose-block-markers-p (start end match) + "Always compose the org src-block markers; defer to the default otherwise. +`prettify-symbols-default-compose-p' uses a syntax heuristic on the +characters around MATCH that fires inconsistently for `#+begin_src' / +`#+end_src' across blocks in the same org buffer, an interaction with org's +own src-block fontification: some markers compose to the lambda glyph and +others stay literal. Force composition for the markers (matched +case-insensitively, since the alist carries upcased variants too) and let +everything else, such as `lambda', use the standard boundary check." + (or (member (downcase match) '("#+begin_src" "#+end_src")) + (prettify-symbols-default-compose-p start end match))) + +(setopt prettify-symbols-compose-predicate #'cj/prettify-compose-block-markers-p) + (add-hook 'prog-mode-hook #'turn-on-prettify-symbols-mode) (add-hook 'org-mode-hook #'turn-on-prettify-symbols-mode) |
