[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/latex-table-wizard 1abac6974f 08/70: Fix problem when n
From: |
ELPA Syncer |
Subject: |
[elpa] externals/latex-table-wizard 1abac6974f 08/70: Fix problem when no space before delimiters |
Date: |
Sat, 13 May 2023 08:59:10 -0400 (EDT) |
branch: externals/latex-table-wizard
commit 1abac6974fc627461f1621c24ee34edc25707d4d
Author: Enrico Flor <nericoflor@gmail.com>
Commit: Enrico Flor <nericoflor@gmail.com>
Fix problem when no space before delimiters
---
latex-table-wizard.el | 39 +++++++++++++++++++++++++++++----------
1 file changed, 29 insertions(+), 10 deletions(-)
diff --git a/latex-table-wizard.el b/latex-table-wizard.el
index b126edade7..61e640b3bf 100644
--- a/latex-table-wizard.el
+++ b/latex-table-wizard.el
@@ -81,7 +81,7 @@
Capture group 1 matches the name of the macro.")
-(defconst latex-table-wizard-column-delimiters '("[^\\\\]&")
+(defconst latex-table-wizard-column-delimiters '("&")
"List of regexps matching column delimiters.")
(defconst latex-table-wizard-row-delimiters '("\\\\\\\\")
@@ -98,6 +98,21 @@ Capture group 1 matches the name of the macro.")
Each member of this list is a string that would be between the
\"\\\" and the arguments.")
+(defsubst latex-table-wizard--unescaped-p (&optional position)
+ "Return t if LaTeX macro starting at POSITION is not escaped.
+
+If POSITION is nil, use the value of `point'.
+
+A macro is escaped if it is preceded by a single \\='\\\\='."
+ (let ((p (or position (point))))
+ (save-excursion
+ (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 (cl-evenp (length matched)) t))))))
;; Every time latex-table-wizard--parse-table is evaluated, the values
;; of the variables below is set:
@@ -179,7 +194,7 @@ If the current environment is one that is mapped to
something in
If NAME is nil, skip any LaTeX macro that point is looking at."
(let* ((n (or name (rx (one-or-more alnum))))
(macro-re (concat "\\\\" n latex-table-wizard--macro-args-re)))
- (unless (looking-back "[^\\\\]\\\\" (line-beginning-position))
+ (when (latex-table-wizard--unescaped-p)
(when (looking-at macro-re)
(match-end 0)))))
@@ -251,8 +266,7 @@ argument."
(end-of-row))
(while (and (< (point) lim) (not end))
(cond ((and (looking-at "%")
- (not (looking-back "[^\\\\]\\\\"
- (line-beginning-position))))
+ (latex-table-wizard--unescaped-p))
;; the first step is important to avoid being fooled by
;; column or row delimiters in comments!
(forward-line))
@@ -262,17 +276,21 @@ argument."
(LaTeX-find-matching-end))
((looking-at (concat "[[:space:]]*" latex-table-wizard--macro-re))
(goto-char (match-end 0)))
- ((looking-at col-re)
+ ((and (looking-at col-re)
+ (latex-table-wizard--unescaped-p))
;; a column delimiter: bingo
- (goto-char (match-beginning 0))
(setq end (point-marker))
(goto-char (match-end 0)))
- ((looking-at row-re)
+ ((and (looking-at row-re)
+ (latex-table-wizard--unescaped-p))
;; a row delimiter: bingo
- (let ((end-of-previous-cell
- (progn (goto-char (1- (match-beginning 0)))
+ (let ((after-del (save-excursion
+ (goto-char (match-end 0))
+ (point-marker)))
+ (end-of-previous-cell
+ (progn (goto-char (match-beginning 0))
(point-marker))))
- (goto-char (match-end 0))
+ (goto-char after-del)
(setq end end-of-previous-cell
end-of-row t)
(latex-table-wizard--skip-stuff lim)))
@@ -1084,6 +1102,7 @@ at point. If it is none of those object, return nil."
;;;###autoload (autoload 'latex-table-wizard-do "latex-table-wizard" nil t)
(transient-define-prefix latex-table-wizard-do ()
+ "Edit table-like environment at point with a transient interface."
[:description
" LaTeX table wizard"
["Motion"
- [elpa] externals/latex-table-wizard a53d3f6158 30/70: Version 0.2.0, (continued)
- [elpa] externals/latex-table-wizard a53d3f6158 30/70: Version 0.2.0, ELPA Syncer, 2023/05/13
- [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 <=
- [elpa] externals/latex-table-wizard 809dff99ef 11/70: Make syntax-quoted forms everywhere, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 74d169f8df 20/70: Two bug fixes, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 4f3f4011ab 22/70: Add group for face and remove before-save-hook, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard acdd4d8b56 23/70: New interactive function that calls transient prefix, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard da4a2e3540 24/70: Made into a minor mode, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f9fb0ae878 28/70: Cleanup and some bug fixed, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 9ce3165694 32/70: Add center and right alignment, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard e3553c7759 34/70: Add feedback about cell jumps, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard 13359e40f6 44/70: rename readme, ELPA Syncer, 2023/05/13
- [elpa] externals/latex-table-wizard f290f87949 45/70: add empty changelog file, ELPA Syncer, 2023/05/13