[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex c525dd42dd 35/48: Simplify implementation of sty
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex c525dd42dd 35/48: Simplify implementation of style/tcolorboxlib-raster.el |
Date: |
Fri, 18 Nov 2022 14:27:44 -0500 (EST) |
branch: externals/auctex
commit c525dd42dd2660c18c49dc1484911666502ae2ea
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Simplify implementation of style/tcolorboxlib-raster.el
* style/tcolorboxlib-raster.el ("tcolorboxlib-raster"): Use
`LaTeX-env-args' and `LaTeX-env-item-args' in the hook and
subsequently delete `LaTeX-tcolorbox-lib-raster-env-item'.
---
style/tcolorboxlib-raster.el | 101 ++++++++++++-------------------------------
1 file changed, 27 insertions(+), 74 deletions(-)
diff --git a/style/tcolorboxlib-raster.el b/style/tcolorboxlib-raster.el
index db61a03491..1d67761bc1 100644
--- a/style/tcolorboxlib-raster.el
+++ b/style/tcolorboxlib-raster.el
@@ -1,6 +1,6 @@
;;; tcolorboxlib-raster.el --- AUCTeX style for `raster' library from
tcolorbox -*- lexical-binding: t; -*-
-;; Copyright (C) 2016--2021 Free Software Foundation, Inc.
+;; Copyright (C) 2016--2022 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
@@ -84,47 +84,6 @@
("raster multirow"))
"Key=value options for raster library from tcolorbox.")
-(defun LaTeX-tcolorbox-lib-raster-env-item (environment)
- "Insert ENVIRONMENT, ask for arguments and the first item."
- (LaTeX-insert-environment
- environment
- (let ((opts (TeX-read-key-val t (append
- LaTeX-tcolorbox-lib-raster-keyval-options
- (LaTeX-tcolorbox-keyval-options))
- (when (string= environment "tcboxeditemize")
- "Raster options (k=v)")))
- (box-opts (when (string= environment "tcboxeditemize")
- (TeX-read-key-val nil (LaTeX-tcolorbox-keyval-options)
- "Box options (k=v)"))))
- (concat
- (when (and opts (not (string= opts "")))
- (format "[%s]" opts))
- (when (string= environment "tcboxeditemize")
- (format "{%s}" box-opts)))))
- (if (TeX-active-mark)
- (progn
- (LaTeX-find-matching-begin)
- (end-of-line 1))
- (end-of-line 0))
- (delete-char 1)
- (when (looking-at (concat "^[ \t]+$\\|"
- "^[ \t]*" TeX-comment-start-regexp "+[ \t]*$"))
- (delete-region (point) (line-end-position)))
- (delete-horizontal-space)
- ;; Deactivate the mark here in order to prevent `TeX-parse-macro'
- ;; from swapping point and mark and the \item ending up right after
- ;; \begin{...}.
- (deactivate-mark)
- (LaTeX-insert-item)
- ;; The inserted \item may have outdented the first line to the
- ;; right. Fill it, if appropriate.
- (when (and auto-fill-function
- (not (looking-at "$"))
- (not (assoc environment LaTeX-indent-environment-list))
- (> (- (line-end-position) (line-beginning-position))
- (current-fill-column)))
- (LaTeX-fill-paragraph nil)))
-
(defun LaTeX-tcolorbox-lib-raster-insert-item ()
"Insert \"tcbitem\" and query for optional argument."
(TeX-insert-macro "tcbitem"))
@@ -140,42 +99,36 @@
(TeX-add-symbols
;; 14.2 Macros of the Library
'("tcbitem"
- [TeX-arg-key-val (LaTeX-tcolorbox-keyval-options) "Item options (k=v)" ]
+ [TeX-arg-key-val (LaTeX-tcolorbox-keyval-options) "Item options"]
(TeX-arg-literal " ")))
(LaTeX-add-environments
;; 14.2 Macros of the Library
- '("tcbraster"
- (lambda (env)
- (LaTeX-insert-environment
- env
- (let ((raster-opts
- (TeX-read-key-val t (append
- LaTeX-tcolorbox-lib-raster-keyval-options
- (LaTeX-tcolorbox-keyval-options)))))
- (when (and raster-opts (not (string= raster-opts "")))
- (concat LaTeX-optop raster-opts LaTeX-optcl))))))
-
- '("tcbitemize" LaTeX-tcolorbox-lib-raster-env-item)
-
- '("tcboxedraster"
- (lambda (env)
- (LaTeX-insert-environment
- env
- (let ((raster-opts
- (TeX-read-key-val t (append
- LaTeX-tcolorbox-lib-raster-keyval-options
- (LaTeX-tcolorbox-keyval-options))
- "Raster options (k=v)"))
- (box-opts
- (TeX-read-key-val nil (LaTeX-tcolorbox-keyval-options)
- "Box options (k=v)")))
- (concat
- (when (and raster-opts (not (string= raster-opts "")))
- (concat LaTeX-optop raster-opts LaTeX-optcl))
- TeX-grop box-opts TeX-grcl)))))
-
- '("tcboxeditemize" LaTeX-tcolorbox-lib-raster-env-item))
+ `("tcbraster" LaTeX-env-args
+ [TeX-arg-key-val ,(lambda ()
+ (append LaTeX-tcolorbox-lib-raster-keyval-options
+ (LaTeX-tcolorbox-keyval-options)))])
+
+ `("tcbitemize" LaTeX-env-item-args
+ [TeX-arg-key-val ,(lambda ()
+ (append LaTeX-tcolorbox-lib-raster-keyval-options
+ (LaTeX-tcolorbox-keyval-options)))])
+
+ `("tcboxedraster" LaTeX-env-args
+ [TeX-arg-key-val ,(lambda ()
+ (append LaTeX-tcolorbox-lib-raster-keyval-options
+ (LaTeX-tcolorbox-keyval-options)))
+ "Raster options"]
+ (TeX-arg-key-val (LaTeX-tcolorbox-keyval-options)
+ "Box options"))
+
+ `("tcboxeditemize" LaTeX-env-item-args
+ [TeX-arg-key-val ,(lambda ()
+ (append LaTeX-tcolorbox-lib-raster-keyval-options
+ (LaTeX-tcolorbox-keyval-options)))
+ "Raster options"]
+ (TeX-arg-key-val (LaTeX-tcolorbox-keyval-options)
+ "Box options")))
;; Append tcb(oxed)?itemize to `LaTeX-item-list':
(add-to-list 'LaTeX-item-list
- [elpa] externals/auctex updated (c569c7d486 -> 93430d7ab0), Tassilo Horn, 2022/11/18
- [elpa] externals/auctex cb7b44227d 31/48: Improve fontification of indexing macros, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex c525dd42dd 35/48: Simplify implementation of style/tcolorboxlib-raster.el,
Tassilo Horn <=
- [elpa] externals/auctex 748449959c 21/48: New option `TeX-refuse-unmatched-dollar', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 487c91fddb 04/48: ; Pacify compiler warning: Unused lexical argument `ignored', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex ce15e3fd87 24/48: Extend Japanese TeX support, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 52a7f4050f 27/48: ; * doc/auctex.texi (Adding Environments): Adjust indentation., Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 42150568f1 06/48: Allow user to insert "$" (bug#57626), Tassilo Horn, 2022/11/18
- [elpa] externals/auctex cdf57fba58 11/48: * latex.el (TeX-arg-conditional): Declare 'indent'., Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 4eaed332ba 26/48: Add new hooks for inserting environments with arguments, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex d7e6fa0d41 05/48: Cleanup `TeX-insert-dollar', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 21e624026a 28/48: Improve support for TikZ, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex e53bb19a90 37/48: ; Recognize large arguments with many lines, Tassilo Horn, 2022/11/18