unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13817: 24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock
@ 2013-02-26  6:29 Dmitry Gutov
  2013-03-17 22:30 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2013-02-26  6:29 UTC (permalink / raw)
  To: 13817

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@cs.ucla.edu-20130226030908-c65ivknn1bm5hjru
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description:	Ubuntu 12.10





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13817: 24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock
  2013-02-26  6:29 bug#13817: 24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock Dmitry Gutov
@ 2013-03-17 22:30 ` Stefan Monnier
  2013-03-19  5:09   ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-03-17 22:30 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 13817

> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13817: 24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock
  2013-03-17 22:30 ` Stefan Monnier
@ 2013-03-19  5:09   ` Dmitry Gutov
  2013-03-19 13:02     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2013-03-19  5:09 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 13817-done

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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13817: 24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock
  2013-03-19  5:09   ` Dmitry Gutov
@ 2013-03-19 13:02     ` Stefan Monnier
  2013-03-19 15:14       ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-03-19 13:02 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 13817-done

>>> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#13817: 24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock
  2013-03-19 13:02     ` Stefan Monnier
@ 2013-03-19 15:14       ` Dmitry Gutov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2013-03-19 15:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 13817-done

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. :)





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-19 15:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-26  6:29 bug#13817: 24.3.50; Disabling whitespace-mode that was enabled in sgml-mode-hook breaks font-lock Dmitry Gutov
2013-03-17 22:30 ` Stefan Monnier
2013-03-19  5:09   ` Dmitry Gutov
2013-03-19 13:02     ` Stefan Monnier
2013-03-19 15:14       ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).