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 06:51:53 +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="34175"; 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 06:52:22 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 1lAnqw-0008kx-Pe for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 06:52:22 +0100 Original-Received: from localhost ([::1]:57584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAnqv-0004I7-R5 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 00:52:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAnqZ-0004I0-6Z for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 00:51:59 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:39641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAnqX-0003iW-30 for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 00:51:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613195514; bh=uUT9ZA9jGGvnkNsJpfXtwf6WwSPhyT5fI/lmR5dI+Pg=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=KEASS71oeC/oZeiyWfHX4JK/GlEkTcC/IwTmF4ja/j3GBVKGqh0+t0DRqMCg3kagI vrBbRt4d4M+SbjZYLXqG5jtW6CmTObn3qJeksdWALPmtPdDRfff3+aMfHxGP2DL/yB 3tzA4famlWDI33ubHZS506jstKYl2dUrkaWN36qk= 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 06:51:53 +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:GEYwHLT7sWwGVEHoFq0XPFVr/9pEtR7/EL/lk8qgLETEX97mk880ChtdP6lB96heYkv76 oWy0MKcvZbCCxSkohsm2WUxaJuZ1pnJBvuBhV6oVvQeZVOPoHddvyFBz7OmTE6PvjJPlXb0Lnbch aUP19kwExAdqgtR+RcLy/WNp8aLiq8pKnut5hgRMqg2+zjOyd3VT4HzIse+NICW00umDQuLVF3W+ fFNwZzBqu40Jic/4dSXeIhBChBGLylMbVUxGyJyc75AdKvBSNc94I7UeZWJ2DBrQsvIb6KTkfLXZ sw= X-UI-Out-Filterresults: notjunk:1;V03:K0:f6B6JO0mVUI=:sqDtPdGeFvrqRh0uqxhKbu QgC7DbA9YGjYSFfx34PnB+v0nAymd25ZxHH3GIfhHCuazU/zphIWUsMqH1JEa5V2v3x02yuOq EJ9XpPNKn51r3M/RPKlm8Li4c2rLlB9WHTw8moO1l7STdFw7X9HZOz8OiHNl/LXpUnU8+3JIC RtDUkdUEs5GptYUpf1ArVbtrSe75wbMmyxuzMNSAgu8Qd9WtecSUG62PbHn0DQgpjsbltwGTG OieWqVxclmuFH7RavFU16P+55o1fFFxk+8y+C+YEC26dQTdX1Yuq/W1MCfIA7PEuSl/MJGaM6 ROuV8Gy0LfKNCzG7WxcnBT5BT3adQ4cjgWYJ15PoSbjhWFsb5Tj7TOBAXic/NhxNo2hAjMRyV bdK+KR+uASzMoSwz/halSS3FI2JB4q4rmmC83QjUOFd1UIosIS6QrHHABHbz7rNRczbz4JAEo GSU/WapkJeY1eGy8DNB65hVU3NeiDu9pgz6cCs+n9f6WQRIJss93dk6JwGYj4l+Rs8z1SsPZh qfMeiGFVtMl6EnAU7KnGiQtDlSG8rIaHBujTMgec10LgTnTCnTRR+7Bnjb6msL/oXilLYxwi2 Vybs9qrN0OXH8= Received-SPF: pass client-ip=212.227.15.19; 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_H3=0.001, RCVD_IN_MSPIKE_WL=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:127901 Archived-At: Have added "font-lock-fontify-region" and supinf gets activated as soon as I enter the key-sequence "H-t". (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-region (point-min) (point-max)) ) > 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 > > >