# HG changeset patch # User Uwe Brauer # Date 1701608407 -3600 # Sun Dec 03 14:00:07 2023 +0100 # Node ID 9d16ecbae0aad14d4fff18f347af5af0b7223a4d # Parent 35fb43f7b36b75f7153c3a716d4fd81960c32422 # EXP-Topic refcount Add refcount support to AucTeX * Makefile.in (STYLESRC): Add refcount. * style/refcount.el: Add refcount support to AucTeX. diff --git a/Makefile.in b/Makefile.in --- a/Makefile.in +++ b/Makefile.in @@ -197,7 +197,7 @@ 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/wasysym.el style/refcount.el STYLEELC = $(STYLESRC:.el=.elc) diff --git a/style/refcount.el b/style/refcount.el new file mode 100644 --- /dev/null +++ b/style/refcount.el @@ -0,0 +1,90 @@ +;;; refcount.el --- AUCTeX style for refcount package -*- lexical-binding: t; -*- + +;; Copyright (C) 2022 Free Software Foundation, Inc. + +;; Author: Uwe Brauer oub@mat.ucm.es, Arash Esbati +;; Maintainer: auctex-devel@gnu.org +;; Created: 02 Dec 2023 +;; Keywords: +;; 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 refcount package. + + +;;; Code: + +(require 'tex) +(require 'latex) + +;; Silence the compiler: +(declare-function font-latex-add-keywords + "font-latex" + (keywords class)) + + + +(TeX-add-style-hook + "refcount" + (lambda () + (TeX-add-symbols + '("setcounterref" TeX-arg-counter TeX-arg-ref) + '("addtocounterref" TeX-arg-counter TeX-arg-ref) + '("setcounterpageref" TeX-arg-counter TeX-arg-ref) + '("addcounterpageref" TeX-arg-counter TeX-arg-ref) + '("getrefnumber" TeX-arg-ref) + '("getpagerefnumber" TeX-arg-ref) + '("refused" TeX-arg-ref) + '("IfRefUndefinedExpandable" + TeX-arg-ref + (TeX-arg-completing-read ("then" "else")) + "Default") + '("getrefbykeydefault" TeX-arg-ref + (TeX-arg-completing-read ("page" "title" "name" "anchor" "url")) + "Default") + '("IfRefUndefinedBabel" + TeX-arg-ref + (TeX-arg-completing-read ("then" "else")) + "Default")) + ;; Fontification + (when (and (featurep 'font-latex) + (eq TeX-install-font-lock 'font-latex-setup)) + (font-latex-add-keywords '(("getrefbykeydefault" "*{") + ("setcounterref" "*{") + ("addtocounterref" "*{") + ("setcounterpageref" "*{") + ("addcounterpageref" "*{") + ("getrefnumber" "*{") + ("getpagerefnumber" "*{") + ("IfRefUndefinedExpandable" "*{") + ("IfRefUndefinedBabel" "*{") + ("refused" "*{")) + 'function)) + + ;; RefTeX reference style + (when (featurep 'reftex-vars) + (and LaTeX-reftex-ref-style-auto-activate + (fboundp 'reftex-ref-style-activate) + (reftex-ref-style-activate "Refcount")))) + TeX-dialect) + + + + +;;; refcount.el ends here