From debbugs-submit-bounces@debbugs.gnu.org Tue May 19 18:42:23 2015 Received: (at submit) by debbugs.gnu.org; 19 May 2015 22:42:24 +0000 Received: from localhost ([127.0.0.1]:50427 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YuqDP-0006k2-3u for submit@debbugs.gnu.org; Tue, 19 May 2015 18:42:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36500) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YuqDM-0006jm-K7 for submit@debbugs.gnu.org; Tue, 19 May 2015 18:42:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuqDG-0006vj-DR for submit@debbugs.gnu.org; Tue, 19 May 2015 18:42:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:35078) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuqDG-0006vQ-9y for submit@debbugs.gnu.org; Tue, 19 May 2015 18:42:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuqDF-0007JP-7E for bug-gnu-emacs@gnu.org; Tue, 19 May 2015 18:42:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YuqDC-0006mj-2Q for bug-gnu-emacs@gnu.org; Tue, 19 May 2015 18:42:13 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:54938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YuqDB-0006lI-Tc for bug-gnu-emacs@gnu.org; Tue, 19 May 2015 18:42:10 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 1EDE6A6000C for ; Tue, 19 May 2015 15:42:07 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hvpqpZfRFWsZ for ; Tue, 19 May 2015 15:42:05 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 9DF6FA60008 for ; Tue, 19 May 2015 15:42:05 -0700 (PDT) Message-ID: <555BBC3D.4060503@cs.ucla.edu> Date: Tue, 19 May 2015 15:42:05 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Emacs bug reports Subject: Font locking is poorly documented Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) I was recently urged to use font locking to support a feature in Emacs,=20 and I must say that I am still confused about how it works even after=20 reading the Elisp manual several times. The manual has a lot of=20 low-level discussion of mechanism, but it doesn't explain policy and=20 since crucial features seem to be undocumented, I'm at a loss as to how=20 to use it, or how to debug it when it's not working. I finally gave up=20 and used Google and found cookbook stuff, but I have no idea how or why=20 it works as well as it does, or why it fails when it does. For example: http://www.emacswiki.org/emacs/PrettyLambda gives this example: (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=20 it must return niil, or why one must use compose-region, or why one must=20 use it with a single =CE=BB rather than just having a =CE=BB character th= ere. One small suggestion: add a section explaining how the above example work= s. From debbugs-submit-bounces@debbugs.gnu.org Tue May 19 21:01:09 2015 Received: (at 20613) by debbugs.gnu.org; 20 May 2015 01:01:09 +0000 Received: from localhost ([127.0.0.1]:50460 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YusNg-0001pO-G9 for submit@debbugs.gnu.org; Tue, 19 May 2015 21:01:09 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:35176) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YusNd-0001of-08 for 20613@debbugs.gnu.org; Tue, 19 May 2015 21:01:05 -0400 Received: by wicmx19 with SMTP id mx19so136954379wic.0 for <20613@debbugs.gnu.org>; Tue, 19 May 2015 18:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=sABQPbt8JKqTo65oILXFFOlShCStsNtzktCchxwd1Y8=; b=pytxwBNOXhaXYzPTcejul7LP75WjOqERN6fSP6a0rpa2ck5vZWauZgMDKhr/1A7v+z nPg5LM4I3ZYTidtmWOydS25tGIzviOvtxCcrEl2gK9Jpb8k45LF3DChJ+668EyqQzFLp hrPvdc5JtWyPGAZEoiYwUqaDMqT3hI5PzNax1mhBrT9t9MZuhafb7iPrlG0JlwWUdXNQ XRQVAQGQHlERTPBhm65NqnET+DAfkFJ1CNPsEbhZMsB5v6+uIigVgAkszG8xVPEWqXSb OXECTnyL7Y84rAAVQcD8sNR90Y9tIWYK+ZQwndyT98AzQZArtgZ9dows0HYJnGMXciVG BGPA== X-Received: by 10.194.216.196 with SMTP id os4mr60521665wjc.117.1432083659228; Tue, 19 May 2015 18:00:59 -0700 (PDT) Received: from [192.168.1.2] ([82.102.93.54]) by mx.google.com with ESMTPSA id ex5sm817697wib.2.2015.05.19.18.00.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 May 2015 18:00:58 -0700 (PDT) Subject: Re: bug#20613: Font locking is poorly documented To: Paul Eggert , 20613@debbugs.gnu.org References: <555BBC3D.4060503@cs.ucla.edu> From: Dmitry Gutov Message-ID: <555BDCC9.6000900@yandex.ru> Date: Wed, 20 May 2015 04:00:57 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0 MIME-Version: 1.0 In-Reply-To: <555BBC3D.4060503@cs.ucla.edu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 20613 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 05/20/2015 01:42 AM, Paul Eggert wrote: > (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. Unfortunately, using compose-region in it is pretty much undocumented behavior. But since we can anticipate in which context the expression is evaluated, it's still relatively safe WRT future changes in font-lock code. From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 17 01:20:56 2019 Received: (at 20613) by debbugs.gnu.org; 17 Nov 2019 06:20:56 +0000 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 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 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 From: Lars Ingebrigtsen To: Dmitry Gutov Subject: Re: bug#20613: Font locking is poorly documented References: <555BBC3D.4060503@cs.ucla.edu> <555BDCC9.6000900@yandex.ru> Date: Sun, 17 Nov 2019 07:20:43 +0100 In-Reply-To: <555BDCC9.6000900@yandex.ru> (Dmitry Gutov's message of "Wed, 20 May 2015 04:00:57 +0300") Message-ID: <87o8xbf2h0.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: 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)))))) >> [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: yandex.ru] -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20613 Cc: 20613@debbugs.gnu.org, Paul Eggert X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 16 00:13:32 2020 Received: (at 20613-done) by debbugs.gnu.org; 16 Apr 2020 04:13:32 +0000 Received: from localhost ([127.0.0.1]:37350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jOvu8-0002RC-8C for submit@debbugs.gnu.org; Thu, 16 Apr 2020 00:13:32 -0400 Received: from ted.gofardesign.uk ([67.225.143.91]:49854) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jOvu6-0002Qy-7I for 20613-done@debbugs.gnu.org; Thu, 16 Apr 2020 00:13:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=fJ4Ryvo8hVkMZBfMyyYYOA/7fnxNPdj2gsG7kPJt1RI=; b=ns0rxGXzlqxwB7Xsjo236IvgQU jjcYGGatmIXdanA2lLvH+vpRNBTDJUGx/HE23CYDglx5rQRqMQ3390FzA/ccQSGrc/vfiNo1FdURN mUsBFzGHNfm6vG6rOa9I5VF7FHJPbZHV/KpJIgDPwj020VHRU5hALrjEIMutL2Ep2qjAVwMrpldCQ 1wykm4a4KeRVXj/OC1mfWXVW0qZM3XMVjqVD9su4Yfoy9hgetP7xueEWjI6H8zZbeJuNO53Xkq5+J GHOvR4kO6saqVQwjX57+RE/ymNBz06ORRQ9yi7P/CVMMk8wNOD5xNu2j4hGEtp9fSJ7zyWRbFxT1W Q1CQHu+w==; Received: from h-4-70-69.a785.priv.bahnhof.se ([155.4.70.69]:44136 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jOvu0-0000sA-7e; Thu, 16 Apr 2020 00:13:24 -0400 From: Stefan Kangas To: Lars Ingebrigtsen Subject: Re: bug#20613: Font locking is poorly documented In-Reply-To: <87o8xbf2h0.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 17 Nov 2019 07:20:43 +0100") References: <555BBC3D.4060503@cs.ucla.edu> <555BDCC9.6000900@yandex.ru> <87o8xbf2h0.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Date: Thu, 16 Apr 2020 06:13:22 +0200 Message-ID: <87h7xkukyl.fsf@stefankangas.se> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 20613-done Cc: Paul Eggert , 20613-done@debbugs.gnu.org, Dmitry Gutov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > 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? Since there have been no more comments within 21 weeks, I'm going to assume that the answer is yes. I'm consequently closing this bug now. If my assumption is incorrect and this is still an issue, please reopen the bug report. Best regards, Stefan Kangas From unknown Tue Sep 09 00:44:21 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 14 May 2020 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator