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: Separating colour and positioning functioning Date: Tue, 9 Feb 2021 01:20:19 +0100 Message-ID: References: <878s7yp7fh.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="18859"; 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 Tue Feb 09 01:36:10 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 1l9H0k-0004ln-1Z for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 01:36:10 +0100 Original-Received: from localhost ([::1]:33726 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9H0j-000191-1C for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 08 Feb 2021 19:36:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9GlX-00013n-HH for help-gnu-emacs@gnu.org; Mon, 08 Feb 2021 19:20:31 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:49915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9GlS-00042n-48 for help-gnu-emacs@gnu.org; Mon, 08 Feb 2021 19:20:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612830019; bh=H/AFAR7EsdA+9ZHm2aV6PirOPUr9y3c+vV8vtyiLyA0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=WhuOgFz9gDZF7VSUs0HuwjD74rpKKTfVkql17US4NhKXooRJ7phi0jY1f5+oXqjXm ziwriiDTL8iMxkDXY/rrWOVFR6doQNp3fLBARS8mgxUIwCxwAzvxRuHJn38Th6PJih xhOgzxpBaQmVkok1zGGMxDXZ3ygKS+yYeVb2cNv4= 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); Tue, 9 Feb 2021 01:20:19 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <878s7yp7fh.fsf@zoho.eu> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:PB7ynYQpDdnLKqkVImcEuu7iD3PWbP4uihyUDCTqDaDZr1qQmFJkCLJtE291tDq4rg3wv KH3/G25bGiAyMwJ7C2A7gjhzhpdni50ANrZLmMQtjlU9Gv6OFd7GBBjmEbpplPqF6zMnj3QCPyBG IKx1JkIba4sPI5VZzMGrV6m58x9ox6KOTgzAxF92etPKk1G7f2rU/6vdvQU4tiHmDYW8CQ5CxrdT YYhyo2PDZCnfGQznkxQZLNiIc+AtI4vXJd6w3JteckgMBVMia0Li0ibSSAr+SHhn0wrHXc9Tytw4 Jc= X-UI-Out-Filterresults: notjunk:1;V03:K0:a+3TQiu/U10=:HQh4OBBJrhLRsTy+3yqwY7 5ou/ZCaaePClEc5ksBGOd2MKhhR5whJCHkFzi6Y+ckqNPY8haZuIOWmkpmD4ytTZyey+U0/3p HKyXNISxEc5mfdOCAV/xvHl2uVecLa4Q2qcfYfxv2ZXEH5fl4pSHzo26CdYVhIjNJdVd6g6Jw VUJP9wLgWJRa21D7mLl9AMnjJHLhO06rnC0egArzukxIVs60VzAEHiKklJsxPHPiJTLG2rUxb +aMKCHYQ4L5PgwCPwFXVqoOEERFulQjJ81aWthKnduFpjW78fBj7cOgdwpjSpbLdviE4eW3AK KCKMBor5qWCej9czbQnOu1y7u73e+x4KvoaSpxeZmk8eowFX2VxDSOsLlyRfF4Uvbm+rr6+3m dFdeddhy8Mof0oQ1xWv7uRSr3TW1qrsruxKKgG68MNZoe5MNYax3ROERgGYPL1th0wB3SHONR opV2RhPoOD9M5OVISTdLu54GYwQvpARurjkv4mpafJ9Y3ooqeTdtqT9//k+P7s4gt5ZbF+YX8 0xbjKSDqIt14wUWwNMu/HYqdwweUY9n1Ki/9l17o5v9kphklRMnNxvfCCzKFO0u5MCF/oz3nN NxlD6y131MkYI= 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:127671 Archived-At: > Sent: Tuesday, February 09, 2021 at 9:37 AM > From: "Emanuel Berg via Users list for the GNU Emacs text editor" > To: help-gnu-emacs@gnu=2Eorg > Subject: Re: Separating colour and positioning functioning > > Christopher Dimech wrote: >=20 > > Have written a minor mode with part of the the code below > > and want to modify tex-typeface-crucible so that the colour > > scheme is enabled when the minor-mode is on=2E >=20 > I got the following warnings from the byte compiler: >=20 > Warning: defface for =E2=80=98colour-tex-cruc=E2=80=99 fails to specif= y containing group > Warning: reference to free variable =E2=80=98crucible-supinf-enable=E2= =80=99 > Warning: reference to free variable =E2=80=98crucible-supinf-vshift=E2= =80=99 > Warning: reference to free variable =E2=80=98supinf-font-lock-cruc=E2= =80=99 >=20 > Style PO-lice: >=20 > > (defface colour-tex-cruc >=20 > US English is preferable, then it becomes consistent=2E The user > shouldn't have think, "is the programmer a 'bloke' or > a 'dude'?" =2E=2E=2E >=20 > > '( (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 tex keywords=2E") >=20 > Avoid hard-coding the same data (88 and "#FF0000") repeatedly=2E > Normally, the method is to use `let'=2E >=20 > > (defun supinf-disable-cruc (beg end) > > "Set typeface for text between BEG and END=2E" > > (font-lock-default-unfontify-region beg end) > > (while (< beg end) > > (let ((next (next-single-property-change beg 'display nil end)) > > (prop (get-text-property beg 'display))) > > (if (and (eq (car-safe prop) 'raise) >=20 > `if' -> `while' >=20 > > (member (car-safe (cdr prop)) crucible-supinf-vshift) > > (null (cddr prop))) > > (put-text-property beg next 'display nil)) > > (setq beg next)))) >=20 > This looks unorthodox but OK, I don't have a snappy answer > what to do instead=2E=2E=2E >=20 > > (defun tex-typeface-crucible () > > "Font-lock setup for mathematical symbols=2E" > > (font-lock-flush (point-min) (point-max)) >=20 > Is that the same as just (font-lock-flush) ? The code is using narrow-to-region for finding areas where superior and inferior typeface is enabled=2E (defun crucible-supinf-match (limit) "Match superior and inferior glyph patterns up to LIMIT=2E" (when (and crucible-mode (re-search-forward "[_^] *\\([^\n\\{}]\\|\ \\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t)) (when (match-end 3) (let ((beg (match-beginning 3)) (end (save-restriction (narrow-to-region (point-min) limit) (condition-case nil (scan-lists (point) 1 1) (error nil))))) ;; body of let (store-match-data (if end (list (match-beginning 0) end beg end) (list beg beg beg beg))))) t)) =20 > > (if crucible-supinf-enable > > (progn > > (font-lock-add-keywords nil crucible-tex-keywords t) > > (font-lock-add-keywords nil supinf-font-lock-cruc t)) > > (font-lock-remove-keywords nil crucible-tex-keywords) > > (supinf-disable-cruc (point-min) (point-max))) > > (font-lock-flush (point-min) (point-max))) >=20 > Is that the same as =2E=2E=2E same=2E >=20 > --=20 > underground experts united > http://user=2Eit=2Euu=2Ese/~embe8573 > https://dataswamp=2Eorg/~incal >=20 >=20 >