[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/jit-lock-antiblink-cleaned-up afa1f6d 2/6: Rework jit-lock-antib
From: |
João Távora |
Subject: |
scratch/jit-lock-antiblink-cleaned-up afa1f6d 2/6: Rework jit-lock-antiblink-grace after Stefan's comments |
Date: |
Sun, 1 Dec 2019 12:50:53 -0500 (EST) |
branch: scratch/jit-lock-antiblink-cleaned-up
commit afa1f6d61e0dcd6f61ce428f460aac3a58391076
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Rework jit-lock-antiblink-grace after Stefan's comments
* lisp/jit-lock.el (jit-lock--antiblink-l-b-p): Rename from
jit-lock--antiblink-l-l-b.
(jit-lock--antiblink-grace-timer): Add period to docstring.
(jit-lock--antiblink-post-command): Rework after Stefan's
comments.
---
lisp/jit-lock.el | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 7902797..733fcdd 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -170,9 +170,9 @@ If nil, contextual fontification is disabled.")
"List of buffers that are being fontified stealthily.")
(defvar jit-lock--antiblink-grace-timer nil
- "Idle timer for fontifying unterminated string or comment, or nil")
-(defvar jit-lock--antiblink-l-l-b (make-marker)
- "Last line beginning (l-l-b) position after last command (a marker).")
+ "Idle timer for fontifying unterminated string or comment, or nil.")
+(defvar jit-lock--antiblink-l-b-p (make-marker)
+ "Last line beginning position (l-b-p) after last command (a marker).")
(defvar jit-lock--antiblink-i-s-o-c nil
"In string or comment (i-s-o-c) after last command (a boolean).")
@@ -693,22 +693,22 @@ will take place when text is fontified stealthily."
(min jit-lock-context-unfontify-pos jit-lock-start))))))
(defun jit-lock--antiblink-post-command ()
- (let* ((new-l-l-b (set-marker (make-marker) (line-beginning-position)))
- (new-i-s-o-c
- (nth 8 (save-excursion (syntax-ppss (line-end-position)))))
+ (let* ((new-l-b-p (copy-marker (line-beginning-position)))
+ (l-b-p-2 (line-beginning-position 2))
(same-line
(and jit-lock-antiblink-grace
- (eq (marker-buffer jit-lock--antiblink-l-l-b) (current-buffer))
- (= new-l-l-b jit-lock--antiblink-l-l-b))))
+ (not (= new-l-b-p l-b-p-2))
+ (eq (marker-buffer jit-lock--antiblink-l-b-p) (current-buffer))
+ (= new-l-b-p jit-lock--antiblink-l-b-p)))
+ (new-i-s-o-c
+ (and same-line
+ (nth 8 (save-excursion (syntax-ppss l-b-p-2))))))
(cond (;; opened a new multiline string...
(and same-line
-
(null jit-lock--antiblink-i-s-o-c) new-i-s-o-c)
;; assert that the grace timer is null and schedule it
(when jit-lock--antiblink-grace-timer
- (display-warning
- 'font-lock :level
- "`jit-lock--antiblink-grace-timer' not null" :warning))
+ (message "internal warning: `jit-lock--antiblink-grace-timer' not
null"))
(setq jit-lock--antiblink-grace-timer
(run-with-idle-timer jit-lock-antiblink-grace nil
(lambda ()
@@ -723,9 +723,7 @@ will take place when text is fontified stealthily."
;; `jit-lock-context-timer' as usual.
(when jit-lock--antiblink-grace-timer
(cancel-timer jit-lock--antiblink-grace-timer)
- (setq jit-lock--antiblink-grace-timer nil))
-
- )
+ (setq jit-lock--antiblink-grace-timer nil)))
(same-line
;; in same line, but no state change, leave everything as it was
)
@@ -741,7 +739,7 @@ will take place when text is fontified stealthily."
(cancel-timer jit-lock--antiblink-grace-timer)
(setq jit-lock--antiblink-grace-timer nil))))
;; update variables
- (setq jit-lock--antiblink-l-l-b new-l-l-b
+ (setq jit-lock--antiblink-l-b-p new-l-b-p
jit-lock--antiblink-i-s-o-c new-i-s-o-c)))
(provide 'jit-lock)
- branch scratch/jit-lock-antiblink-cleaned-up created (now 6752ddc), João Távora, 2019/12/01
- scratch/jit-lock-antiblink-cleaned-up 38b5ad6 5/6: Adjust jit-lock-antiblink documentation again, João Távora, 2019/12/01
- scratch/jit-lock-antiblink-cleaned-up de32118 1/6: New jit-lock-antiblink-grace feature, João Távora, 2019/12/01
- scratch/jit-lock-antiblink-cleaned-up e02846c 4/6: Tweak jit-lock-antiblink-grace's docs and code style, João Távora, 2019/12/01
- scratch/jit-lock-antiblink-cleaned-up 6752ddc 6/6: Another tweak to NEWS, João Távora, 2019/12/01
- scratch/jit-lock-antiblink-cleaned-up d5843af 3/6: * etc/NEWS: Mention jit-lock-antiblink-grace, João Távora, 2019/12/01
- scratch/jit-lock-antiblink-cleaned-up afa1f6d 2/6: Rework jit-lock-antiblink-grace after Stefan's comments,
João Távora <=