help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: font-lock as a single command


From: Emanuel Berg
Subject: Re: font-lock as a single command
Date: Sat, 13 Feb 2021 06:43:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech wrote:

> There is something interesting to tell you. When I call "M-x
> supinf-enable" nothing happens, but when I start writing
> (e.g. "\alpha_{ij}"), as soon as I enter "_" the suscript
> functionality gets enabled for the whole buffer.
>
> Could you help on what is going on?

Here is how I would do it, for starters:

\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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]