From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.devel Subject: Re: command to fontify whole buffer? Date: Fri, 23 Sep 2011 10:25:55 +0530 Message-ID: <811uv7c0x0.fsf@gmail.com> References: <8BFD7E6B15F149EA96503B2768DFD6C5@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1316753777 15598 80.91.229.12 (23 Sep 2011 04:56:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Sep 2011 04:56:17 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 23 06:56:14 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R6xo4-0002Cm-TA for ged-emacs-devel@m.gmane.org; Fri, 23 Sep 2011 06:56:13 +0200 Original-Received: from localhost ([::1]:56002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6xo4-0002oZ-BF for ged-emacs-devel@m.gmane.org; Fri, 23 Sep 2011 00:56:12 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:42076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6xo1-0002oG-FZ for emacs-devel@gnu.org; Fri, 23 Sep 2011 00:56:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R6xo0-0007wo-D2 for emacs-devel@gnu.org; Fri, 23 Sep 2011 00:56:09 -0400 Original-Received: from mail-gx0-f169.google.com ([209.85.161.169]:59939) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R6xo0-0007wk-6H for emacs-devel@gnu.org; Fri, 23 Sep 2011 00:56:08 -0400 Original-Received: by gxk2 with SMTP id 2so2913913gxk.0 for ; Thu, 22 Sep 2011 21:56:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:mail-followup-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=r45Rl4twig/tAnRhGC80S5e7WKbuAaBXh+IespkWB5w=; b=rMaonvVTw+gwT8kGhJvZjqMNshU9h5DfIoRjQ+bcgF7cxJPUQ1WL0AW/dcXfM4k+l4 pdvTWty9er7io2lmzNJuExU5QPo4LDh8FcYzHrg7q1QXUQ877mr45rAJzwvSDlKa3Rc1 pv3npgpqWyu2HL4Ke8cyLfqBQWWyeN3kDNAfQ= Original-Received: by 10.68.9.7 with SMTP id v7mr7817266pba.94.1316753767053; Thu, 22 Sep 2011 21:56:07 -0700 (PDT) Original-Received: from JAMBU-NETBOOK ([115.241.44.179]) by mx.google.com with ESMTPS id 4sm34532363pbk.5.2011.09.22.21.56.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 22 Sep 2011 21:56:05 -0700 (PDT) Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: (Stefan Monnier's message of "Fri, 23 Sep 2011 00:23:00 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.169 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:144216 Archived-At: Stefan Monnier writes: >> Sometimes I want to fontify a whole buffer (really). One use case is >> to be able to then use the fontification for other (e.g. code) >> purposes than visual highlighting. But it really doesn't matter why - >> I just want to. ;-) > > Agreed. We need two functions: > - font-lock-flush-region (which marks the region for re-fontification). > - font-lock-ensure-region (which makes sure the region is fontified). > The functions we have were designed before lazy/jit lock and were > adjusted in ad-hoc ways when jit/lazy was added. > For font-lock-ensure-region, you should be able to find sample code for > an implementation in various packages such as ps-print.el and > replace.el. In htmlfontify.el (htmlfontify-buffer), hfy-force-fontification calls either font-lock-fontify-region (in interactive mode) or font-lock-fontify-buffer (in non-interactive mode). The latter funcion in turn calls font-lock-fontify-buffer-function which apparently points to jit-lock-refontify. I hope either the htmlfontify-buffer DTRT or it may fail to re-fontify under certain circumstances. > Stefan > > --