emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex 83306b4 13/35: Add some expl3 support


From: Tassilo Horn
Subject: [elpa] externals/auctex 83306b4 13/35: Add some expl3 support
Date: Sun, 22 Mar 2015 09:27:00 +0000

branch: externals/auctex
commit 83306b4a02162fc2acb3b4db4b6fe0aa7cf5ccd1
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Add some expl3 support
    
    * style/expl3.el: New style for the wrapper package for
    experimental LaTeX 3.
    
    * Makefile.in (STYLESRC): Activate new style.
    
    * font-latex.el (font-latex-match-simple-command)
    (font-latex-match-command-with-arguments): Use \s_ and \sw regexp
    classes instead of hard-coding address@hidden as LaTeX macro chars.
---
 ChangeLog      |   11 +++++++++++
 Makefile.in    |    2 +-
 font-latex.el  |    6 ++++--
 style/expl3.el |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d3ba7df..7a6d03c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-02-24  Tassilo Horn  <address@hidden>
+
+       * style/expl3.el: New style for the wrapper package for
+       experimental LaTeX 3.
+
+       * Makefile.in (STYLESRC): Activate new style.
+
+       * font-latex.el (font-latex-match-simple-command)
+       (font-latex-match-command-with-arguments): Use \s_ and \sw regexp
+       classes instead of hard-coding address@hidden as LaTeX macro chars.
+
 2015-02-17  Tassilo Horn  <address@hidden>
 
        * latex.el (LaTeX-after-insert-env-hook): Rename from
diff --git a/Makefile.in b/Makefile.in
index 7a0851c..9320db2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -144,7 +144,7 @@ STYLESRC = style/prosper.el \
           style/fbb.el       style/newtxmath.el style/newtxsf.el \
           style/newtxtext.el style/newtxttt.el  style/minted.el \
           style/wrapfig.el   style/relsize.el   style/currvita.el \
-          style/tcolorbox.el style/color.el
+          style/tcolorbox.el style/color.el     style/expl3.el
 STYLEELC = $(STYLESRC:.el=.elc)
 
 ifeq (@preview_enabled@,yes)
diff --git a/font-latex.el b/font-latex.el
index 0a1b8ad..c2f6536 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -1494,7 +1494,8 @@ Returns nil if none of KEYWORDS is found."
                             (list (point)
                                   (progn
                                     (forward-char)
-                                    (if (zerop (skip-chars-forward "A-Za-z@"))
+                                    (if (zerop (skip-chars-forward
+                                                "\\\\\\(?:\\s_\\|\\sw\\)+"))
                                         (forward-char) ; Single-char macro.
                                       (skip-chars-forward "*"))
                                     (point))))
@@ -1634,7 +1635,8 @@ marks boundaries for searching for group ends."
 
 (defun font-latex-match-simple-command (limit)
   "Search for command like \\foo before LIMIT."
-  (TeX-re-search-forward-unescaped "address@hidden" limit t))
+  ;; \s_ matches chars with symbol syntax, \sw chars with word syntax
+  (TeX-re-search-forward-unescaped "\\\\\\(?:\\s_\\|\\sw\\)+" limit t))
 
 (defun font-latex-match-math-env (limit)
   "Match math pattern up to LIMIT.
diff --git a/style/expl3.el b/style/expl3.el
new file mode 100644
index 0000000..6293b87
--- /dev/null
+++ b/style/expl3.el
@@ -0,0 +1,51 @@
+;;; expl3.el --- AUCTeX style for `expl3.sty'
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Tassilo Horn <address@hidden>
+;; Maintainer: address@hidden
+;; Created: 2015-02-22
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `expl3.sty'.
+
+;;; Code:
+
+(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))
+
+(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))
+     ;; 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)



reply via email to

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