From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Defer jit-lock on a per-buffer basis Date: Thu, 15 Nov 2012 10:29:56 +0100 Message-ID: <87r4nvmcx7.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1352971829 12047 80.91.229.3 (15 Nov 2012 09:30:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Nov 2012 09:30:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 15 10:30:39 2012 Return-path: Envelope-to: geh-help-gnu-emacs@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 1TYvmK-0001DE-BL for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Nov 2012 10:30:32 +0100 Original-Received: from localhost ([::1]:47083 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYvmA-0001Dc-GI for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Nov 2012 04:30:22 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50231) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYvm2-0001DN-Ky for help-gnu-emacs@gnu.org; Thu, 15 Nov 2012 04:30:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TYvlz-0007Pf-GM for help-gnu-emacs@gnu.org; Thu, 15 Nov 2012 04:30:14 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:56888) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYvlz-0007PX-9O for help-gnu-emacs@gnu.org; Thu, 15 Nov 2012 04:30:11 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TYvm7-0000zN-1H for help-gnu-emacs@gnu.org; Thu, 15 Nov 2012 10:30:19 +0100 Original-Received: from tsdh.uni-koblenz.de ([141.26.67.142]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 Nov 2012 10:30:19 +0100 Original-Received: from tsdh by tsdh.uni-koblenz.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 15 Nov 2012 10:30:19 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: tsdh.uni-koblenz.de User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:UXduF43muDdWxJ0P2iLuGTIli7I= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87702 Archived-At: Hi all, recently this blog post http://tsengf.blogspot.de/2012/11/slow-scrolling-speed-in-emacs.html suggested to set `jit-lock-defer-time' to some small fraction to defer jit-lock fontification a bit. This has an enormous effect for example when scrolling in large c-mode buffers. However, most of the time I work with buffers that are rather small and instant fontification is fast enough. There, deferring font-lock is somewhat distracting. So is there a way to enable deferred jit-lock on a per-buffer basis? I tried this: (defun th-jit-lock-defer-fontification () (interactive) (set (make-local-variable 'jit-lock-defer-time) 0.1) (font-lock-mode -1) (font-lock-mode 1)) In fact, when I execute that command, the variable is buffer-local, and jit-lock is deferred as it should. But it is actually deferred in *all* buffers! Even disabling and re-enabling font-lock-mode in a buffer that doesn't have a buffer-local value of `jit-lock-defer-time' doesn't make fontification instant again... Any ideas? Bye, Tassilo