[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex ecf8b28cda 14/77: Add new style/multibib.el
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex ecf8b28cda 14/77: Add new style/multibib.el |
Date: |
Fri, 26 Aug 2022 16:06:32 -0400 (EDT) |
branch: externals/auctex
commit ecf8b28cda52734dd8e44b286e0f46d828ad5794
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Add new style/multibib.el
* Makefile.in (STYLESRC): Add new style.
* style/multibib.el: New file.
---
Makefile.in | 2 +-
style/multibib.el | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 133 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 77cb7d35a7..235b9058a1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -181,7 +181,7 @@ STYLESRC = style/prosper.el \
style/rotating.el style/sidecap.el style/l3doc.el \
style/ifthen.el style/etoolbox.el style/ifetex.el \
style/ifpdf.el style/iftex.el style/ifvtex.el \
- style/ifxetex.el
+ style/ifxetex.el style/multibib.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/multibib.el b/style/multibib.el
new file mode 100644
index 0000000000..f3afa5c036
--- /dev/null
+++ b/style/multibib.el
@@ -0,0 +1,132 @@
+;;; multibib.el --- AUCTeX style for `multibib.sty' -*- lexical-binding: t;
-*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2022-01-18
+;; 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 Street, Fifth Floor, Boston,
+;; MA 02110-1301 USA.
+
+;;; Commentary:
+
+;; This file adds support for `multibib.sty' v1.4 form 2008-12-10.
+
+;; Note for RefTeX users: multibib package allows multiple macro calls
+;; to load bibliography database files. RefTeX bundled with Emacs
+;; 29.1 is adjusted to recognize this. For prior Emacs versions, the
+;; following code in the preamble should suffice to "fool" AUCTeX and
+;; RefTeX for multiple bibliography calls:
+;;
+;; \iffalse
+;; \usepackage{biblatex}
+;; \fi
+
+;;; Code:
+
+(require 'tex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex"
+ (keywords class))
+
+;; Setup for \newcites: Note that the macro is called \newcites and we
+;; choose the name newcite in order to get away with any un-natural
+;; plural form:
+(TeX-auto-add-type "multibib-newcite" "LaTeX")
+
+(defvar LaTeX-multibib-newcites-regexp
+ `(,(concat "\\\\newcites"
+ "[ \t\n\r%]*"
+ "{\\([^}]+\\)}")
+ 1 LaTeX-auto-multibib-newcite)
+ "Matches the arguments of \\newcites from multibib package.")
+
+(defun LaTeX-multibib-auto-prepare ()
+ "Clear `LaTeX-auto-multibib-newcite' variables before parsing."
+ (setq LaTeX-auto-multibib-newcite nil))
+
+(defun LaTeX-multibib-auto-cleanup ()
+ "Process the parsed elements from \\newcites macro."
+ (when (LaTeX-multibib-newcite-list)
+ (let (suffix)
+ (dolist (elt (LaTeX-multibib-newcite-list))
+ (push (replace-regexp-in-string "[ %\n\r\t]" "" (car elt)) suffix))
+ (setq suffix (mapconcat #'identity suffix ","))
+ (dolist (elt (split-string suffix "," t))
+ (TeX-add-symbols
+ `(,(concat "cite" elt)
+ (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) ())
+ TeX-arg-cite)
+ `(,(concat "nocite" elt) TeX-arg-cite)
+ `(,(concat "bibliographystyle" elt) TeX-arg-bibstyle)
+ `(,(concat "bibliography" elt) TeX-arg-bibliography))
+ ;; RefTeX: Check if `reftex-bibliography-commands' is bound
+ ;; and append our newly defined entry to a local version of
+ ;; it:
+ (when (boundp 'reftex-bibliography-commands)
+ (add-to-list (make-local-variable 'reftex-bibliography-commands)
+ (concat "bibliography" elt)
+ t))
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords `((,(concat "cite" elt) "[{")
+ (,(concat "nocite" elt) "{")
+ (,(concat "bibliography" elt) "{"))
+ 'reference)
+ (font-latex-add-keywords `((,(concat "bibliographystyle" elt) "{"))
+ 'function))))))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-multibib-auto-prepare t)
+(add-hook 'TeX-auto-cleanup-hook #'LaTeX-multibib-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(TeX-add-style-hook
+ "multibib"
+ (lambda ()
+
+ ;; Add 'multibib' to the parser:
+ (TeX-auto-add-regexp LaTeX-multibib-newcites-regexp)
+
+ (TeX-add-symbols
+ '("newcites"
+ (TeX-arg-eval
+ (lambda ()
+ (let ((suf (TeX-read-string
+ (TeX-argument-prompt nil nil "Suffix"))))
+ (LaTeX-add-multibib-newcites suf)
+ (LaTeX-multibib-auto-cleanup)
+ (format "%s" suf))))
+ "Heading")
+ '("setbiblabelwidth" "Label"))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("newcites" "{{")
+ ("setbiblabelwidth" "{"))
+ 'function)))
+ TeX-dialect)
+
+(defvar LaTeX-multibib-package-options '("labeled" "resetlabels")
+ "Package options for the multibib package.")
+
+;;; multibib.el ends here
- [elpa] externals/auctex 0f59225c0f 70/77: ; * doc/todo.texi (Mid-term Goals): Fix typo., (continued)
- [elpa] externals/auctex 0f59225c0f 70/77: ; * doc/todo.texi (Mid-term Goals): Fix typo., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 2d28bd1630 67/77: Avoid `makeinfo` warnings, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex edabf207b4 65/77: Insert a space between \caption and \\ in tables, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex edb15b8f26 43/77: Follow up the previous commit, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 728db25bf7 69/77: Update documentation, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 33a01b6928 59/77: Extend test for filling, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 5c5aa78de0 71/77: Fix doc string, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex cb0a1e6be1 72/77: Improve function calls to retrieve key=vals in style hooks, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 010a1e24be 01/77: Follow up the previous commit, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex c39fe6d1d6 13/77: Delete compatibility code, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex ecf8b28cda 14/77: Add new style/multibib.el,
Tassilo Horn <=
- [elpa] externals/auctex 37e5a450a3 20/77: Complete LaTeX lengths and counters, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 9ca155cdb0 25/77: Improve fontification of kernel macros, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex d47a6e8716 29/77: Support complex \input path (bug#55511), Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 6fe2f21e96 31/77: ; Fix warnings about single quotes in docstrings, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 4770d57dba 38/77: Support different number of arguments for \hyperref, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex daaff30b4a 36/77: Follow elisp quoting convention, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 192f201f96 49/77: Add new style/microtype.el, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex cc70633aa6 51/77: ; * preview.el.in (preview-reference-face): Fix warning., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 812368af6a 62/77: Update documentation about C-M-a and C-M-e, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 545129e1c3 55/77: * style/shortvrb.el: Add missing macros incl. fontification., Tassilo Horn, 2022/08/26