auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Support for expl3


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] Support for expl3
Date: Mon, 23 Feb 2015 09:38:47 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Sean Allred <address@hidden> writes:

Hi Sean,

> Forgive me if this is the wrong place to bring this up — this is my
> first time posting to this list.

No, this is the right place. :-)

> I searched the list through gmane, but it would seem that expl3 hasn’t
> even been mentioned. Is there any planned support for expl3 syntax?

No, not really as it seems nobody from us is using it.

> - The syntax table would need a modification to include `:` and `_` as
>   part of a csname/symbol
>
> - There should be some fontification for csnames that match expl3 patterns (as
> described in `texdoc expl3`§3`The naming scheme`). I’ve provided examples 
> below
> just as examples of how the symbols could be broken down. For KEY-VALUE, I’m
> not sure how it can be made context-sensitive to within `keys_define:nn`, but
> there it is if it’s possible.
>   - KEY-VALUE :: https://regex101.com/r/aO0tC8/1 ::
> /\s*([a-z\-]+)\s+(\.[a-z_]+):([nNpTFwcVvxof]*)\s+=/g
>   - VARIABLES :: https://regex101.com/r/jW6hN7/1 :: 
> /(\\[cgl]__?)([a-z][a-z_]+)(_[A-Za-z]+)/g
>   - FUNCTION :: https://regex101.com/r/sL8tY9/1 ::
> /(\\(?:__)?[a-z]+_)([a-z_]+)(:[nNpTFwcVvxof]*)/g
>
> I know that this would make expl3 development easier for me, and I’m sure
> others would appreciate the ability. expl3 syntax is currently (or at least
> will be?) an official part of LaTeX: AUCTeX should have some support for it.

Could you please test this expl3.el style file and check if it DTRT?

--8<---------------cut here---------------start------------->8---
(defvar LaTeX-expl3-syntax-table
  (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
    ;; Make _ and : symbol chars
    (modify-syntax-entry ?\_ "_" st)
    (modify-syntax-entry ?\: "_" st)
    st))

(defun LaTeX-expl3-font-latex-match-simple-command (limit)
  "Search for command like \\foo before LIMIT."
  (TeX-re-search-forward-unescaped "\\\\\\(?:\\s_\\|\\sw\\)+" limit t))

(TeX-add-style-hook
 "expl3"
 (lambda ()
   (set-syntax-table LaTeX-expl3-syntax-table)
   (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
     (fset 'font-latex-match-simple-command
           #'LaTeX-expl3-font-latex-match-simple-command)
     ;; For syntactic fontification, e.g. verbatim constructs.
     (font-latex-set-syntactic-keywords)
     ;; Tell font-lock about the update.
     (setq font-lock-set-defaults nil)
     (font-lock-set-defaults)))
 LaTeX-dialect)
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo




reply via email to

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