diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index 24afd03fbe6..68483ab9333 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -269,6 +269,14 @@ See `eldoc-documentation-strategy' for more detail." (eldoc-mode 1))) +(defun eldoc--update () + (when (or eldoc-mode + (and global-eldoc-mode + (eldoc--supported-p))) + ;; Don't ignore, but also don't full-on signal errors + (with-demoted-errors "eldoc error: %s" + (eldoc-print-current-symbol-info)) )) + (defun eldoc-schedule-timer () "Ensure `eldoc-timer' is running. @@ -279,13 +287,7 @@ reflect the change." (setq eldoc-timer (run-with-idle-timer eldoc-idle-delay nil - (lambda () - (when (or eldoc-mode - (and global-eldoc-mode - (eldoc--supported-p))) - ;; Don't ignore, but also don't full-on signal errors - (with-demoted-errors "eldoc error: %s" - (eldoc-print-current-symbol-info)) ))))) + 'eldoc--update))) ;; If user has changed the idle delay, update the timer. (cond ((not (= eldoc-idle-delay eldoc-current-idle-delay)) diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el index 05c0bd847b3..c0fc41b5afe 100644 --- a/lisp/jit-lock.el +++ b/lisp/jit-lock.el @@ -179,6 +179,10 @@ If nil, contextual fontification is disabled.") ;;; JIT lock mode +(defun jit-lock-context--update () + (unless jit-lock--antiblink-grace-timer + (jit-lock-context-fontify))) + (defun jit-lock-mode (arg) "Toggle Just-in-time Lock mode. Turn Just-in-time Lock mode on if and only if ARG is non-nil. @@ -255,10 +259,7 @@ If you need to debug code run from jit-lock, see `jit-lock-debug-mode'." (when (eq jit-lock-contextually t) (unless jit-lock-context-timer (setq jit-lock-context-timer - (run-with-idle-timer jit-lock-context-time t - (lambda () - (unless jit-lock--antiblink-grace-timer - (jit-lock-context-fontify)))))) + (run-with-idle-timer jit-lock-context-time t 'jit-lock-context--update))) (add-hook 'post-command-hook #'jit-lock--antiblink-post-command nil t) (setq jit-lock-context-unfontify-pos (or jit-lock-context-unfontify-pos (point-max)))) @@ -706,6 +707,10 @@ will take place when text is fontified stealthily." ;; buffer, only jit-lock-context-* will re-fontify it. (min jit-lock-context-unfontify-pos jit-lock-start)))))) +(defun jit-lock--antiblink-update () + (jit-lock-context-fontify) + (setq jit-lock--antiblink-grace-timer nil)) + (defun jit-lock--antiblink-post-command () (let* ((new-l-b-p (copy-marker (syntax--lbp))) (l-b-p-2 (syntax--lbp 2)) @@ -722,11 +727,7 @@ will take place when text is fontified stealthily." (and same-line (null jit-lock--antiblink-string-or-comment) new-s-o-c) (setq jit-lock--antiblink-grace-timer - (run-with-idle-timer jit-lock-antiblink-grace nil - (lambda () - (jit-lock-context-fontify) - (setq jit-lock--antiblink-grace-timer - nil))))) + (run-with-idle-timer jit-lock-antiblink-grace nil 'jit-lock--antiblink-update))) (;; Closed an unterminated multiline string. (and same-line (null new-s-o-c) jit-lock--antiblink-string-or-comment)