]> git.eshelyaron.com Git - emacs.git/commitdiff
lisp/progmodes/prog-mode.el: prevent font-lock-flush boundary errors
authorTed Zlatanov <tzz@lifelogs.com>
Wed, 17 Jun 2020 14:28:27 +0000 (10:28 -0400)
committerTed Zlatanov <tzz@lifelogs.com>
Sun, 12 Jul 2020 20:27:57 +0000 (16:27 -0400)
lisp/progmodes/prog-mode.el

index d3d3deae4b1ef2826e2db29f26e09796696aad8c..49ab9fc03fa7d3eac5aed00e820d982dbe8c8f95 100644 (file)
@@ -183,6 +183,11 @@ on the symbol."
                   (> (point) (cadr prettify-symbols--current-symbol-bounds))
                   (and (not (eq prettify-symbols-unprettify-at-point 'right-edge))
                        (= (point) (cadr prettify-symbols--current-symbol-bounds)))))
+      ;; Adjust the bounds in case either end is invalid.
+      (setf (car prettify-symbols--current-symbol-bounds)
+            (max (car prettify-symbols--current-symbol-bounds) (point-min))
+            (cadr prettify-symbols--current-symbol-bounds)
+            (min (cadr prettify-symbols--current-symbol-bounds) (point-max)))
       (apply #'font-lock-flush prettify-symbols--current-symbol-bounds)
       (setq prettify-symbols--current-symbol-bounds nil))
     ;; Unprettify the current symbol.