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

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

Passing values through a variable


From: michael-franzese
Subject: Passing values through a variable
Date: Sun, 14 Feb 2021 02:46:23 +0100

I want to change the expression (1 'texcmd-colour) so that
the value 1 can be set through a variable (e.g. stdhl).

Can I just do

(defvar-local stdhl 1
  "Uses standard highlighting for keywords when set to 1.
When stdhl is 0, the leading backslash is also highlighted.")

(defconst tex-keywords
  `(
    ;; Greek.  Use (0 'texcmd-colour) to highlight the leading "\".
    (,(rx "\\" word-start (group (or "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")) word-end)
     (stdhl 'texcmd-colour))

(font-lock-add-keywords nil comseq-crucible t)


Below is the original code

(defconst tex-keywords
  `(
    ;; Greek.  Use (0 'colour-tex-cruc) to highlight the leading "\".
    (,(rx "\\" word-start (group (or "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")) word-end)
     (1 'texcmd-colour))

(font-lock-add-keywords nil tex-keywords t)



reply via email to

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