[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] [elpa] externals/auctex 4384639 11/25: Add new style/chan
From: |
Tassilo Horn |
Subject: |
[AUCTeX-diffs] [elpa] externals/auctex 4384639 11/25: Add new style/changes.el |
Date: |
Sun, 21 Mar 2021 11:44:41 -0400 (EDT) |
branch: externals/auctex
commit 438463972df9c85a951f45d07f20367d8a19252a
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Add new style/changes.el
* Makefile.in (STYLESRC): Add new style.
* style/changes.el: New file.
---
Makefile.in | 2 +-
style/changes.el | 242 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 243 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 8822ae4..1eda319 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -174,7 +174,7 @@ STYLESRC = style/prosper.el \
style/ltxguide.el style/revtex4-2.el style/overpic.el \
style/tex-live.el style/algorithm.el style/algpseudocode.el \
style/appendix.el style/scholax.el style/extramarks.el \
- style/truncate.el style/footnotehyper.el
+ style/truncate.el style/changes.el style/footnotehyper.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/changes.el b/style/changes.el
new file mode 100644
index 0000000..9c3bff5
--- /dev/null
+++ b/style/changes.el
@@ -0,0 +1,242 @@
+;;; changes.el --- AUCTeX style for `changes.sty' -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2021-01-31
+;; 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 `changes.sty' v4.0.0. from 2021/01/28.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords
+ "font-latex"
+ (keywords class))
+(defvar LaTeX-xcolor-base-colors)
+(defvar LaTeX-truncate-package-options)
+(defvar LaTeX-ulem-package-options)
+(defvar LaTeX-xcolor-package-options)
+
+(TeX-auto-add-type "changes-definechangesauthor" "LaTeX")
+
+(defvar LaTeX-changes-definechangesauthor-regexp
+ `(,(concat "\\\\definechangesauthor"
+ "[ \t\n\r%]*"
+ "\\(?:\\[[^]]*\\]\\)?"
+ "[ \t\n\r%]*"
+ "{\\([^}]+\\)}")
+ 1 LaTeX-auto-changes-definechangesauthor)
+ "Matches the id defined by \\definechangesauthor.")
+
+(defun LaTeX-changes-auto-prepare ()
+ "Reset `LaTeX-auto-changes-definechangesauthor'."
+ (setq LaTeX-auto-changes-definechangesauthor nil))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-changes-auto-prepare t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(defun LaTeX-arg-changes-definechangesauthor (optional)
+ "Prompt for the arguments of \\definechangesauthor macro.
+While reading the first optional argument, remove space from
+`crm-local-completion-map' and `minibuffer-local-completion-map'.
+Insert the argument in brackets if OPTIONAL is non-nil."
+ (let* ((crm-local-completion-map
+ (remove (assoc 32 crm-local-completion-map)
+ crm-local-completion-map))
+ (minibuffer-local-completion-map
+ (remove (assoc 32 minibuffer-local-completion-map)
+ minibuffer-local-completion-map))
+ (TeX-last-optional-rejected nil)
+ (keyval (LaTeX-check-insert-macro-default-style
+ (TeX-read-key-val
+ t
+ `(("name")
+ ("color"
+ ,(cond
+ ((and (member "xcolor" (TeX-style-list))
+ (fboundp 'LaTeX-xcolor-definecolor-list))
+ (mapcar #'car (LaTeX-xcolor-definecolor-list)))
+ ((and (member "color" (TeX-style-list))
+ (fboundp 'LaTeX-color-definecolor-list))
+ (mapcar #'car (LaTeX-color-definecolor-list)))
+ (t nil)))))))
+ (TeX-arg-opening-brace LaTeX-optop)
+ (TeX-arg-closing-brace LaTeX-optcl))
+ (when keyval (TeX-argument-insert keyval t)))
+ (let ((id (TeX-read-string
+ (TeX-argument-prompt optional nil "Author ID"))))
+ (LaTeX-add-changes-definechangesauthors id)
+ (TeX-argument-insert id optional)))
+
+(defun LaTeX-arg-changes-markup (optional)
+ "Prompt for the argument of various markup commands.
+Remove space from `crm-local-completion-map' and
+`minibuffer-local-completion-map' while reading user input.
+Insert the argument in brackets if OPTIONAL is non-nil."
+ (let* ((crm-local-completion-map
+ (remove (assoc 32 crm-local-completion-map)
+ crm-local-completion-map))
+ (minibuffer-local-completion-map
+ (remove (assoc 32 minibuffer-local-completion-map)
+ minibuffer-local-completion-map))
+ (keyval (TeX-read-key-val
+ optional
+ `(("id" ,(mapcar #'car
+ (LaTeX-changes-definechangesauthor-list)))
+ ("comment")))))
+ (TeX-argument-insert keyval optional)))
+
+(TeX-add-style-hook
+ "changes"
+ (lambda ()
+
+ ;; Add changes to the parser
+ (TeX-auto-add-regexp LaTeX-changes-definechangesauthor-regexp)
+
+ ;; Run AUCTeX style hooks based on given package options: This is
+ ;; more complicated since we're only looking after "ulem" or
+ ;; "xcolor" and don't really care about the given options to them:
+ (when (assoc "changes" LaTeX-provided-package-options)
+ (dolist (pkg '("ulem" "xcolor"))
+ (let ((opts (cdr (assoc "changes"
+ LaTeX-provided-package-options))))
+ (when (string-match (concat "\\<" pkg "\\>")
+ (mapconcat #'identity opts "|"))
+ (TeX-run-style-hooks pkg)))))
+
+ ;; truncate.sty is always loaded:
+ (TeX-run-style-hooks "truncate")
+
+ (TeX-add-symbols
+ ;; 4.2 Change management
+ '("added" [ LaTeX-arg-changes-markup ] 1)
+ '("deleted" [ LaTeX-arg-changes-markup ] 1)
+ '("replaced" [ LaTeX-arg-changes-markup ] 2)
+
+ ;; 4.3 Highlighting and Comments
+ '("highlight" [ LaTeX-arg-changes-markup ] 1)
+ '("comment"
+ [TeX-arg-eval
+ TeX-read-key-val t `(("id"
+ ,(mapcar #'car
+
(LaTeX-changes-definechangesauthor-list))))]
+ 1)
+
+ ;; 4.4 Overview of changes
+ '("listofchanges"
+ [TeX-arg-key-val (("style" ("list" "summary" "compactsummary"))
+ ("title")
+ ("show" ("all" "added" "deleted"
+ "replaced" "highlight" "comment")))])
+
+ ;; 4.5 Author management \definechangesauthor
+ '("definechangesauthor" LaTeX-arg-changes-definechangesauthor)
+
+ ;; 4.6 Adaption of the output:
+ '("setaddedmarkup" "Definition")
+ '("setdeletedmarkup" "Definition")
+ '("sethighlightmarkup" "Definition")
+ '("setcommentmarkup" "Definition")
+ '("setauthormarkup" "Definition")
+ '("setauthormarkupposition"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Position")
+ '("left" "right")))
+ '("setauthormarktext"
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt optional nil "Markup")
+ '("id" "name")))
+ '("settruncatewidth" (TeX-arg-length "Width"))
+ '("setsummarywidth" (TeX-arg-length "Width"))
+ '("setsummarytowidth" "Text")
+ '("setlocextension" "Extension")
+ '("setsocextension" "Extension"))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("definechangesauthor" "[{")
+ ("setaddedmarkup" "{")
+ ("setdeletedmarkup" "{")
+ ("sethighlightmarkup" "{")
+ ("setcommentmarkup" "{")
+ ("setauthormarkup" "{")
+ ("setauthormarkupposition" "{")
+ ("setauthormarktext" "{")
+ ("settruncatewidth" "{")
+ ("setsummarywidth" "{")
+ ("setsummarytowidth" "{")
+ ("setlocextension" "{")
+ ("setsocextension" "{"))
+ 'function)
+ (font-latex-add-keywords '(("added" "[{")
+ ("deleted" "[{")
+ ("replaced" "[{{")
+ ("highlight" "[{")
+ ("comment" "[{"))
+ 'textual)
+ (font-latex-add-keywords '(("listofchanges" "["))
+ 'reference)))
+ TeX-dialect)
+
+(defun LaTeX-changes-package-options ()
+ "Prompt for package options for the changes package."
+ (TeX-load-style "xcolor")
+ (TeX-load-style "truncate")
+ (TeX-load-style "ulem")
+ (TeX-read-key-val
+ t
+ (append
+ `(("defaultcolor"
+ ,(if (and (fboundp 'LaTeX-xcolor-definecolor-list)
+ (LaTeX-xcolor-definecolor-list))
+ (mapcar #'car (LaTeX-xcolor-definecolor-list))
+ LaTeX-xcolor-base-colors)))
+ `(("draft")
+ ("final")
+ ("commandnameprefix" ("none" "ifneeded" "always"))
+ ("markup" ("default" "underlined" "bfit" "nocolor"))
+ ("addedmarkup" ("colored" "uline" "uuline" "uwave"
+ "dashuline" "dotuline"
+ "bf" "it" "sl" "em"))
+ ("deletedmarkup" ("sout" "xout" "colored"
+ "uline" "uuline" "uwave"
+ "dashuline" "dotuline"
+ "bf" "it" "sl" "em"))
+ ("highlightmarkup" ("background" "uuline" "uwave"))
+ ("commentmarkup" ("todo" "margin" "footnote" "uwave"))
+ ("authormarkup" ("superscript" "subscript" "brackets"
+ "footnote" "none"))
+ ("authormarkupposition" ("right" "left"))
+ ("authormarkuptext" ("id" "name"))
+ ("todonotes")
+ ("truncate" ,LaTeX-truncate-package-options)
+ ("ulem" ,LaTeX-ulem-package-options)
+ ("xcolor" ,LaTeX-xcolor-package-options)))))
+
+;;; changes.el ends here
- [AUCTeX-diffs] [elpa] externals/auctex updated (04d69c5 -> 48fb645), Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 42f1bc3 03/25: ; Fix texinfo error, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 0e616b8 16/25: Enable lexical binding in plain-tex.el, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 653e272 12/25: Deprioritize "\\.drv\\'" in auto-mode-alist, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 39c4e77 07/25: Add new style/truncate.el, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex f87d90f 02/25: Document how to load AUCTeX from a local Git repo, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 8bc74dd 01/25: Update style/bigdelim.el to package version 2.6, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 4384639 11/25: Add new style/changes.el,
Tassilo Horn <=
- [AUCTeX-diffs] [elpa] externals/auctex 2e9b714 09/25: Add new style/footnotehyper.el, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 331b24c 21/25: Use "wrap region or query for logo" also in \[hH]ologoVariant, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 737fa11 20/25: Fix wrapping of active region with \[Hh]ologo macros, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 5afcc09 10/25: Add parsing support to style/comment.el, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 2848def 14/25: * style/geometry.el ("geometry"): Fontify \restoregeometry macro., Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex da52023 24/25: Discard `TeX-auto-update' to silence byte compiler, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 72e645f 13/25: ; * tex-buf.el (TeX-active-master): Fix comment., Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 6db8a1a 06/25: ; Use @subsection, Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex b9f4f36 04/25: ; * doc/quickstart.texi (Editing Facilities): Fix formatting., Tassilo Horn, 2021/03/21
- [AUCTeX-diffs] [elpa] externals/auctex 0c90254 15/25: ; * tex-buf.el (TeX-command-region): Fix typo in comment., Tassilo Horn, 2021/03/21