[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/latex-table-wizard a53d3f6158 30/70: Version 0.2.0
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/latex-table-wizard a53d3f6158 30/70: Version 0.2.0 |
|
Date: |
Sat, 13 May 2023 08:59:12 -0400 (EDT) |
branch: externals/latex-table-wizard
commit a53d3f615820146d496678c9b0bb794324d18aa4
Author: Enrico Flor <nericoflor@gmail.com>
Commit: Enrico Flor <nericoflor@gmail.com>
Version 0.2.0
Integrate with customize interface
---
latex-table-wizard.el | 135 ++++++++++++++++++++++++++++----------------------
readme.org | 65 ++++++++++++++++++++----
2 files changed, 131 insertions(+), 69 deletions(-)
diff --git a/latex-table-wizard.el b/latex-table-wizard.el
index 4c09ce85f9..f551a4a6c6 100644
--- a/latex-table-wizard.el
+++ b/latex-table-wizard.el
@@ -5,7 +5,7 @@
;; Author: Enrico Flor <enrico@eflor.net>
;; Maintainer: Enrico Flor <enrico@eflor.net>
;; URL: https://github.com/enricoflor/latex-table-wizard
-;; Version: 0.1.0
+;; Version: 0.2.0
;; Package-Requires: ((emacs "27.1") (auctex "12.1") (transient "0.3.7"))
@@ -99,7 +99,12 @@
(eval-when-compile (require 'subr-x))
(require 'transient)
-;;; Regular expressions
+(defgroup latex-table-wizard nil
+ "LaTeX table wizard configuration options."
+ :prefix "latex-table-wizard"
+ :group 'convenience)
+
+;;; Regular expressions and configuration options
(defconst latex-table-wizard--macro-args-re
(rx (seq (zero-or-more ; obligatory arguments
@@ -118,22 +123,57 @@
Capture group 1 matches the name of the macro.")
-(defconst latex-table-wizard-column-delimiters '("&")
- "List of strings that are column delimiters if unescaped.")
+(defcustom latex-table-wizard-column-delimiters '("&")
+ "List of strings that are column delimiters if unescaped."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
-(defconst latex-table-wizard-row-delimiters '("\\\\\\\\")
- "List of strings that are row delimiters if unescaped.")
+(defcustom latex-table-wizard-row-delimiters '("\\\\\\\\")
+ "List of strings that are row delimiters if unescaped."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
-(defvar latex-table-wizard-hline-macros '("cline"
- "vline"
- "midrule"
- "hline"
- "toprule"
- "bottomrule")
+(defcustom latex-table-wizard-hline-macros '("cline"
+ "vline"
+ "midrule"
+ "hline"
+ "toprule"
+ "bottomrule")
"Name of macros that draw horizontal lines.
Each member of this list is a string that would be between the
-\"\\\" and the arguments.")
+\"\\\" and the arguments."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
+
+(defcustom latex-table-wizard-new-environments-alist nil
+ "Alist mapping environment names to property lists.
+
+The environment name is a string, for example \"foo\" for an
+environment like
+
+ \\begin{foo}
+ ...
+ \\end{foo}
+
+The cdr of each mapping is a property list with three keys:
+
+ :col
+ :row
+ :lines
+
+The values for :col and :row are two lists of strings.
+
+The value for :lines is a list of strings just like is the case
+for `latex-table-wizard-hline-macros', each of which is the name
+of a macro that inserts some horizontal line. For a macro
+\"\\foo{}\", use string \"foo\"."
+ :type '(alist :key-type (string :tag "Name of the environment:")
+ :value-type (plist :key-type symbol
+ :options (:col :row :lines)
+ :value-type (repeat string)))
+
+ :group 'latex-table-wizard)
(defmacro latex-table-wizard--or (symbol &rest values)
"Return non-nil if SYMBOL is `eq' to one of VALUES."
@@ -152,10 +192,8 @@ A macro is escaped if it is preceded by a single
\\='\\\\='."
(goto-char p)
(save-match-data
(looking-back "\\\\*" (line-beginning-position) t)
- (let ((matched (buffer-substring-no-properties
- (match-beginning 0)
- (match-end 0))))
- (when (eq (logand (length matched) 1) 0) t))))))
+ (let ((len (length (match-string-no-properties 0))))
+ (when (eq (logand len 1) 0) t))))))
;; Every time latex-table-wizard--parse-table is evaluated, the values
;; of the variables below is set:
@@ -163,54 +201,28 @@ A macro is escaped if it is preceded by a single
\\='\\\\='."
(defvar latex-table-wizard--current-row-delims nil)
(defvar latex-table-wizard--current-hline-macros nil)
-(defvar latex-table-wizard-new-environments-alist nil
- "Alist mapping environment names to property lists.
-
-The environment name is a string, for example \"foo\" for an
-environment like
-
- \\begin{foo}
- ...
- \\end{foo}
-
-The cdr of each mapping is a property list with three keys:
-
- :col
- :row
- :lines
-
-The values for :col and :row are two lists of strings.
-
-The value for :lines is a list of strings just like is the case
-for `latex-table-wizard-hline-macros'.")
-
(defun latex-table-wizard--set-current-values ()
"Set temporary values that specify the syntax of the environment.
If the current environment is one that is mapped to something in
`latex-table-wizard-new-environments', set the values accordingly."
- (if-let ((vals (cdr (assoc (LaTeX-current-environment)
- latex-table-wizard-new-environments-alist))))
+ (let* ((values (cdr (assoc (LaTeX-current-environment)
+ latex-table-wizard-new-environments-alist)))
+ (col (plist-get values :col))
+ (row (plist-get values :row))
+ (lines (plist-get values :lines)))
+ (if col
+ (setq latex-table-wizard--current-col-delims col)
(setq latex-table-wizard--current-col-delims
- (plist-get (cdr (assoc (LaTeX-current-environment)
- latex-table-wizard-new-environments-alist))
- :col)
-
- latex-table-wizard--current-row-delims
- (plist-get (cdr (assoc (LaTeX-current-environment)
- latex-table-wizard-new-environments-alist))
- :row)
-
- latex-table-wizard--current-hline-macros
- (plist-get (cdr (assoc (LaTeX-current-environment)
- latex-table-wizard-new-environments-alist))
- :lines))
- (setq latex-table-wizard--current-col-delims
- latex-table-wizard-column-delimiters
- latex-table-wizard--current-row-delims
- latex-table-wizard-row-delimiters
- latex-table-wizard--current-hline-macros
- latex-table-wizard-hline-macros)))
+ latex-table-wizard-column-delimiters))
+ (if row
+ (setq latex-table-wizard--current-row-delims row)
+ (setq latex-table-wizard--current-row-delims
+ latex-table-wizard-row-delimiters))
+ (if lines
+ (setq latex-table-wizard--current-hline-macros lines)
+ (setq latex-table-wizard--current-hline-macros
+ latex-table-wizard-hline-macros))))
@@ -1244,6 +1256,11 @@ Only remove them in current buffer."
(latex-table-wizard--hide-rest)
(call-interactively #'latex-table-wizard-prefix))
+(defun latex-table-wizard-customize ()
+ "Call the customize function with latex-table-wizard as argument."
+ (interactive)
+ (customize-browse 'latex-table-wizard))
+
(provide 'latex-table-wizard)
;;; _
diff --git a/readme.org b/readme.org
index 1adf24a43e..056f6a15ff 100644
--- a/readme.org
+++ b/readme.org
@@ -310,16 +310,57 @@ cells if you want to change the layout of the transient
interface.
Remember the default values used for parsing table environments:
#+begin_src emacs-lisp
-(defconst latex-table-wizard-column-delimiters '("&")
- "List of strings that are column delimiters if unescaped.")
-
-(defconst latex-table-wizard-row-delimiters '("\\\\\\\\")
- "List of strings that are row delimiters if unescaped.")
-
-(defvar latex-table-wizard-hline-macros '("hline"
- "midrule"
- "toprule"
- "bottomrule"))
+(defcustom latex-table-wizard-column-delimiters '("&")
+ "List of strings that are column delimiters if unescaped."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
+
+(defcustom latex-table-wizard-row-delimiters '("\\\\\\\\")
+ "List of strings that are row delimiters if unescaped."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
+
+(defcustom latex-table-wizard-hline-macros '("cline"
+ "vline"
+ "midrule"
+ "hline"
+ "toprule"
+ "bottomrule")
+ "Name of macros that draw horizontal lines.
+
+Each member of this list is a string that would be between the
+\"\\\" and the arguments."
+ :type '(repeat string)
+ :group 'latex-table-wizard)
+
+(defcustom latex-table-wizard-new-environments-alist nil
+ "Alist mapping environment names to property lists.
+
+The environment name is a string, for example \"foo\" for an
+environment like
+
+ \\begin{foo}
+ ...
+ \\end{foo}
+
+The cdr of each mapping is a property list with three keys:
+
+ :col
+ :row
+ :lines
+
+The values for :col and :row are two lists of strings.
+
+The value for :lines is a list of strings just like is the case
+for `latex-table-wizard-hline-macros', each of which is the name
+of a macro that inserts some horizontal line. For a macro
+\"\\foo{}\", use string \"foo\"."
+ :type '(alist :key-type (string :tag "Name of the environment:")
+ :value-type (plist :key-type symbol
+ :options (:col :row :lines)
+ :value-type (repeat string)))
+
+ :group 'latex-table-wizard)
#+end_src
LaTeX-table-wizard will always presume the table you want operate on
@@ -340,3 +381,7 @@ Remember the default values used for parsing table
environments:
(add-to-list 'latex-table-wizard-new-environments-alist
'("mytable" . (:col ("!COL") :row ("!ROW") :lines
("horizontal"))))
#+end_src
+
+ A more convenient way to customize these variables is through the
+ ~customize~ interface, which is easily accessed through the interactive
+ command ~latex-table-wizard-customize~.
- [elpa] externals/latex-table-wizard a28e0f0ec5 04/70: Some cleanup, (continued)
- [elpa] externals/latex-table-wizard a28e0f0ec5 04/70: Some cleanup, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 06d0453f60 10/70: Version bump to 0.0.3, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f9394894f7 05/70: Fix parsing if 0, 0 cell starts in same line as \begin macro, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 29c65891e6 07/70: Fix transient autoload and remove transient change function, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 174739aad8 06/70: Fix byte-compilations warnings about docstrings, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 8402bc0ed9 12/70: Don't call face -face (as per elisp manual ch 40), ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 972e8eeba1 16/70: Optimize for compilation and simplify, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard c75063522b 17/70: Extend overlay limit to beginning of \end{} macro, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 293bbfc9ed 18/70: Actually remove function definition made useless, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 7ac03c0a51 26/70: Correct readme, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard a53d3f6158 30/70: Version 0.2.0,
ELPA Syncer <=
- [elpa] externals/latex-table-wizard a0e0aff19c 31/70: Reduce the need to re-parse the table, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 482380db44 38/70: Update docstring, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 02ddb6e01c 41/70: Fix bug occurring when in Emacs 27, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 230bb852fa 43/70: Add .texi file, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 723e619753 09/70: Generalize insert functions, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard b4b8b8bf52 13/70: Update readme for 0.0.3, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard de5a922da6 14/70: Remove useless calls to format, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard e3119802f7 15/70: Expand Commentary section, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 3b53c528c7 19/70: Clarify commentary and fix typo, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 1abac6974f 08/70: Fix problem when no space before delimiters, ELPA Syncer, 2023/05/13