GNU bug report logs - #13817
24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Tue, 26 Feb 2013 06:32:01 UTC

Severity: normal

Found in version 24.3.50

Fixed in version 24.4

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13817 in the body.
You can then email your comments to 13817 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13817; Package emacs. (Tue, 26 Feb 2013 06:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Gutov <dgutov <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 26 Feb 2013 06:32:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
	Disabling whitespace-mode that was enabled in sgml-mode-hook breaks
	font-lock
Date: Tue, 26 Feb 2013 10:29:13 +0400
Revno 111881 fixed the obvious problem with whitespace-mode, here's a
less obvious one.

This seems to be localized to sgml-mode and its derivatives so far:
js-mode, ruby-mode, etc are not affected.

1. (add-hook 'sgml-mode-hook 'whitespace-mode)
2. Open a file in sgml-mode or html-mode, or create a buffer and turn
either mode manually. whitespace-mode will be enabled.
3. M-x whitespace-mode => it's disabled, font-lock is gone, the value of
font-lock-keywords is (t nil).

On the surface, the reason for this is that when whitespace-mode is being
turned on in the hook, font-lock-keywords is still nil, and so nil is
saved in whitespace-font-lock-keywords.

In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.0)
 of 2013-02-26 on vbx
Bzr revision: 111882 eggert <at> cs.ucla.edu-20130226030908-c65ivknn1bm5hjru
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description:	Ubuntu 12.10




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13817; Package emacs. (Sun, 17 Mar 2013 22:32:01 GMT) Full text and rfc822 format available.

Message #8 received at 13817 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 13817 <at> debbugs.gnu.org
Subject: Re: bug#13817: 24.3.50;
	Disabling whitespace-mode that was enabled in sgml-mode-hook breaks
	font-lock
Date: Sun, 17 Mar 2013 18:30:07 -0400
> On the surface, the reason for this is that when whitespace-mode is being
> turned on in the hook, font-lock-keywords is still nil, and so nil is
> saved in whitespace-font-lock-keywords.

whitespace.el should probably use font-lock-remove-keywords instead.


        Stefan




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Tue, 19 Mar 2013 05:11:02 GMT) Full text and rfc822 format available.

Notification sent to Dmitry Gutov <dgutov <at> yandex.ru>:
bug acknowledged by developer. (Tue, 19 Mar 2013 05:11:04 GMT) Full text and rfc822 format available.

Message #13 received at 13817-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13817-done <at> debbugs.gnu.org
Subject: Re: bug#13817: 24.3.50; Disabling whitespace-mode that was enabled
	in sgml-mode-hook breaks font-lock
Date: Tue, 19 Mar 2013 09:09:00 +0400
Version: 24.4

On 18.03.2013 2:30, Stefan Monnier wrote:
>> On the surface, the reason for this is that when whitespace-mode is being
>> turned on in the hook, font-lock-keywords is still nil, and so nil is
>> saved in whitespace-font-lock-keywords.
>
> whitespace.el should probably use font-lock-remove-keywords instead.

That helped, thank you.

I left the disabling/enabling of font-lock-mode there, because otherwise 
the changes in highlighting are not visible until the buffer is modified.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13817; Package emacs. (Tue, 19 Mar 2013 13:05:02 GMT) Full text and rfc822 format available.

Message #16 received at 13817-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 13817-done <at> debbugs.gnu.org
Subject: Re: bug#13817: 24.3.50;
	Disabling whitespace-mode that was enabled in sgml-mode-hook breaks
	font-lock
Date: Tue, 19 Mar 2013 09:02:34 -0400
>>> On the surface, the reason for this is that when whitespace-mode is being
>>> turned on in the hook, font-lock-keywords is still nil, and so nil is
>>> saved in whitespace-font-lock-keywords.
>> whitespace.el should probably use font-lock-remove-keywords instead.
> That helped, thank you.
> I left the disabling/enabling of font-lock-mode there, because otherwise the
> changes in highlighting are not visible until the buffer is modified.

Supposedly `font-lock-fontify-buffer' is meant to do that without
disabling+enabling.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13817; Package emacs. (Tue, 19 Mar 2013 15:16:01 GMT) Full text and rfc822 format available.

Message #19 received at 13817-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13817-done <at> debbugs.gnu.org
Subject: Re: bug#13817: 24.3.50; Disabling whitespace-mode that was enabled
	in sgml-mode-hook breaks font-lock
Date: Tue, 19 Mar 2013 19:14:15 +0400
On 19.03.2013 17:02, Stefan Monnier wrote:
>>>> On the surface, the reason for this is that when whitespace-mode is being
>>>> turned on in the hook, font-lock-keywords is still nil, and so nil is
>>>> saved in whitespace-font-lock-keywords.
>>> whitespace.el should probably use font-lock-remove-keywords instead.
>> That helped, thank you.
>> I left the disabling/enabling of font-lock-mode there, because otherwise the
>> changes in highlighting are not visible until the buffer is modified.
>
> Supposedly `font-lock-fontify-buffer' is meant to do that without
> disabling+enabling.

That works, too. :)




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 17 Apr 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 20 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.