Created
April 26, 2020 00:09
-
-
Save gagbo/31917118594e3b36934d430d2f29cd85 to your computer and use it in GitHub Desktop.
Ligther version of composite.c bug in emacs 27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; ligature-bug-light.el --- Reproduce an autocomposition bug -*- lexical-binding: t; -*- | |
;;; Commentary: | |
;; | |
;; Reproducer for the composition table bug | |
;; | |
;;;; Method | |
;; | |
;; Evaluate the file | |
;; Expected : "=> testing overlays" is displayed at some point and disappear | |
;; Actual : inifinite looping, trying to "shape unibyte text", | |
;; which happens to be an empty string (from my earlier debugging) | |
;; | |
;;; Code: | |
(defvar ligature-font-with-big-arrow "Fira Code 11" | |
"A valid font name for `set-frame-font'. A font with a => ligature is necessary to trigger the bug.") | |
(defvar bugged-overlay nil "Bugged overlay trying to compose an empty string.") | |
;;;; Setup | |
;; Requiring composite | |
(require 'composite) | |
;; Shaping => into a ligature | |
(set-char-table-range composition-function-table ?= '(["=>" 0 font-shape-gstring])) | |
;; Setting the font | |
;; => | |
;; At this line | |
(set-frame-font ligature-font-with-big-arrow nil t) | |
;; Now you should see ligatures for => | |
;; => | |
;;;; Enabling the bug | |
(setq bugged-overlay (make-overlay (point-at-bol 4) (point-at-eol 4) (current-buffer))) | |
(overlay-put bugged-overlay 'category 'test-overlays) | |
;; C-x C-e at the end of this sexp will trigger infinite composition | |
(overlay-put bugged-overlay 'after-string "=> testing overlays") | |
(delete-overlay bugged-overlay) | |
(provide 'ligature-bug-light) | |
;;; ligature-bug-light.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment