From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: michael-franzese@gmx.com Newsgroups: gmane.emacs.help Subject: Re: Passing values through a variable Date: Sun, 14 Feb 2021 05:14:12 +0100 Message-ID: References: <871rdj714w.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="40684"; 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 Sun Feb 14 05:14:46 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 1lB8o1-000APw-QE for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 14 Feb 2021 05:14:45 +0100 Original-Received: from localhost ([::1]:46902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lB8o0-0006Il-QI for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 23:14:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lB8nc-0006HC-BM for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 23:14:20 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:40067) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lB8nX-0002Sf-IH for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 23:14:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613276052; bh=bb+GdMwfaYGg8FMO7QBZbn/wo5FmAe0sq/SHeA1FYt0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=KQDqGR0nDQCux67FPAYSgUbYOT+ZYmO58+8aLlnfnKOjKaw6Zk7iliwcMC5fttGgI zTY4d3mCzy98OvQZIuPXVPqIPrD23GMv6nVFV2tRVzeKMNU2KCKH0AtyolmkwhqcBP EWFIERJg5GyEhwr1i8MPoLDQ+tIqmxdpnzW/8fAU= 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-bs12.server.lan [172.19.170.180]) (via HTTP); Sun, 14 Feb 2021 05:14:12 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <871rdj714w.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:md9zjZQ6y7TRX85gk+VqzB5nb7FkzL8WLgZJiI6WXWIXCwn48BzK56CawLXC/FHHtt9pc fC2E9v9KMz+J8/jhxSj6BeAh80ikHHOa6S4M30wCmG3mEOes31StUE+7OgAicrjquer8kYTnNmMP Mc5zab85Ji79MhuHzzVvFJLWUWaT0+u3BlUQjo25S5uMWIQMTbggK0N6fbEuU3mOOUddEFdu1Mdg au8y7bQ2ociMVy1lrnVRZa5AK89R5mQPkREQ9ecLerk/8O7DlUDaasu6+bFxKWkUfMBjpUNB3n0Q eU= X-UI-Out-Filterresults: notjunk:1;V03:K0:pyAXluuN6mM=:Qe5OZ3swetDIMOPZ+t1IEW eBpqWrDmAR8maqpfynIDmcsqU0d+2LrcGqZard1EYkF3rSdjqYV5WHG2uslRI2wtWMUjNRdyV 08muRhcm5FmAKrZggGHkJHacb/X6A8A3lc+3HiMs4QMbrPsa1vTZp0FLAjJ8f7IiSiufgovGO kfZU8+4pj5fXHCGnCK3GdDx6TTiycFuMyMGX8qKKJOwZeKndsjn5JLBaKvTX+uKDvlQl5YpzR sxIJcrOd4v3+C9e4ZpgkY3RvO85JVgQcWzXCHKPJ9sq5Edgya0s97TKup8qD+v1SoApxSN8mz A7nX3kmjv/YB7tVtYQD5KYV+NIKyg87Ss4LwY5HZcWtw9a9jVxSQgILmVwP8D608k70KOojv4 Ak1qo37n/99uxn7bHyfxREqikIv6TrgDj7HSguVICNy09mAn0NznVoFDWqtKTdDOqeghnTk43 Dt5R1FQ1256J/EhwZwoWUuKjqx+2g+Xym1uWWfhYBJ1k2W3D+en8EQaqTJnqFG8FUkO3Um+Ei AYQqcYXn53v7vYWJEfDW68neH+kKS5K9ibTRv/szeMGP48J/3kvOGEpZwYYKtKfoU0Jon6Ogv /q/qAFo72wKRXvC7aTlMWws86P161YK/jy Received-SPF: pass client-ip=212.227.15.15; envelope-from=michael-franzese@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:127996 Archived-At: You have used ("_{\\([[:alnum:]]*\\)}" 1 font-lock-function-name-face) How can I pass the "1" using a variable, rather than hardwiring it? > Sent: Sunday, February 14, 2021 at 3:56 PM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu.org > Subject: Re: Passing values through a variable > > michael-franzese wrote: > > > Does anybody know how to use "font-lock-add-keywords" to > > highlight keywords? > > Oh, no, not again :) > > But wait... if it happens again and again, _I_ don't have to > do it again! > > "if anything can start anew, then everything must continue" > > So yes, here is an example: > > Note: The keywords don't have to be expressions BTW. They can > be single words. Then, instead of the index (1 in the example) > just add a dot, i.e. (word . face) > > \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 > > >