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: [elpa] master 19862ff: Use font-lock-fontify-region instead of jit-lock-fontify-now Date: Sun, 07 Feb 2016 22:09:46 -0500 Message-ID: References: <20160130182614.10459.39544@vcs.savannah.gnu.org> <874mdkltjk.fsf@iki.fi> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454901019 6796 80.91.229.3 (8 Feb 2016 03:10:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Feb 2016 03:10:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: Teemu Likonen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 08 04:10:10 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 1aScDJ-0000pk-SC for ged-emacs-devel@m.gmane.org; Mon, 08 Feb 2016 04:10:10 +0100 Original-Received: from localhost ([::1]:40628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aScDI-0005L4-KW for ged-emacs-devel@m.gmane.org; Sun, 07 Feb 2016 22:10:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aScD6-0005Kv-Ke for emacs-devel@gnu.org; Sun, 07 Feb 2016 22:09:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aScD1-00024f-Ks for emacs-devel@gnu.org; Sun, 07 Feb 2016 22:09:56 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:33757) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aScD1-00024R-H1 for emacs-devel@gnu.org; Sun, 07 Feb 2016 22:09:51 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AsEwA731xV/96XpUVcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIwULCw4mEhQYDSSINwiqBqUdAQEBBwEBAQEBHYs6hQUHhC0FjDCnD4FFI4I7gVsggngBAQE X-IPAS-Result: A0AsEwA731xV/96XpUVcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIwULCw4mEhQYDSSINwiqBqUdAQEBBwEBAQEBHYs6hQUHhC0FjDCnD4FFI4I7gVsggngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="192659425" Original-Received: from 69-165-151-222.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.165.151.222]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Feb 2016 22:09:48 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 278C9AE1A5; Sun, 7 Feb 2016 22:09:46 -0500 (EST) In-Reply-To: <874mdkltjk.fsf@iki.fi> (Teemu Likonen's message of "Sun, 07 Feb 2016 12:10:55 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:199481 Archived-At: >>> - (jit-lock-fontify-now (min beg end) (max beg end)))) >>> + (font-lock-fontify-region (min beg end) (max beg end)))) >> Maybe even better would be to use font-lock-ensure (when available)? > It's unclear to me what's the difference between font-lock-ensure and > font-lock-fontify-region. font-lock-fontify-region will use font-lock rules and apply them to the specified region, regardless of what happened before, and without keeping track of the fact that those rules were applied there. It's mostly an internal function in font-lock. font-lock-ensure simply asks Emacs to make sure that the specified region has had font-lock rules applied. It's a function specifically designed to be used by external packages. > It seems that font-lock-ensure is relatively new, introduced in 24.4, Indeed, it's brand new. > so maybe not quite yet depend on it on an ELPA package. (fboundp 'font-lock-ensure) will take care of that. > There are some "alias wrappers" like below in Emacs code so maybe I'll > use similar with wcheck-mode. > (eval-when-compile > (defalias 'wcheck--fontify-region > (if (fboundp 'font-lock-ensure) > 'font-lock-ensure > 'font-lock-fontify-region))) You can use that [ Tho, note that eval-when-compile is wrong here: this function will be needed at run-time, not at compile time. ] But if there's only a single cal to that function, you might as well inline it at its only call site. Stefan