[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 10dbae9ab1 08/23: Add support for catchfilebetwe
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 10dbae9ab1 08/23: Add support for catchfilebetweentags package |
Date: |
Thu, 20 Oct 2022 14:53:19 -0400 (EDT) |
branch: externals/auctex
commit 10dbae9ab1725eeb0452b5c4a36d5a25bb121040
Author: Uwe Brauer <oub@mat.ucm.es>
Commit: Arash Esbati <arash@gnu.org>
Add support for catchfilebetweentags package
* Makefile.in (STYLESRC): Add new style.
* tex-style.el (LaTeX-catchfilebetweentags-use-numeric-label):
Add a new variable that controls whether a numeric label gets
inserted automatically. Default is t.
* style/catchfilebetweentags.el: New file.
---
Makefile.in | 3 +-
style/catchfilebetweentags.el | 116 ++++++++++++++++++++++++++++++++++++++++++
tex-style.el | 7 +++
3 files changed, 125 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 97ddae21cc..ffa39b2531 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -194,7 +194,8 @@ STYLESRC = style/prosper.el \
style/ifpdf.el style/iftex.el style/ifvtex.el \
style/ifxetex.el style/multibib.el style/ltcaption.el \
style/keyval.el style/kvoptions.el style/kvsetkeys.el \
- style/proc.el style/microtype.el style/tcolorboxlib-theorems.el
+ style/proc.el style/microtype.el style/tcolorboxlib-theorems.el
\
+ style/catchfilebetweentags.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/catchfilebetweentags.el b/style/catchfilebetweentags.el
new file mode 100644
index 0000000000..27c67e23d6
--- /dev/null
+++ b/style/catchfilebetweentags.el
@@ -0,0 +1,116 @@
+;;; catchfilebetweentags.el --- AUCTeX style for catchfilebetweentags package
-*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Uwe Brauer <oub@mat.ucm.es>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: Aug 23, 2022
+;; 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 the catchfilebetweentags package.
+
+;; Acknowledgements
+;; Arash Esbati <arash@gnu.org> for, basically, a complete rewrite, thanks.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex"
+ (keywords class))
+
+(defvar-local LaTeX-catchfilebetweentags-counter nil
+ "Counter for LaTeX-catchfilebetweentags numbers.")
+
+;; Scanning function, stolen from markdown-mode
+(defun LaTeX-catchfilebetweentags-counter-inc ()
+ "Increment `LaTeX-catchfilebetweentags-counter' and return the new value."
+ (when (null LaTeX-catchfilebetweentags-counter)
+ (setq LaTeX-catchfilebetweentags-counter 0)
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward (concat "^%<\\*\\([^>]+\\)>$")
+ (point-max) t)
+ (let ((fn (string-to-number (match-string 1))))
+ (when (> fn LaTeX-catchfilebetweentags-counter)
+ (setq LaTeX-catchfilebetweentags-counter fn))))))
+ (setq LaTeX-catchfilebetweentags-counter
+ (1+ LaTeX-catchfilebetweentags-counter)))
+
+(defun LaTeX-env-catchfilebetweentags (_environment)
+ "Insert a tag-skeleton defined by `LaTeX-catchfilebetweentags'.
+ENVIRONMENT is ignored."
+ (let* ((fn (when LaTeX-catchfilebetweentags-use-numeric-label
+ (LaTeX-catchfilebetweentags-counter-inc)))
+ (tag (TeX-read-string
+ (if fn (format "Tag (default %s): " fn) "Tag: ")
+ nil nil (when fn (number-to-string fn)))))
+ (unless (bolp)
+ (newline)
+ (delete-horizontal-space))
+ (save-excursion
+ (insert (concat (format "%%<*%s>" tag)
+ "\n\n"
+ (format "%%</%s>" tag)))))
+ (forward-line))
+
+(TeX-add-style-hook
+ "catchfilebetweentags"
+ (lambda ()
+ (TeX-add-symbols
+ '("ExecuteMetaData"
+ ;; Act like \include and not like \input:
+ [TeX-arg-input-file "File" t] "Tag")
+ '("ExecuteMetaData*"
+ [TeX-arg-input-file "File" t] "Tag")
+
+ '("CatchFileBetweenTags"
+ TeX-arg-define-macro (TeX-arg-input-file "File-name" t) "Tag")
+ '("CatchFileBetweenTags*"
+ TeX-arg-define-macro (TeX-arg-input-file "File-name" t) "Tag")
+
+ '("CatchFileBetweenDelims"
+ TeX-arg-define-macro (TeX-arg-input-file "File-name" t)
+ "Start delimiter" "Stop delimiter" ["Setup"]))
+
+ (LaTeX-add-environments
+ '("catchfilebetweenfiletags" LaTeX-env-catchfilebetweentags))
+
+ ;; Add `LaTeX-catchfilebetweentags-counter' to
+ ;; `TeX-normal-mode-reset-list' in case the variable gets out of
+ ;; sync:
+ (add-to-list 'TeX-normal-mode-reset-list
+ 'LaTeX-catchfilebetweentags-counter)
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("ExecuteMetaData" "*[{")
+ ("CatchFileBetweenTags" "*|{\\{{")
+ ("CatchFileBetweenDelims" "|{\\{{{["))
+ 'function)))
+ TeX-dialect)
+
+;;; catchfilebetweentags.el ends here
diff --git a/tex-style.el b/tex-style.el
index 3ef92d27bd..b880bfcc25 100644
--- a/tex-style.el
+++ b/tex-style.el
@@ -226,6 +226,13 @@ override the autodetection of the biblatex backend.")
(make-variable-buffer-local 'LaTeX-biblatex-use-Biber)
(put 'LaTeX-biblatex-use-Biber 'safe-local-variable #'booleanp)
+;; style/catchfilebetweentags.el
+
+(defcustom LaTeX-catchfilebetweentags-use-numeric-label t
+ "If non-nil, insert automatic numerical labels.
+Otherwise the prompt asks for a label name."
+ :type 'boolean)
+
;; style/comment.el
(defcustom LaTeX-comment-env-list '("comment")
- [elpa] externals/auctex updated (0029ca410f -> d22387d0d2), Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 56b081e241 02/23: * tex.el (TeX-insert-macro): Use 'atomic-change-group', Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 16ef09b18c 15/23: Override built-in tex-mode, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex b36127cc74 10/23: * tex.el: Require seq.el for older Emacsen where not preloaded., Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 6baccb4054 16/23: Recognize '=' argument modifier, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex fe801f9e4a 11/23: Add support for the amsaddr package, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 324250f243 04/23: Support macros for key-val package or class options, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 48db5bdf84 03/23: Restore compatibility for BSD sed, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 10dbae9ab1 08/23: Add support for catchfilebetweentags package,
Tassilo Horn <=
- [elpa] externals/auctex 567458f54f 07/23: Silence byte-compiler., Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 6b5f00bfac 01/23: Unquote lambdas in font-latex.el & tex-bar.el; add some FIXMEs, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 99470f080d 06/23: Close over list-strings from outer scope., Tassilo Horn, 2022/10/20
- [elpa] externals/auctex d22387d0d2 23/23: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 4a843073c5 22/23: Don't use `eval' on code, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 1e2e097106 12/23: * style/l3doc.el ("l3doc"): Fix entry for the "env" macro., Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 9fc41106dc 17/23: Add new style/parskip.el, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 4c26ef9b0b 21/23: ; Delete ineffective string escapes, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 07a8a3cf98 13/23: ; Use `TeX-dialect' in style/tcolorboxlib-theorems.el, Tassilo Horn, 2022/10/20
- [elpa] externals/auctex 1e59481512 18/23: Improve interaction between fancyvrb.el and fvextra.el, Tassilo Horn, 2022/10/20