[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 8e3137f641 15/48: Simplify implementation of sty
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 8e3137f641 15/48: Simplify implementation of style/titlesec.el |
Date: |
Fri, 18 Nov 2022 14:27:43 -0500 (EST) |
branch: externals/auctex
commit 8e3137f641654655c76f869ebf2be5dd5480d462
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Simplify implementation of style/titlesec.el
* style/titlesec.el (LaTeX-titlesec-section-command-list): Delete
unnecessary `symbol-value'.
(LaTeX-titlesec-titlespec-key-val-options): New function replacing
`LaTeX-arg-titlesec-titlespec'. The new function returns only
key=vals and doesn't insert them into buffer.
("titlesec"): Use the new function in the style hook.
---
style/titlesec.el | 59 +++++++++++++++++++++++++------------------------------
1 file changed, 27 insertions(+), 32 deletions(-)
diff --git a/style/titlesec.el b/style/titlesec.el
index 3c232b0f18..bc1faf13d8 100644
--- a/style/titlesec.el
+++ b/style/titlesec.el
@@ -75,34 +75,29 @@ Removal is based on the return value of function
`TeX-esc'."
(mapcar (lambda (elt) (concat TeX-esc elt))
(if (< (LaTeX-largest-level) 2)
- (symbol-value 'LaTeX-titlesec-section-command-list)
+ LaTeX-titlesec-section-command-list
(remove "chapter" LaTeX-titlesec-section-command-list))))
-(defun LaTeX-arg-titlesec-titlespec (optional)
- "Insert the first argument of \"\\titleformat\" and \"\\titlespacing\".
-Depending on returned value of function `LaTeX-largest-level',
-append a \"name\" key with corresponding values to
-`LaTeX-titlesec-key-val-options'. The values are retrieved from
-`LaTeX-titlesec-section-command-list'. The values of this list
-are also added stand-alone as keys. If OPTIONAL is non-nil,
-insert the argument in brackets."
- (let ((keyvals
- (TeX-read-key-val
- optional
- (append
- `(("name"
- ,(mapcar (lambda (elt) (concat TeX-esc elt))
- (if (< (LaTeX-largest-level) 2)
- (symbol-value 'LaTeX-titlesec-section-command-list)
- (remove "chapter"
LaTeX-titlesec-section-command-list)))))
- (mapcar #'list
- (mapcar (lambda (elt) (concat TeX-esc elt))
- (if (< (LaTeX-largest-level) 2)
- (symbol-value
'LaTeX-titlesec-section-command-list)
- (remove "chapter"
LaTeX-titlesec-section-command-list))))
- LaTeX-titlesec-key-val-options)
- "Sectioning command")))
- (TeX-argument-insert keyvals optional)))
+(defun LaTeX-titlesec-titlespec-key-val-options ()
+ "Return key=val's for the 1st arg of \"\\titleformat\" and
\"\\titlespacing\".
+Depending on the returned value of the function
+`LaTeX-largest-level', append a \"name\" key with corresponding
+values to `LaTeX-titlesec-key-val-options'. The values are
+retrieved from `LaTeX-titlesec-section-command-list'. The values
+of this list are also added stand-alone as keys."
+ (append
+ `(("name"
+ ,(mapcar (lambda (elt) (concat TeX-esc elt))
+ (if (< (LaTeX-largest-level) 2)
+ LaTeX-titlesec-section-command-list
+ (remove "chapter" LaTeX-titlesec-section-command-list)))))
+ (mapcar #'list
+ (mapcar (lambda (elt) (concat TeX-esc elt))
+ (if (< (LaTeX-largest-level) 2)
+ LaTeX-titlesec-section-command-list
+ (remove "chapter" LaTeX-titlesec-section-command-list))))
+ LaTeX-titlesec-key-val-options))
+
(TeX-add-style-hook
"titlesec"
@@ -117,30 +112,30 @@ insert the argument in brackets."
'("titlelabel" t)
;; \titleformat*{<command>}{<format>}
- '("titleformat*" (LaTeX-arg-titlesec-titlespec) t)
+ '("titleformat*" (TeX-arg-key-val
(LaTeX-titlesec-titlespec-key-val-options)) t)
;; 3. Advanced Interface
;;
\titleformat{<command>}[<shape>]{<format>}{<label>}{<sep>}{<before-code>}[<after-code>]
'("titleformat"
- (LaTeX-arg-titlesec-titlespec)
+ (TeX-arg-key-val (LaTeX-titlesec-titlespec-key-val-options))
[TeX-arg-completing-read LaTeX-titlesec-section-shape-list "Shape"]
(TeX-arg-conditional (y-or-n-p "With optional after-code? ")
- (4 [nil])
- (4)))
+ (4 [nil])
+ (4)))
'("chaptertitlename" 0)
;; 3.2. Spacing
;; \titlespacing{<command>}{<left>}{<before-sep>}{<after-sep>}[<right-sep>]
'("titlespacing"
- (LaTeX-arg-titlesec-titlespec)
+ (TeX-arg-key-val (LaTeX-titlesec-titlespec-key-val-options))
(TeX-arg-length "Left margin")
(TeX-arg-length "Before vertical space")
(TeX-arg-length "Space between title and text")
[TeX-arg-length "Right margin"])
'("titlespacing*"
- (LaTeX-arg-titlesec-titlespec)
+ (TeX-arg-key-val (LaTeX-titlesec-titlespec-key-val-options))
(TeX-arg-length "Left margin")
(TeX-arg-length "Before vertical space")
(TeX-arg-length "Space between title and text")
- [elpa] externals/auctex 4eaed332ba 26/48: Add new hooks for inserting environments with arguments, (continued)
- [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
- [elpa] externals/auctex 9b365b7419 18/48: Simplify implementation of style/textpos.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 1f6e9e7e58 10/48: Update style/XCharter.el to package version 1.24, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 05cd0440c5 02/48: Use `TeX-arg-completing-read-multiple', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 0c482642cc 32/48: Simplify implementation of style/currvita.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 615e12f650 42/48: Simplify implementation of style/tcolorbox.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex b9548da54a 38/48: Simplify implementation of style/tcolorboxlib-theorems.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 8e3137f641 15/48: Simplify implementation of style/titlesec.el,
Tassilo Horn <=
- [elpa] externals/auctex 20cabef81f 20/48: ; Delete unnecessary `TeX-arg-string', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 49987f08dd 19/48: Provide completion candidates for `TeX-arg-length', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 52738d11b2 39/48: Remove entry in `LaTeX-completion-function-map-alist-keyval', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 8f70cd5211 14/48: Simplify implementation of style/ulem.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex d5ff42e0bd 34/48: Simplify implementation of style/enumitem.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex ff5a83f345 17/48: Simplify implementation of style/thm-restate.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 0ee39626e4 01/48: Use `TeX-arg-completing-read', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 5949388ca2 12/48: Simplify argument queries in style/wrapfig.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 47f9ead1c6 44/48: Respect `TeX-exit-mark' when inserting enviroments, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex c6c7c3f024 22/48: ; Use #' to quote function, Tassilo Horn, 2022/11/18