[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes
From: |
Stefan Monnier |
Subject: |
Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049. |
Date: |
Fri, 15 Nov 2019 18:27:21 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> IIUC this can't be fixed in font-lock or jit-lock.
> Why not?
Good question. Looks like I was wrong.
I think the patch below is a better general solution.
Stefan
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 01c19e6e87..9c1c193eda 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1071,7 +1071,9 @@ font-lock-fontify-region
If LOUDLY is non-nil, print status messages while fontifying.
This works by calling `font-lock-fontify-region-function'."
(font-lock-set-defaults)
- (funcall font-lock-fontify-region-function beg end loudly))
+ (save-restriction
+ (unless font-lock-dont-widen (widen))
+ (funcall font-lock-fontify-region-function beg end loudly)))
(defun font-lock-unfontify-region (beg end)
"Unfontify the text between BEG and END.
@@ -1221,8 +1221,6 @@
(save-buffer-state
;; Use the fontification syntax table, if any.
(with-syntax-table (or font-lock-syntax-table (syntax-table))
- (save-restriction
- (unless font-lock-dont-widen (widen))
;; Extend the region to fontify so that it starts and ends at
;; safe places.
(let ((funs font-lock-extend-region-functions)
@@ -1251,7 +1249,7 @@
(unless font-lock-keywords-only
(font-lock-fontify-syntactically-region beg end loudly))
(font-lock-fontify-keywords-region beg end loudly)
- `(jit-lock-bounds ,beg . ,end)))))
+ `(jit-lock-bounds ,beg . ,end))))
;; The following must be rethought, since keywords can override fontification.
;; ;; Now scan for keywords, but not if we are inside a comment now.
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., (continued)
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/15
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/15
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Stefan Monnier, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/15
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/15
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049.,
Stefan Monnier <=
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/16
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Stefan Monnier, 2019/11/16
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/16
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/17
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/17
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/17
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Eli Zaretskii, 2019/11/17
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/17
- Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049., Dmitry Gutov, 2019/11/14
- Several Major Modes. [Was: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049.], Alan Mackenzie, 2019/11/14