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

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

Re: Including tex commands in a list


From: Michael Heerdegen
Subject: Re: Including tex commands in a list
Date: Thu, 28 Jan 2021 15:24:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

steve-humphreys@gmx.com writes:

> (defconst crucible-mtksy-keywords
>   `(;; Greek
>     (,(concat "\\\\\\<\\(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\\)\\>")
>      (0 'crucible-mtksy-tfc)) ;
>
> It would help if I had an example of using "rx" for this.

That would look like this (you want to add the missing greek letter
names):

(defconst crucible-mtksy-keywords
  `(;; Greek
    (,(rx "\\" word-start
          (or "alpha" "beta") ;add the other letters here
          word-end)
     (0 'crucible-mtksy-tfc))))

The result will be a slightly optimized regexp (equivalent to yours of
course).

If you want to go that way, I think it would also be possible to avoid
the repetition of uncapitalized followed by a capitalized letter name.

HTH,

Michael.



reply via email to

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