From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: font-lock as a single command Date: Sat, 13 Feb 2021 07:07:04 +0100 Message-ID: References: <87zh08buku.fsf@zoho.eu> <87blcobs66.fsf@zoho.eu> <8735y0bqs6.fsf@zoho.eu> <87y2fsa8x9.fsf@zoho.eu> <87r1lka67l.fsf@zoho.eu> <87mtw8a5er.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14522"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: moasenwood@zoho.eu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 13 07:07:30 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lAo5a-0003eo-Lp for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 07:07:30 +0100 Original-Received: from localhost ([::1]:59136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAo5Z-0005fk-MS for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 01:07:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45650) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAo5G-0005fe-9E for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 01:07:10 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:49043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAo5D-0004HY-6E for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 01:07:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613196424; bh=JLOD+0Bjh3qz7m/F+ixakPpxhkUCxlmiNRLV6Wt71Ds=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=YUXCZFXOc2S9petMSyIg2CytBfl0BjFS7BVV5A1n9X13MbEOeIejAqaBOOZsAKj5I P14qzo3AyitqPaMOHdgtU57Ly0CLSkgaIE9lXkimt5DK0Q9YF22Rxu0IBwhYy4huwO bWAOLfbSwvXmJmFbZBm7/DFzEtrr9RfjKU4yagQQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs05.server.lan [172.19.170.173]) (via HTTP); Sat, 13 Feb 2021 07:07:04 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <87mtw8a5er.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:cybtt7wK+nUtZ7toe1aoM36Tht3Uuq0sW5noNF8JXOBzQN5yGBPsl9wfweg4sNDW1/ejQ JJM8F3cLagkjHfBFDgaujMMeMUJlHI3VoJs3dCmqRh2Dt88cocsga/MvhWpYaLX53MiZ/pzxF7yZ 41HRtZk1BAMHg3j1qs1TBrBlUYO3u7Bwx9dEd+M3cIINCfdUp1TtZIJtlC9YfzWHRGfKgemeNqXm SkxqeQndZQVEVGgdCSXWaTsMMp/uQVUhFAM62SRGDuFZR+wpILTjaq5WqHbtYsEshDLnZczwRbxS E0= X-UI-Out-Filterresults: notjunk:1;V03:K0:ytltGu7Zue8=:bcV/AYaH1QQsDg+7bADL+n zkrRVI8gcPMPWfDpY2KnAKKn+7J8ythXLBJZPs22/V7/MCeZ5pMy+yEclx/F28Ftd3BjD/a8N CdkbN99Nq3fK3a/mXNjkEKGh/h8AsigTmu7clX2g2q5SAml6Chq6GCf4U79oAXtZXMToYHTa4 8RI6ZzfpeZQvTg1t31XSdKbA9lCj0dDOvrNGlin8xfmuy8ZKN3kxYlOjcSe+hNA9XLpzImCM+ EwXAfM6Ly1awpqzmtPv/jdy2IkSlZ2zBodFnxsXwUA4Xa0OngWmz+Hvyvy3mI7ob//e2Oj4Gp GDfjLi+J72UGiKc9wgw2vwCY6nWF+bDEZLyqYM45V6RtUpnWpFtzasu6lNGpKqmd3fnHLzrJO 3y6BV8NGB5pTWqjJJlf2cCAxEeDxHL+oZANvs+r6ZBJoWcqsw96Zs29oe+868VFamUAGoJDaO Xq8C7p3idbQ5KGqJnGTEkToPmX6WLKB/q2J/6ITAUcMQ1oYMfVnitYlG7k1vu2Jp8DpHBIHDb KLEKhRJUe1SH6C8Hpu8UeyIwlrGB4i9tC5Co4S5Lbc38Bryodn6KfgLOxD6mFqsC1rgWsuA6I jYrAZU1ctjYOU= Received-SPF: pass client-ip=212.227.15.15; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127902 Archived-At: I am quite confident that I can use "(font-lock-fontify-buffer)". Do you agree? (defun supinf-enable () "Enables a typeface for displaying tex commands." (interactive) (setq-local supinf-signal t) ;; Syntax for font-lock-add-keywords is ;; (font-lock-add-keywords MODE KEYWORDS &optional HOW) (font-lock-add-keywords nil '( (supinf-match (1 (supinf-raise-cruc (match-beginning 0)))) ) t) (font-lock-fontify-buffer) ) > Sent: Saturday, February 13, 2021 at 5:43 PM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu.org > Subject: Re: font-lock as a single command > > Christopher Dimech wrote: > > > There is something interesting to tell you. When I call "M-x > > supinf-enable" nothing happens, but when I start writing > > (e.g. "\alpha_{ij}"), as soon as I enter "_" the suscript > > functionality gets enabled for the whole buffer. > > > > Could you help on what is going on? > > Here is how I would do it, for starters: > > \alpha^{high} > \beta_{low} > > (progn > (font-lock-add-keywords > 'emacs-lisp-mode > '( > ("\\^{\\([[:alnum:]]*\\)}" 1 font-lock-builtin-face) > ("_{\\([[:alnum:]]*\\)}" 1 font-lock-function-name-face) > ) > t) > (text-mode) > (emacs-lisp-mode) ) > ;; ^ eval > > You can see the result in this screenshot: > > https://dataswamp.org/~incal/figures/emacs/high-low.png > > -- > underground experts united > http://user.it.uu.se/~embe8573 > https://dataswamp.org/~incal > > >