[Top][All Lists]

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

Markup highlighting

From: fatiparty
Subject: Markup highlighting
Date: Sun, 9 Jan 2022 15:52:02 +0100 (CET)

I intend to highlight some markup  in colour using the following definitions.
The colour is not being being enabled yet.  What can one do to enable it.

(defface texcom-colour
  '( (default :inherit bold)
     ( ((class color) (background light)) :foreground "#00FF00" )
     ( ((class color) (background dark))  :foreground "#00FF00" )
     (t :inherit font-lock-builtin-face) )
  "User defined colour typeface for tex command keywords.")

(defface texcom-typeface
  '((t :inherit font-lock-keyword-face))
   "Colour typeface for tex command keywords.")

(defconst texcom-cluster
    (,(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"))
     (1 'texcom-typeface))
"Typeface fontification for tex keywords.")

(defun texcom-typeface-enable ()
  "Sets the highlight colour for tex commands."
  (font-lock-add-keywords nil texcom-cluster t)

(defun texcom-typeface-disable ()
  "Clears the highlight colour for tex commands."
  (font-lock-remove-keywords nil texcom-cluster)

(define-minor-mode daph-minor-mode
  "Minor mode for assisting with superior & inferior typeface."
  :init-value nil
  :lighter " Daph"  ; used in modeline when mode is enabled

  ;; Disable commands first to avoids multiple copies of lists when
  ;; calling `(daph-minor-mode 1)' several times.
  (when daph-minor-mode  ! variable self-made by define-minor-mode
     (texcom-typeface-enable)) )

reply via email to

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