[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 16810288: Add new style/changebar.el
From: |
Arash Esbati |
Subject: |
master 16810288: Add new style/changebar.el |
Date: |
Thu, 4 Jan 2024 15:16:51 -0500 (EST) |
branch: master
commit 16810288d7209af2b8c8be6bd33f36f736c05fe0
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Add new style/changebar.el
* tex.el (TeX-LaTeX-sentinel): Add entry for the changebar
package.
* Makefile.in (STYLESRC): Add new style.
* style/changebar.el: New file.
---
Makefile.in | 5 ++-
style/changebar.el | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++
tex.el | 7 +++-
3 files changed, 122 insertions(+), 3 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 17f57868..bc2ea951 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,7 +2,7 @@
# Maintainer: auctex-devel@gnu.org
-# Copyright (C) 2003-2008, 2010, 2013-2015, 2018-2023 Free Software
+# Copyright (C) 2003-2008, 2010, 2013-2015, 2018-2024 Free Software
# Foundation, Inc.
# This file is part of AUCTeX.
@@ -197,7 +197,8 @@ STYLESRC = style/prosper.el \
style/proc.el style/microtype.el style/tcolorboxlib-theorems.el
\
style/amsaddr.el style/parskip.el style/catchfilebetweentags.el \
style/physics.el style/soul.el style/algpseudocodex.el \
- style/wasysym.el style/refcount.el style/simpleicons.el
+ style/wasysym.el style/refcount.el style/simpleicons.el \
+ style/changebar.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/changebar.el b/style/changebar.el
new file mode 100644
index 00000000..b3020bd7
--- /dev/null
+++ b/style/changebar.el
@@ -0,0 +1,113 @@
+;;; changebar.el --- AUCTeX style for `changebar.sty' (v3.7b) -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2024 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2023-12-30
+;; 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 `changebar.sty' (v3.7b) from 2023/12/30.
+;; `changebar.sty' is part of TeXLive.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords "font-latex" (keywords class))
+
+(TeX-add-style-hook
+ "changebar"
+ (lambda ()
+
+ ;; 2.2 Macros defined by the package
+ (TeX-add-symbols
+ '("cbstart"
+ [TeX-arg-length "Width"]
+ (lambda (_)
+ (indent-according-to-mode)
+ (LaTeX-newline)
+ (indent-according-to-mode)
+ (save-excursion
+ (LaTeX-newline)
+ (insert "\\cbend")
+ (indent-according-to-mode))))
+ '("cbend" 0)
+ '("cbdelete" [TeX-arg-length "Width"])
+ "nochangebars")
+
+ ;; Options management:
+ (when (LaTeX-provided-package-options-member "changebar" "color")
+ (TeX-run-style-hooks "color")
+ (TeX-add-symbols '("cbcolor" TeX-arg-color)))
+
+ (when (LaTeX-provided-package-options-member "changebar" "xcolor")
+ (TeX-run-style-hooks "xcolor")
+ (TeX-add-symbols '("cbcolor" TeX-arg-xcolor)))
+
+ (when (or (LaTeX-provided-package-options-member "changebar" "xetex")
+ (LaTeX-provided-package-options-member "changebar" "XeTeX"))
+ (TeX-check-engine-add-engines 'xetex))
+
+ (when (or (LaTeX-provided-package-options-member "changebar" "luatex")
+ (LaTeX-provided-package-options-member "changebar" "luaTeX"))
+ (TeX-check-engine-add-engines 'luatex))
+
+ (LaTeX-add-environments
+ '("changebar" LaTeX-env-args [TeX-arg-length "Width"]))
+
+ ;; Let the commands have their own lines:
+ (LaTeX-paragraph-commands-add-locally '("cbstart" "cbend"))
+
+ ;; Cater for indentation:
+ (add-to-list 'LaTeX-indent-begin-list "cbstart" t)
+ (add-to-list 'LaTeX-indent-end-list "cbend" t)
+ (LaTeX-indent-commands-regexp-make)
+
+ ;; 2.3 Changebar parameters
+ (LaTeX-add-lengths "changebarwidth" "deletebarwidth" "changebarsep")
+ (LaTeX-add-counters "changebargrey")
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("cbstart" "[")
+ ("cbdelete" "["))
+ 'function)
+ (font-latex-add-keywords '("cbend" "nochangebars")
+ 'function-noarg)
+ (when (or (member "xcolor" (TeX-style-list))
+ (member "color" TeX-active-styles))
+ (font-latex-add-keywords '(("cbcolor" "[{"))
+ 'type-declaration))))
+ TeX-dialect)
+
+(defvar LaTeX-changebar-package-options
+ '("dvitoln03" "dvitops" "dvips" "emtex" "textures"
+ "vtex" "pdftex" "xetex" "luatex"
+ "outerbars" "innerbars" "leftbars" "rightbars"
+ "traceon" "traceoff" "tracestacks"
+ "grey" "color" "xcolor")
+ "Package options for the changebar package.
+This variable contains only the lowercase version of the options.")
diff --git a/tex.el b/tex.el
index 357dbb58..afa02e5e 100644
--- a/tex.el
+++ b/tex.el
@@ -1,6 +1,6 @@
;;; tex.el --- Support for TeX documents. -*- lexical-binding: t; -*-
-;; Copyright (C) 1985-2023 Free Software Foundation, Inc.
+;; Copyright (C) 1985-2024 Free Software Foundation, Inc.
;; Maintainer: auctex-devel@gnu.org
;; Keywords: tex
@@ -8458,6 +8458,11 @@ Rerun to get mark in right position\\." nil t)
(message
"%s" "You should run LaTeX again to get TikZ marks in right
position")
(setq TeX-command-next TeX-command-default))
+ ((re-search-forward "^Package Changebar Warning: \
+Changebar info has changed." nil t)
+ (message
+ "%s" "You should run LaTeX again to get the change bars right")
+ (setq TeX-command-next TeX-command-default))
((re-search-forward "^\\* xsim warning: \"rerun\"" nil t)
(message
"%s" "You should run LaTeX again to synchronize exercise properties")
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 16810288: Add new style/changebar.el,
Arash Esbati <=