From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: What to do when font-lock-flush + font-lock-ensure do less than font-lock-fontify-buffer? Date: Mon, 22 Feb 2016 11:35:58 -0500 Message-ID: References: <56CA94A8.3000205@gmail.com> <83si0klo3c.fsf@gnu.org> <56CB3756.6000906@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2b0ead98b2d052c5e6ffe X-Trace: ger.gmane.org 1456160213 25255 80.91.229.3 (22 Feb 2016 16:56:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Feb 2016 16:56:53 +0000 (UTC) Cc: Eli Zaretskii , Emacs developers To: =?UTF-8?B?Q2zDqW1lbnQgUGl0LS1DbGF1ZGVs?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 22 17:56:52 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aXtn0-0005SM-Ff for ged-emacs-devel@m.gmane.org; Mon, 22 Feb 2016 17:56:50 +0100 Original-Received: from localhost ([::1]:50298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXtmz-00034E-Pw for ged-emacs-devel@m.gmane.org; Mon, 22 Feb 2016 11:56:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXtTV-0003Qx-1f for emacs-devel@gnu.org; Mon, 22 Feb 2016 11:36:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXtTU-0005Pm-25 for emacs-devel@gnu.org; Mon, 22 Feb 2016 11:36:40 -0500 Original-Received: from mail-ob0-x22c.google.com ([2607:f8b0:4003:c01::22c]:33543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXtTT-0005PR-De; Mon, 22 Feb 2016 11:36:39 -0500 Original-Received: by mail-ob0-x22c.google.com with SMTP id jq7so169988848obb.0; Mon, 22 Feb 2016 08:36:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=PMTUlBNurkKr6df9pRT7smv/9W6hbJbxFFk5oCIsdUc=; b=DTUdR7jNTyhz3KJPzj+GvhTN2QbpNTM8xOLkpzzqoTXiHRwJ5f/GmoWaPNjYOsDE3u PrnM3S7hZIM0a2z3cgRn2eSxudgWL938XFFayZOMnDOkpKiel+A6cguTUn1J/LNbmAAM sr5AxPYF5N8gV8UDBBWl6R1xVKfM1EPxDaTislv93y8lWGjo14HzdxiEcQ5K69I7sxYF dEkDV3q/M5M99bATFcivmoQpIiy3b9umrl24oACkrwhHMChXe+VtftFIf1ammCM0etpk 8a/GP8/f72apn29QWhlMPjt2KAoIxDcamUGla8MzYDfJyDwim2QotSx/tqFokJu9tkJe avdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=PMTUlBNurkKr6df9pRT7smv/9W6hbJbxFFk5oCIsdUc=; b=NP+zaC90025FsoWLciLOXy4q+06IkX82/6Ie8gdbnz5ezmf+bdMENbjIbiFgXOlDzd HxBbktqAHmEDZRyH4L74Od3QTspwDx/s5hr2MFMEIiNV2uu1rwBRGMUH5G1pvlZ24Yx7 VMFAr4Fi6N6f9LBSmJGeblc0jD88ob6GHN9IcZRwT2UcVoF5jwEsfr2LvNJrropph0Wb l2bS5Q9waBgH/REpbAMkKhAOvcp5hC9rSlBRYjfezBlday53C+XB81nA7Z0N0BJbPEol MfVe/AJxjUvA6gAJGyG3WITr9eQlwZlG/P42ctntl2oJOzShsW6jsdN6jtGgBLvg9BFG O2FQ== X-Gm-Message-State: AG10YOS8fxIo7GkrFQRYIawyxIbRfrN1RKVpc7Hzj7wKw4eDGSOJ1CTOQKHmzbnYgfeDaQ1mM3Ca8LJDgqH/dA== X-Received: by 10.182.241.134 with SMTP id wi6mr23259146obc.81.1456158998625; Mon, 22 Feb 2016 08:36:38 -0800 (PST) Original-Received: by 10.202.201.73 with HTTP; Mon, 22 Feb 2016 08:35:58 -0800 (PST) In-Reply-To: <56CB3756.6000906@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c01::22c X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:200464 Archived-At: --001a11c2b0ead98b2d052c5e6ffe Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, Feb 22, 2016 at 11:29 AM, Cl=C3=A9ment Pit--Claudel < clement.pit@gmail.com> wrote: > In any case where font-lock-fontified is nil font-lock-fontify-buffer wil= l > properly refontify the whole buffer, but font-lock-flush and font-lock > ensure will not do anything. I don't know what causes that variable to be > nil in the first place, though. I am not sure if this is related. But in order for hi-lock-file-patterns to work in a text-mode buffer, I need to do the below because font-lock-fontified is nil for text-mode (as technically there are no comments or keywords to highlight in that major mode). ;; Enable `hi-lock-mode' in `text-mode' too ;; The hi-lock fontification will not be visible (the `font-lock-keywords' ;; variable will not be updated unless `font-lock-fontified' is already `t'. ;; This was derived by studying the definition of `hi-lock-font-lock-hook' ;; function. (defun modi/hi-lock-enable-in-text-mode () (setq-local font-lock-fontified t)) (add-hook 'text-mode-hook #'modi/hi-lock-enable-in-text-mode) -- Kaushal Modi --001a11c2b0ead98b2d052c5e6ffe Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Mon, Feb 22, 2016 at 11:29 AM, Cl=C3=A9ment Pit--Claudel <clement.p= it@gmail.com> wrote:
In any case where fo= nt-lock-fontified is nil font-lock-fontify-buffer will properly refontify t= he whole buffer, but font-lock-flush and font-lock ensure will not do anyth= ing. I don't know what causes that variable to be nil in the first plac= e, though.

I am not = sure if this is related. But in order for hi-lock-file-patterns to work in = a text-mode buffer, I need to do the below because font-lock-fontified is n= il for text-mode (as technically there are no comments or keywords to highl= ight in that major mode).

=C2=A0 =C2=A0 ;; Enable `hi-= lock-mode' in `text-mode' too
=C2= =A0 =C2=A0 ;; The hi-lock fontification will not be visible (the `font-lock= -keywords'
=C2=A0 =C2=A0 ;; variable wi= ll not be updated unless `font-lock-fontified' is already `t'.
=C2=A0 =C2=A0 ;; This was derived by studying t= he definition of `hi-lock-font-lock-hook'
=C2=A0 =C2=A0 ;; function.
=C2=A0 =C2=A0= (defun modi/hi-lock-enable-in-text-mode ()
=C2=A0 =C2=A0 =C2=A0 (setq-local font-lock-fontified t))
=C2=A0 =C2=A0 (add-hook 'text-mode-hook #'modi/hi-= lock-enable-in-text-mode)

--
Kaushal Modi=
--001a11c2b0ead98b2d052c5e6ffe--