branch: elpa/adoc-mode
commit 1ef95ef31adb4999fc3fade426b0e324976fe939
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
[Fix #24] Fix table delimiter highlighting for any number of columns
The previous implementation hardcoded 4 cell-specifier/pipe groups
(limited by Emacs's 9 regex group maximum). Replace with an anchored
font-lock highlight that matches the first pipe at the beginning of
the line, then repeatedly matches subsequent pipes to the end of the
line. This supports tables with any number of columns.
---
CHANGELOG.md | 1 +
adoc-mode.el | 15 +++++++--------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b52d3e77fc..38cc65dbad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -29,6 +29,7 @@
- [#52](https://github.com/bbatsov/adoc-mode/issues/52): Prevent
`auto-fill-mode` from breaking section title lines.
- [#36](https://github.com/bbatsov/adoc-mode/issues/36): Remove `unichars.el`
dependency; use built-in `sgml-char-names` instead.
- [#26](https://github.com/bbatsov/adoc-mode/issues/26): Fix `Wrong type
argument: number-or-marker-p` when calling tempo templates with a prefix
argument.
+- [#24](https://github.com/bbatsov/adoc-mode/issues/24): Fix table delimiter
highlighting to support any number of columns (was limited to 4).
## 0.7.0 (2023-03-09)
diff --git a/adoc-mode.el b/adoc-mode.el
index a92e772a53..2f66fbda7d 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -2364,14 +2364,13 @@ for multiline constructs to be matched."
;; ------------------------------
;; must come BEFORE block title, else rows starting like .2+| ... | ... are
taken as
(cons "^|=\\{3,\\}[ \t]*$" 'adoc-table-face ) ; ^\|={3,}$
- (list (concat "^" "\\(" (adoc-re-cell-specifier) "\\)"
"\\(|\\)"
- "\\(?:[^|\n]*?[ \t]" "\\(" (adoc-re-cell-specifier) "\\)"
"\\(|\\)"
- "\\(?:[^|\n]*?[ \t]" "\\(" (adoc-re-cell-specifier) "\\)"
"\\(|\\)"
- "\\(?:[^|\n]*?[ \t]" "\\(" (adoc-re-cell-specifier) "\\)"
"\\(|\\)" "\\)?\\)?\\)?")
- '(1 '(face adoc-delimiter adoc-reserved block-del) nil t) '(2 '(face
adoc-table-face adoc-reserved block-del) nil t)
- '(3 '(face adoc-delimiter adoc-reserved block-del) nil t) '(4 '(face
adoc-table-face adoc-reserved block-del) nil t)
- '(5 '(face adoc-delimiter adoc-reserved block-del) nil t) '(6 '(face
adoc-table-face adoc-reserved block-del) nil t)
- '(7 '(face adoc-delimiter adoc-reserved block-del) nil t) '(8 '(face
adoc-table-face adoc-reserved block-del) nil t))
+ (list (concat "^\\(" (adoc-re-cell-specifier) "\\)\\(|\\)")
+ '(1 '(face adoc-delimiter adoc-reserved block-del) nil t)
+ '(2 '(face adoc-table-face adoc-reserved block-del) nil t)
+ (list (concat "\\(" (adoc-re-cell-specifier) "\\)\\(|\\)")
+ '(save-excursion (end-of-line) (point)) nil
+ '(1 '(face adoc-delimiter adoc-reserved block-del) nil t)
+ '(2 '(face adoc-table-face adoc-reserved block-del) nil t)))
;; attribute entry