all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Highlighting New Keywords in texinfo-mode
@ 2020-10-02 20:57 Christopher Dimech
  2020-10-03 20:33 ` Ivan Sokolov
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Dimech @ 2020-10-02 20:57 UTC (permalink / raw)
  To: Help Gnu Emacs

I want to highlight new keywords such as \quad \over \ cos

Using the following command seems to work, however still some are not properly highlighted

 ( font-lock-add-keywords 'texinfo-mode
     '( ("\\quad" . font-lock-keyword-face)
        ("\\over" . font-lock-keyword-face)
        ("\\theta" . font-lock-keyword-face)
        ("\\omega" . font-lock-keyword-face)
        ("\\cos" . font-lock-keyword-face)
   )
 )






^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re:Highlighting New Keywords in texinfo-mode
  2020-10-02 20:57 Highlighting New Keywords in texinfo-mode Christopher Dimech
@ 2020-10-03 20:33 ` Ivan Sokolov
  2020-10-03 20:42   ` Highlighting " Christopher Dimech
  0 siblings, 1 reply; 5+ messages in thread
From: Ivan Sokolov @ 2020-10-03 20:33 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs

In this case cars are regular expressions, so you must use four slashes to match one in the buffer. Two levels of escaping -- for strings and regexps.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Highlighting New Keywords in texinfo-mode
  2020-10-03 20:33 ` Ivan Sokolov
@ 2020-10-03 20:42   ` Christopher Dimech
  2020-10-03 20:49     ` Ivan Sokolov
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Dimech @ 2020-10-03 20:42 UTC (permalink / raw)
  To: Ivan Sokolov; +Cc: Help Gnu Emacs

As in the following Ivan?



( font-lock-add-keywords 'texinfo-mode
    '( ("\\\\quad" . font-lock-keyword-face)
       ("\\\\rm" . font-lock-keyword-face)
       ("\\\\overline" . font-lock-keyword-face)
       ("\\\\underline" . font-lock-keyword-face)
       ("\\\\over" . font-lock-keyword-face)
       ("\\\\circ" . font-lock-keyword-face)
       ("\\\\pi" . font-lock-keyword-face)
       ("\\\\cos" . font-lock-keyword-face)
       ("\\\\mu" . font-lock-keyword-face)
       ("\\\\theta" . font-lock-keyword-face)
       ("\\\\omega" . font-lock-keyword-face)
       ("\\\\lambda" . font-lock-keyword-face)
       ("\\\\psi" . font-lock-keyword-face)
     )
)


> Sent: Saturday, October 03, 2020 at 9:33 PM
> From: "Ivan Sokolov" <ivan-p-sokolov@ya.ru>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re:Highlighting New Keywords in texinfo-mode
>
> In this case cars are regular expressions, so you must use four slashes to match one in the buffer. Two levels of escaping -- for strings and regexps.
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Highlighting New Keywords in texinfo-mode
  2020-10-03 20:42   ` Highlighting " Christopher Dimech
@ 2020-10-03 20:49     ` Ivan Sokolov
  2020-10-03 21:09       ` Christopher Dimech
  0 siblings, 1 reply; 5+ messages in thread
From: Ivan Sokolov @ 2020-10-03 20:49 UTC (permalink / raw)
  To: Christopher Dimech; +Cc: Help Gnu Emacs

Yes, you can also add an end-of-word marker: \\\\quad\\>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Highlighting New Keywords in texinfo-mode
  2020-10-03 20:49     ` Ivan Sokolov
@ 2020-10-03 21:09       ` Christopher Dimech
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Dimech @ 2020-10-03 21:09 UTC (permalink / raw)
  To: Ivan Sokolov; +Cc: Help Gnu Emacs

Have also seen the following

("\\<and\\|or\\>" . font-lock-keyword-face)

Have also seen brackets

("\\<\\(and\\|or\\)\\>" . font-lock-keyword-face)

What are the following about, and why are they needed?

\\<   \\>  \\(   \\)


> Sent: Saturday, October 03, 2020 at 9:49 PM
> From: "Ivan Sokolov" <ivan-p-sokolov@ya.ru>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: Re: Highlighting New Keywords in texinfo-mode
>
> Yes, you can also add an end-of-word marker: \\\\quad\\>
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-03 21:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-02 20:57 Highlighting New Keywords in texinfo-mode Christopher Dimech
2020-10-03 20:33 ` Ivan Sokolov
2020-10-03 20:42   ` Highlighting " Christopher Dimech
2020-10-03 20:49     ` Ivan Sokolov
2020-10-03 21:09       ` Christopher Dimech

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.