From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#20613: Font locking is poorly documented Date: Sun, 17 Nov 2019 07:20:43 +0100 Message-ID: <87o8xbf2h0.fsf@gnus.org> References: <555BBC3D.4060503@cs.ucla.edu> <555BDCC9.6000900@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="40086"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 20613@debbugs.gnu.org, Paul Eggert To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 17 07:21:14 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWDvu-000AIs-8d for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 07:21:14 +0100 Original-Received: from localhost ([::1]:52214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWDvs-0004bG-QA for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 01:21:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45008) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWDvj-0004Yc-AN for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 01:21:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWDvi-0003fW-73 for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 01:21:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59419) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWDvi-0003fR-28 for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 01:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWDvh-0005k2-Sg for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 01:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Nov 2019 06:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20613 X-GNU-PR-Package: emacs Original-Received: via spool by 20613-submit@debbugs.gnu.org id=B20613.157397165622051 (code B ref 20613); Sun, 17 Nov 2019 06:21:01 +0000 Original-Received: (at 20613) by debbugs.gnu.org; 17 Nov 2019 06:20:56 +0000 Original-Received: from localhost ([127.0.0.1]:40007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWDvc-0005jb-C1 for submit@debbugs.gnu.org; Sun, 17 Nov 2019 01:20:56 -0500 Original-Received: from quimby.gnus.org ([95.216.78.240]:42638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWDva-0005jM-C3 for 20613@debbugs.gnu.org; Sun, 17 Nov 2019 01:20:54 -0500 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iWDvQ-0003xd-OD; Sun, 17 Nov 2019 07:20:47 +0100 In-Reply-To: <555BDCC9.6000900@yandex.ru> (Dmitry Gutov's message of "Wed, 20 May 2015 04:00:57 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171754 Archived-At: Dmitry Gutov writes: >> (defun pretty-lambdas () >> (font-lock-add-keywords >> nil `(("(\\(lambda\\>\\)" >> (0 (progn (compose-region (match-beginning 1) (match-end 1) >> ,(make-char 'greek-iso8859-7 107)) >> nil)))))) >> >> but I can't find documentation explaining why a progn is needed, or why >> it must return niil, or why one must use compose-region, or why one must >> use it with a single rather than just having a character there. > > The return value is documented in the docstring of font-lock-keywords. > > This case is (MATCHER . HIGHLIGHT), where HIGHLIGHT is > MATCH-HIGHLIGHT. The expression is supposed to return the face to use, > but here it returns nil, because it doesn't apply a face. So it just changes the buffer and returns nil as the font to use? Then this doesn't seem like something that needs explaining in the font locking part of the manual, at least. I started futzing around with font locking recently (I've never looked at it before), and the manual seemed to explain things pretty well (although it didn't explain how to test stuff, which is why I added the `font-lock-debug-fontify' command). So is there anything else here that needs to be done, or can this bug report be closed? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no