[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex d55a960018 19/76: Simplify implementation of sty
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex d55a960018 19/76: Simplify implementation of style/changes.el |
Date: |
Fri, 13 Jan 2023 14:30:52 -0500 (EST) |
branch: externals/auctex
commit d55a9600188a65c6ed290f2f2baeb0a8adf4f741
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Simplify implementation of style/changes.el
* style/changes.el (LaTeX-arg-changes-definechangesauthor)
(LaTeX-arg-changes-markup): Delete functions. The functionality
is provided inside the hook.
(LaTeX-changes-definechangesauthor-key-val-options)
(LaTeX-changes-key-val-options): New functions.
("changes"): Adjust the hook acc. to the changes above.
---
style/changes.el | 92 ++++++++++++++++++++------------------------------------
1 file changed, 32 insertions(+), 60 deletions(-)
diff --git a/style/changes.el b/style/changes.el
index ba38bc5dc5..b0277686b4 100644
--- a/style/changes.el
+++ b/style/changes.el
@@ -60,56 +60,22 @@
(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)))
+(defun LaTeX-changes-definechangesauthor-key-val-options ()
+ "Return a key=val list for the \\definechangesauthor macro."
+ `(("name")
+ ("color" ,(cond ((and (member "xcolor" (TeX-style-list))
+ (fboundp 'LaTeX-xcolor-definecolor-list))
+ (mapcar #'car (LaTeX-xcolor-definecolor-list)))
+ ((and (member "color" TeX-active-styles)
+ (fboundp 'LaTeX-color-definecolor-list))
+ (mapcar #'car (LaTeX-color-definecolor-list)))
+ (t nil)))))
+
+(defun LaTeX-changes-key-val-options ()
+ "Return a key=val list for the change management macros."
+ `(("id" ,(mapcar #'car
+ (LaTeX-changes-definechangesauthor-list)))
+ ("comment")))
(TeX-add-style-hook
"changes"
@@ -134,17 +100,16 @@ Insert the argument in brackets if OPTIONAL is non-nil."
(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)
+ '("added" [TeX-arg-key-val LaTeX-changes-key-val-options nil nil ?\s] 1)
+ '("deleted" [TeX-arg-key-val LaTeX-changes-key-val-options nil nil ?\s] 1)
+ '("replaced" [TeX-arg-key-val LaTeX-changes-key-val-options nil nil ?\s] 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))))]
+ '("highlight" [TeX-arg-key-val LaTeX-changes-key-val-options nil nil ?\s]
1)
+ `("comment"
+ [TeX-arg-key-val
+ ,(lambda ()
+ `(("id" ,(mapcar #'car (LaTeX-changes-definechangesauthor-list)))))]
1)
;; 4.4 Overview of changes
@@ -155,7 +120,14 @@ Insert the argument in brackets if OPTIONAL is non-nil."
"replaced" "highlight" "comment")))])
;; 4.5 Author management \definechangesauthor
- '("definechangesauthor" LaTeX-arg-changes-definechangesauthor)
+ `("definechangesauthor"
+ [TeX-arg-key-val (LaTeX-changes-definechangesauthor-key-val-options)
+ nil nil ?\s]
+ ,(lambda (optional)
+ (let ((id (TeX-read-string
+ (TeX-argument-prompt optional nil "Author ID"))))
+ (LaTeX-add-changes-definechangesauthors id)
+ (TeX-argument-insert id optional))))
;; 4.6 Adaption of the output:
'("setaddedmarkup" "Definition")
- [elpa] externals/auctex 5b73efbfe3 51/76: ; * latex.el (LaTeX-what-macro): Assign values in one go., (continued)
- [elpa] externals/auctex 5b73efbfe3 51/76: ; * latex.el (LaTeX-what-macro): Assign values in one go., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 7bb6878867 20/76: Simplify implementation of style/CJK.el, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex a3887ad184 02/76: Ignore errors from dbus-ping (fixes bug#59380)., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 3d5ac9cf7a 17/76: Cleanup newcommand/newenvironment support, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 08f4fda5bd 06/76: * style/attachfile.el ("attachfile"): Replace `TeX-arg-eval'., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 00f9192bbb 15/76: Check the value of `LaTeX-current-environment' first, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 75bea89b03 09/76: Simplify implementation of style/booktabs.el, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 28eee191b2 50/76: ; * style/enumitem.el ("enumitem"): Slightly improve last change., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 2342a342f9 08/76: Simplify implementation of style/bigstrut.el, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex aaf71ede5d 04/76: Simplify implementation of style/ntheorem.el, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex d55a960018 19/76: Simplify implementation of style/changes.el,
Tassilo Horn <=
- [elpa] externals/auctex fb9c5645dc 49/76: * style/ltxtable.el ("ltxtable"): Replace `TeX-arg-eval'., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 5b693f4e2e 42/76: ; * style/hyperref.el ("hyperref"): Don't use list inside vector., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex f84b1a5fdb 43/76: Simplify implementation of style/ifthen.el, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex e772b93525 53/76: * style/mdframed.el ("mdframed"): Replace `TeX-arg-eval'., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 1c7a1b582e 23/76: Simplify implementation of style/csquotes.el, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex eca0fadbc3 18/76: ; Trivial cleanups, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex b2b899a450 66/76: ; * style/pstricks.el (LaTeX-package-parameter-value): Pacify compiler., Tassilo Horn, 2023/01/13
- [elpa] externals/auctex d43bfae3fa 54/76: Overhaul beamer.el, Tassilo Horn, 2023/01/13
- [elpa] externals/auctex 287da56401 30/76: Revert "Bind a value to `LaTeX-current-environment' locally", Tassilo Horn, 2023/01/13
- [elpa] externals/auctex ee9e8a2b6e 11/76: Move `TeX-TikZ-point-name-regexp' to tex-style.el, Tassilo Horn, 2023/01/13