unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: David Koppelman <koppel@ece.lsu.edu>, emacs-devel@gnu.org
Subject: Re: hi-lock-mode doesn't work with emacs -Q.
Date: Mon, 11 Jun 2007 16:25:14 -0400	[thread overview]
Message-ID: <jwvvedu464e.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20070607092651.GA1710@muc.de> (Alan Mackenzie's message of "Thu\, 7 Jun 2007 10\:26\:51 +0100")

> .  Enable hi-lock-mode and make "foo" a highlightable pattern:

>     M-x hi-lock-mode
>     C-x w h foo<CR><CR>    ; accept the default hi-yellow face.

> .  This highlights the "foo" yellow, as expected.  At the end of the
> line, type:

>     foo

> .  This new "foo" doesn't get highlighted.  It should be.

I believe the patch below fixes the problem without making things worse and
without requiring changes to hi-lock.el.


        Stefan


--- font-lock.el	08 May 2007 11:55:52 -0400	1.317
+++ font-lock.el	11 Jun 2007 15:56:01 -0400	
@@ -698,6 +698,14 @@
 	 ;; contain the new keywords.
 	 (font-lock-update-removed-keyword-alist mode keywords how))
 	(t
+         (when (and font-lock-mode
+                    (not (or font-lock-keywords font-lock-defaults)))
+           ;; The major mode has not set any keywords, so when we enabled
+           ;; font-lock-mode it only enabled the font-core.el part, not the
+           ;; font-lock-mode-internal.  Try again.
+           (font-lock-mode -1)
+           (set (make-local-variable 'font-lock-defaults) '(nil t))
+           (font-lock-mode 1))
 	 ;; Otherwise set or add the keywords now.
 	 ;; This is a no-op if it has been done already in this buffer
 	 ;; for the correct major mode.

  parent reply	other threads:[~2007-06-11 20:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-07  9:26 hi-lock-mode doesn't work with emacs -Q Alan Mackenzie
2007-06-07 13:22 ` Stefan Monnier
2007-06-08 11:11   ` Alan Mackenzie
2007-06-11 20:25 ` Stefan Monnier [this message]
2007-06-15 23:04   ` Alan Mackenzie
2007-06-15 21:51     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvvedu464e.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=koppel@ece.lsu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).