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 04:39:06 +0100 Message-ID: References: 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="19494"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: michael-franzese@gmx.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 14 04:39:33 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 1lB8Fx-0004yB-FX for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 14 Feb 2021 04:39:33 +0100 Original-Received: from localhost ([::1]:39038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lB8Fw-0000t0-IG for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 13 Feb 2021 22:39:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lB8Fa-0000sR-5t for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 22:39:10 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:48967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lB8FY-0001Ut-7w for help-gnu-emacs@gnu.org; Sat, 13 Feb 2021 22:39:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1613273946; bh=OVOYlAgE1NyWYg6Fbf3kzzTl+XaxLS5sn84Ph4m8Jk0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Ydtx8PdCFo7eWg46hpIbk5j3BVkloMYi3o/BNFRms7h6U13TGaa/pG+4J0v1H/bRy i8opNxH0Ed4JXdXUtXItKRY6nqY2tBRqHj2xdJcVe0GbSHn2uHibsQc925OTjojy34 1HbRGRm3xqEKWae7hKCOkIT/4JPB+SrLGFVcGDA8= 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 04:39:06 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:1Ewci+tlFwvreHAF1IKjX3VH6FpNeUJUZNY5UDnuWWnsDiI3XzaMo/peAX1pdy5t9mGqX 9rW0IpD511etscfH6ebZlUuirPZ/ChLZ+mlLxgLdJeDMgGReqlCaN3G/vnBb3W23LNcG/JUzLOmW IdDfUsEYoUMZckeKZwEAw+gnFXjh86whT828DALbR0dqCZ33PWRsaNb+R8FSORZCq0ACNDrC2iFr 5y0qW3fgRBQMtTd0f7wg5jpDCMao9TwCJQ6g7QK5jP1VoCb/oqbm6mDDrNarGc24Ade0tBDP8295 9c= X-UI-Out-Filterresults: notjunk:1;V03:K0:FXf3auAsyAU=:qaZtVrSPeM9ZTgOzetPFxC N5j1zA5mqWXG+oTTsG1L6ylovd7OuxWrTIoMzKfoAvG9gPH+x5l0Lu8WwlN155ufXjVYGQ+QN QZTHu7sN48Bp42glqCfwKz5C1Ly/Dc6wvDFY1xjMejyi1VkkKsBTDkqh+royYzpATNWj3bLGz lFuLn/qc3O999tmO+UHaOC9JaoaSf5fTD5iZZe4+nN2Qppnrc+Y7x1OQyQSMOCLcuagair2qu 5G6DSmjXq/OWochyJx1rl/ou1OLJ0AuA+R28y/X5Q5Qb+Sn/FyYSaA0AhTbggJvaO87kOfYez q56oGrpdaKFODxoMOc+StHw11KBS+i04gDYVxLLz4IhdMTNB3Jc+0nR8HLQGSCNe3k2FgMS7I I3bHXwi0qAl6vkLy8Vv6396WYbFMoLbyv1roZijzu8qD+QR9HXfLwTBghd3EjUfdIpVHYxeUP RmbJcPcM5f+PDIxysGZe8LDMTCVCLtWdVzlvhvAlo67Rg0csXCVtXcXzbl75vHpKxvfHrwRsz eU7R1fl2Slz69eDbX97bqzuksVrBmKNzz+pDRsSqScO0zGz8F3YB+iaIlgZS5CtwoZKdpf0kO 1aOTFqNpX183xNdd0sK64WL9hmKywPJgR8 Received-SPF: pass client-ip=212.227.15.18; 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:127994 Archived-At: Does anybody know how to use "font-lock-add-keywords" to highlight keywords? Have tried as follows. (defface texcmd-colour '( (default :inherit bold) ( ((class color) (min-colors 88) (background light)) :foreground "#FF0000" ) ( ((class color) (min-colors 88) (background dark)) :foreground "#FF0000" ) (t :inherit font-lock-builtin-face) ) "Typeface for sutting colour to tex commands.") (defvar-local stdhl 1 "Uses standard highlighting for keywords when set to 1. When stdhl is 0, the leading backslash is also highlighted.") (defconst comseq-list `( ;; Greek. (,(rx "\\" word-start (group (or "alpha" "beta" "chi" "delta" "Delta" "epsilon" "varepsilon" "eta" "gamma" "Gamma" "iota" "kappa" "lambda" "Lambda" "mu" "nu" "omega" "Omega" "phi" "varphi" "Phi" "pi" "varpi" "Pi" "psi" "Psi" "rho" "varrho" "sigma" "varsigma" "Sigma" "tau" "theta" "vartheta" "Theta" "upsilon" "Upsilon" "xi" "Xi" "zeta")) word-end) (stdhl 'colour-texcmd)) "Fontification for letters and symbols.") (font-lock-add-keywords nil comseq-list t) > Sent: Sunday, February 14, 2021 at 1:46 PM > From: michael-franzese@gmx.com > To: "Help Gnu Emacs" > Subject: Passing values through a variable > > I want to change the expression (1 'texcmd-colour) so that > the value 1 can be set through a variable (e.g. stdhl). > > Can I just do > > (defvar-local stdhl 1 > "Uses standard highlighting for keywords when set to 1. > When stdhl is 0, the leading backslash is also highlighted.") > > (defconst tex-keywords > `( > ;; Greek. Use (0 'texcmd-colour) to highlight the leading "\". > (,(rx "\\" word-start (group (or "alpha" "beta" "chi" "delta" > "Delta" "epsilon" "varepsilon" "eta" "gamma" "Gamma" "iota" > "kappa" "lambda" "Lambda" "mu" "nu" "omega" "Omega" "phi" > "varphi" "Phi" "pi" "varpi" "Pi" "psi" "Psi" "rho" "varrho" > "sigma" "varsigma" "Sigma" "tau" "theta" "vartheta" "Theta" > "upsilon" "Upsilon" "xi" "Xi" "zeta")) word-end) > (stdhl 'texcmd-colour)) > > (font-lock-add-keywords nil comseq-crucible t) > > > Below is the original code > > (defconst tex-keywords > `( > ;; Greek. Use (0 'colour-tex-cruc) to highlight the leading "\". > (,(rx "\\" word-start (group (or "alpha" "beta" "chi" "delta" > "Delta" "epsilon" "varepsilon" "eta" "gamma" "Gamma" "iota" > "kappa" "lambda" "Lambda" "mu" "nu" "omega" "Omega" "phi" > "varphi" "Phi" "pi" "varpi" "Pi" "psi" "Psi" "rho" "varrho" > "sigma" "varsigma" "Sigma" "tau" "theta" "vartheta" "Theta" > "upsilon" "Upsilon" "xi" "Xi" "zeta")) word-end) > (1 'texcmd-colour)) > > (font-lock-add-keywords nil tex-keywords t) > >