From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: hi-lock-mode doesn't work with emacs -Q. Date: Mon, 11 Jun 2007 16:25:14 -0400 Message-ID: References: <20070607092651.GA1710@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1181593530 19299 80.91.229.12 (11 Jun 2007 20:25:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 11 Jun 2007 20:25:30 +0000 (UTC) Cc: David Koppelman , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 11 22:25:28 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HxqS6-00086k-T3 for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2007 22:25:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HxqS6-0001Wv-1X for ged-emacs-devel@m.gmane.org; Mon, 11 Jun 2007 16:25:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HxqS2-0001Wp-7l for emacs-devel@gnu.org; Mon, 11 Jun 2007 16:25:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HxqS1-0001Wd-Mn for emacs-devel@gnu.org; Mon, 11 Jun 2007 16:25:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HxqS1-0001Wa-Fr for emacs-devel@gnu.org; Mon, 11 Jun 2007 16:25:21 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HxqS1-000478-70 for emacs-devel@gnu.org; Mon, 11 Jun 2007 16:25:21 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id D25E52CF075; Mon, 11 Jun 2007 16:25:20 -0400 (EDT) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 961D73FE0; Mon, 11 Jun 2007 16:25:14 -0400 (EDT) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 7F81A4C6D25; Mon, 11 Jun 2007 16:25:14 -0400 (EDT) In-Reply-To: <20070607092651.GA1710@muc.de> (Alan Mackenzie's message of "Thu\, 7 Jun 2007 10\:26\:51 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-kernel: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:72644 Archived-At: > . Enable hi-lock-mode and make "foo" a highlightable pattern: > M-x hi-lock-mode > C-x w h foo ; 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.