GNU bug report logs -
#25672
Font-locking issues when font-lock-fontified is nil (Was: What to do when font-lock-flush + font-lock-ensure do less than font-lock-fontify-buffer? on emacs-devel)
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25672 in the body.
You can then email your comments to 25672 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
:
bug#25672
; Package
emacs
.
(Thu, 09 Feb 2017 21:23:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Clément Pit--Claudel <clement.pitclaudel <at> live.com>
:
New bug report received and forwarded. Copy sent to
monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
.
(Thu, 09 Feb 2017 21:23:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
X-Debbugs-CC: monnier <at> iro.umontreal.ca
Hi bug-gnu-emacs,
Sorry for the long delay in opening this. This is a follow-up to the Emacs-devel thread "What to do when font-lock-flush + font-lock-ensure do less than font-lock-fontify-buffer?", where Stefan asked me to open a bug report.
My original question was this:
> IIUC the proper way in Emacs 25 to signal changes that require a
> refontification to font-lock is to call font-lock-flush. This doesn't always
> do as much as font-lock-fontify-buffer does, though. In particular, when the
> font-lock-fontified variable is nil (which does happen, though I don't know
> why; I don't know what this variable is for), then calling font-lock-fontify
> buffer does refontify the whole buffer, but font-lock-flush and
> font-lock-ensure don't seem to do anything. What's the proper way to mark a
> buffer for refontification (and refontify the visible portion) immediately in
> 25?
And here's is my original test case:
(with-current-buffer (get-buffer-create "temp")
(erase-buffer)
(setq-default prettify-symbols-unprettify-at-point 'right-edge)
(emacs-lisp-mode)
(prettify-symbols-mode)
(insert "lambda\n\nlambda")
(pop-to-buffer (current-buffer)))
Moving around in this buffer unprettifies and reprettifies ‘lambda’s into ‘λ’s as the point moves in and out of them. Setting ‘font-lock-fontified’ to nil breaks that mechanism (the ‘λ’s are unprettified but no reprettified), and no series of ‘font-lock-flush’ and ‘font-lock-ensure’ will reprettify them.
Eli remarked the following:
> However, please explain why font-lock-ensure-function calls
> font-lock-DEFAULT-fontify-buffer. If it's supposed to be good for any mode, why
> does it call the default fontification?
>
> As a matter of fact, if I replace the font-lock-default-fontify-buffer
> call with a call to font-lock-fontify-buffer, the problem described by
> the OP goes away. That is why I said what I said.
And Stefan answered:
> I haven't seen the beginning of the thread, but if that fixes the
> problem, then I think it's a good change.
>
> To go back to the previous question. I guess I used
> font-lock-default-fontify-buffer because the whole point is to get rid
> of all the misuses of font-lock-fontify-buffer, but I think in this case
> it's indeed the right thing to do.
Then Stefan said:
> > Should I open a bug report about this?
> Yes. And put me in X-Debbugs-Cc.
Done :)
Thanks,
Clément.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25672
; Package
emacs
.
(Wed, 30 Oct 2019 16:08:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 25672 <at> debbugs.gnu.org (full text, mbox):
Clément Pit--Claudel <clement.pitclaudel <at> live.com> writes:
> Eli remarked the following:
>
>> However, please explain why font-lock-ensure-function calls
>> font-lock-DEFAULT-fontify-buffer. If it's supposed to be good for
>> any mode, why
>> does it call the default fontification?
>>
>> As a matter of fact, if I replace the font-lock-default-fontify-buffer
>> call with a call to font-lock-fontify-buffer, the problem described by
>> the OP goes away. That is why I said what I said.
>
> And Stefan answered:
>
>> I haven't seen the beginning of the thread, but if that fixes the
>> problem, then I think it's a good change.
>>
>> To go back to the previous question. I guess I used
>> font-lock-default-fontify-buffer because the whole point is to get rid
>> of all the misuses of font-lock-fontify-buffer, but I think in this case
>> it's indeed the right thing to do.
I think this was fixed last year-ish if I'm reading the change log
correctly.
Currently, font-lock-ensure calls the value of
font-lock-ensure-function, which has a default value of
(lambda (beg end)
(unless font-lock-fontified
(save-excursion
(font-lock-fontify-region beg end))))
If global-font-lock-mode is on, it's jit-lock-fontify-now.
So I think this now works better, and I'm closing this bug report. If
this is still an issue, please reopen.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25672
; Package
emacs
.
(Wed, 30 Oct 2019 16:11:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 25672 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> I think this was fixed last year-ish if I'm reading the change log
> correctly.
Oh, I didn't. This is the definition of that function:
(defun font-lock-fontify-region (beg end &optional loudly)
"Fontify the text between BEG and END.
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))
which is indeed font-lock-default-fontify-region, which is what was
requested to have changed.
I think?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25672
; Package
emacs
.
(Sat, 14 Aug 2021 14:18:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 25672 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>> I think this was fixed last year-ish if I'm reading the change log
>> correctly.
>
> Oh, I didn't. This is the definition of that function:
And now I re-read it again, and as far as I can tell, I read it right
the first time. I.e., 21beb19d80b6a fixed the reported problem, so I'm
closing this bug report.
But I guess there may be subtleties here, so if this is still a problem,
please respond to the debbugs address and we'll reopen.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug closed, send any further explanations to
25672 <at> debbugs.gnu.org and Clément Pit--Claudel <clement.pitclaudel <at> live.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 14 Aug 2021 14:18:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 12 Sep 2021 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 284 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.