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: colour plain tex keywords
Date: Tue, 12 Jan 2021 09:42:29 +0100
Message-ID: <trinity-7c237bdd-150a-4cf9-90bb-15bb6b861506-1610440949058@3c-app-mailcom-bs06>
References: <trinity-5b1e3876-debc-430a-9165-0e709910b9c6-1610378910516@3c-app-mailcom-bs13>
 <87zh1faujt.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="21424"; 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 Jan 12 09:43:08 2021
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1kzFGd-0005P7-NE
	for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 09:43:07 +0100
Original-Received: from localhost ([::1]:52382 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1kzFGc-0006lP-O6
	for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 Jan 2021 03:43:06 -0500
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50938)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael-franzese@gmx.com>)
 id 1kzFG8-0006hE-5L
 for help-gnu-emacs@gnu.org; Tue, 12 Jan 2021 03:42:36 -0500
Original-Received: from mout-xforward.gmx.net ([82.165.159.42]:47575)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <michael-franzese@gmx.com>)
 id 1kzFG4-0003kC-AA
 for help-gnu-emacs@gnu.org; Tue, 12 Jan 2021 03:42:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1610440949;
 bh=X1vmtmMhNDCboCho71j6ioVwPjfYwAWOpxwzUEy3M7o=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References;
 b=FydNOOGF1pbJEvNorzQlKWQpGXrnh1rjMPmLipYYe516PFmXmTB86kdFg2oMGMe5o
 whmTl8sgyQo4qTr7pz+As4yOoQ9EOwgdZ5nFrqMHspq50s1zRc566e4riQBDQbg+XG
 nse/SeI73VciqRS5JTdaw5c7D5SnSJ+db68ySKiA=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Original-Received: from [185.244.212.219] ([185.244.212.219]) by web-mail.gmx.net
 (3c-app-mailcom-bs06.server.lan [172.19.170.174]) (via HTTP); Tue, 12 Jan
 2021 09:42:29 +0100
Importance: normal
Sensitivity: Normal
In-Reply-To: <87zh1faujt.fsf@zoho.eu>
X-UI-Message-Type: mail
X-Priority: 3
X-Provags-ID: V03:K1:HxNvHQ1TrumysOX+WwH2UVNYGQIDf99/we5pJd4IRCI7JXsFDGuVpeisGsKR1HK0lEgig
 ME5eIwgh0tDNYjiTyDrxj8ZXDfIELiv2TBQsF7K0f6IDJ+yEiXf8vmolfYGDj8DWNPU9dD/hsXr2
 MP180skQhYp6CirPFLyx6947aJTdp6EF/sRxnrtE7zyJZbh5OZtqfy7R0QdAL+cpzeurf6mQm/sp
 jevUj8wpKWt3SFXaNbEFYT/R4bVCapQtw8BIugR9NdKv3bmwK3MyLLVNlfHurk+iGlpGSomm/EkZ
 Sw=
X-UI-Out-Filterresults: junk:10;V03:K0:NySRYEaIaHs=:PMqQ+MWgxRVIg35/M89cMfDS
 Q6YfvvlryrEW4WHpZlQFwfzPrgzZPyXhL6Kk/0jeysCWLq4Pu6OFEv2ZpQMIofLjaLTPeF3We
 i5/hXylcOYj/lCQ+VeCFwsJMiI5Ce9IiGVCIUvTBC9aO/FGZ2KM9yu6fPNDa7bamAAJVh3fvo
 I9KXq8s7sLBGSIGPV/eR7CmQNlhfHw8ad8zBPnLbqvclneRU5cnP3lM/VfizdNAkgTL6/r5CD
 B4k1Ub9Hgv5bJAYzMFAkxlpBtGmN/0f6DOFFoq7pnAdNpb0f0tIZKoK26SiJoKtzzMPNFDN7S
 potmg3XRO8CrmzdrboYavqTTlVtktRc9WwCHKdHTCPlPEARGbV39yIFFlOmfbyS7JfbLnt7+5
 Q4NNMGnqk3M6/YAKCsToxCZIrLzW2D+YADMBKE818OBNaDhX2cyw6+t1WmKlkxKz1WXwEBiBQ
 CVqlm5HmyoNNacXzahSsbRdvjHycCh9pJpync4t6XRaew2lZGk/TNEOPtF5Z1DL+Cw/Cyx5aK
 Oa8UB/i8MYYbl0XY+NuqbQ9nQvGiTAm+iKE+r+jzveJ5jQSxsV8oU3XEb6cuAW+tJ47pwXc6N
 ozG0GWO5G8z7dgnTm148m+DIQYZuyMQUxioTKuz1LpvsAQ58x74zrg==
Received-SPF: pass client-ip=82.165.159.42;
 envelope-from=michael-franzese@gmx.com; helo=mout-xforward.gmx.net
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, FREEMAIL_FROM=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 <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "help-gnu-emacs"
 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
Xref: news.gmane.io gmane.emacs.help:127199
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/127199>

Have put the following code but it is not working for me.
What could be wrong?


(defun insert-ptex ()
  (interactive)
  (insert "ptex"))

(defvar ptex-mode-map
  (let ((map (make-keymap)))
    (define-key map (kbd "C-c t") 'insert-ptex)
    map)
  "Key map for use when variable `ptex-mode' is non-nil.")

(defvar ptex-mode-hook nil
  "Hook called when variable `ptex-mode' is non-nil.")

(define-minor-mode ptex-mode
  "Minor mode for colouring plain tex keywords."
  :init-value nil
  :global nil
  :lighter " ptex"
  :keymap ptex-mode-map
  (run-hooks 'ptex-mode-hook))

(add-hook 'texinfo-mode-hook 'ptex-mode)

(defface colour-greek-category
  '((default :inherit bold)
    (((class color) (min-colors 88) (background light))
     :foreground "#00FFFF")
    (((class color) (min-colors 88) (background dark))
     :foreground "#00FFFF")
    (t :inherit font-lock-builtin-face))
  "Face for greek category keywords.")

(defconst ptex-greek-keywords
  '(("\\\\\\<\\(alpha\\|beta\\|gamma\\)\\>"
     (1 'colour-greek-category)))
  "Rules to apply font-lock highlighting.")

(defun ptex-assign-font-greek-keywords ()
  "Font-lock setup for `ptex-greek-keywords'."
  (font-lock-flush (point-min) (point-max))
  (if ptex-mode
      (font-lock-add-keywords nil ptex-greek-keywords t)
    (font-lock-remove-keywords nil ptex-greek-keywords))
  (font-lock-flush (point-min) (point-max)))

 (add-hook 'texinfo-mode-hook #'ptex-assign-font-greek-keywords)

(provide 'ptex-mode)




> Sent: Tuesday, January 12, 2021 at 12:05 PM
> From: "Emanuel Berg via Users list for the GNU Emacs text editor" <help-=
gnu-emacs@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: colour plain tex keywords
>
> michael-franzese wrote:
>
> > How can I associate the actual keywords wtih the face, so
> > I can highlight the lower case greek letter commands in
> > plain tex.
>
> You can use `font-lock-add-keywords'. That doesn't always
> work tho, why I don't know.
>
> But here is an example where it works:
>
>   https://dataswamp.org/~incal/figures/emacs/dressed-up-as-themselves.pn=
g
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>