aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/jit-lock.el30
1 files changed, 14 insertions, 16 deletions
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 7ae79f057b7..e37a1812c9d 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -168,9 +168,9 @@ If nil, contextual fontification is disabled.")
168 "List of buffers that are being fontified stealthily.") 168 "List of buffers that are being fontified stealthily.")
169 169
170(defvar jit-lock--antiblink-grace-timer nil 170(defvar jit-lock--antiblink-grace-timer nil
171 "Idle timer for fontifying unterminated string or comment, or nil") 171 "Idle timer for fontifying unterminated string or comment, or nil.")
172(defvar jit-lock--antiblink-l-l-b (make-marker) 172(defvar jit-lock--antiblink-l-b-p (make-marker)
173 "Last line beginning (l-l-b) position after last command (a marker).") 173 "Last line beginning position (l-b-p) after last command (a marker).")
174(defvar jit-lock--antiblink-i-s-o-c nil 174(defvar jit-lock--antiblink-i-s-o-c nil
175 "In string or comment (i-s-o-c) after last command (a boolean).") 175 "In string or comment (i-s-o-c) after last command (a boolean).")
176 176
@@ -691,22 +691,22 @@ will take place when text is fontified stealthily."
691 (min jit-lock-context-unfontify-pos jit-lock-start)))))) 691 (min jit-lock-context-unfontify-pos jit-lock-start))))))
692 692
693(defun jit-lock--antiblink-post-command () 693(defun jit-lock--antiblink-post-command ()
694 (let* ((new-l-l-b (set-marker (make-marker) (line-beginning-position))) 694 (let* ((new-l-b-p (copy-marker (line-beginning-position)))
695 (new-i-s-o-c 695 (l-b-p-2 (line-beginning-position 2))
696 (nth 8 (save-excursion (syntax-ppss (line-end-position)))))
697 (same-line 696 (same-line
698 (and jit-lock-antiblink-grace 697 (and jit-lock-antiblink-grace
699 (eq (marker-buffer jit-lock--antiblink-l-l-b) (current-buffer)) 698 (not (= new-l-b-p l-b-p-2))
700 (= new-l-l-b jit-lock--antiblink-l-l-b)))) 699 (eq (marker-buffer jit-lock--antiblink-l-b-p) (current-buffer))
700 (= new-l-b-p jit-lock--antiblink-l-b-p)))
701 (new-i-s-o-c
702 (and same-line
703 (nth 8 (save-excursion (syntax-ppss l-b-p-2))))))
701 (cond (;; opened a new multiline string... 704 (cond (;; opened a new multiline string...
702 (and same-line 705 (and same-line
703
704 (null jit-lock--antiblink-i-s-o-c) new-i-s-o-c) 706 (null jit-lock--antiblink-i-s-o-c) new-i-s-o-c)
705 ;; assert that the grace timer is null and schedule it 707 ;; assert that the grace timer is null and schedule it
706 (when jit-lock--antiblink-grace-timer 708 (when jit-lock--antiblink-grace-timer
707 (display-warning 709 (message "internal warning: `jit-lock--antiblink-grace-timer' not null"))
708 'font-lock :level
709 "`jit-lock--antiblink-grace-timer' not null" :warning))
710 (setq jit-lock--antiblink-grace-timer 710 (setq jit-lock--antiblink-grace-timer
711 (run-with-idle-timer jit-lock-antiblink-grace nil 711 (run-with-idle-timer jit-lock-antiblink-grace nil
712 (lambda () 712 (lambda ()
@@ -721,9 +721,7 @@ will take place when text is fontified stealthily."
721 ;; `jit-lock-context-timer' as usual. 721 ;; `jit-lock-context-timer' as usual.
722 (when jit-lock--antiblink-grace-timer 722 (when jit-lock--antiblink-grace-timer
723 (cancel-timer jit-lock--antiblink-grace-timer) 723 (cancel-timer jit-lock--antiblink-grace-timer)
724 (setq jit-lock--antiblink-grace-timer nil)) 724 (setq jit-lock--antiblink-grace-timer nil)))
725
726 )
727 (same-line 725 (same-line
728 ;; in same line, but no state change, leave everything as it was 726 ;; in same line, but no state change, leave everything as it was
729 ) 727 )
@@ -739,7 +737,7 @@ will take place when text is fontified stealthily."
739 (cancel-timer jit-lock--antiblink-grace-timer) 737 (cancel-timer jit-lock--antiblink-grace-timer)
740 (setq jit-lock--antiblink-grace-timer nil)))) 738 (setq jit-lock--antiblink-grace-timer nil))))
741 ;; update variables 739 ;; update variables
742 (setq jit-lock--antiblink-l-l-b new-l-l-b 740 (setq jit-lock--antiblink-l-b-p new-l-b-p
743 jit-lock--antiblink-i-s-o-c new-i-s-o-c))) 741 jit-lock--antiblink-i-s-o-c new-i-s-o-c)))
744 742
745(provide 'jit-lock) 743(provide 'jit-lock)