branch: elpa/adoc-mode
commit 85532b60322c838af6e6bfcb099c5d4ef31834ac
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Fix outline level calculation and forced line break highlighting
Set a custom outline-level function that counts only the leading
`=` characters, so extra whitespace after them doesn't inflate
the heading level.
Convert the forced line break keyword to use adoc-kwf-std so it
properly checks the adoc-reserved text property and doesn't
highlight inside reserved regions.
---
CHANGELOG.md | 2 ++
adoc-mode.el | 11 ++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48869f3327..2d4f839d0d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,8 @@
- [#39](https://github.com/bbatsov/adoc-mode/issues/39): Support spaces in the
attributes of code blocks.
- [#41](https://github.com/bbatsov/adoc-mode/issues/41): Fix unconstrained
monospace delimiters.
- [#49](https://github.com/bbatsov/adoc-mode/issues/49): Prevent Flyspell from
generating overlays for links and alike.
+- Fix `outline-level` calculation for headings with extra whitespace after `=`.
+- Fix forced line break (`+`) highlighting inside reserved regions.
## 0.7.0 (2023-03-09)
diff --git a/adoc-mode.el b/adoc-mode.el
index 0f8b6a78e5..b3c40e425c 100644
--- a/adoc-mode.el
+++ b/adoc-mode.el
@@ -2584,7 +2584,8 @@ Use this function as matching function MATCHER in
`font-lock-keywords'."
;; end of a non-blank line forces a line break.
;; Asciidoc bug: If has that affect also on a non blank line.
;; TODO: what kind of element is that? Really text formatting? Its not in
asciidoc.conf
- (list "^.*[^ \t\n].*[ \t]\\(\\+\\)[ \t]*$" '(1 adoc-delimiter)) ; bug: only
if not adoc-reserved
+ (list (lambda (end) (adoc-kwf-std end "^.*[^ \t\n].*[ \t]\\(\\+\\)[ \t]*$"
'(1)))
+ '(1 adoc-delimiter))
;; -- callout anchors (references are within list)
;; commented out because they are only within (literal?) blocks
@@ -3738,11 +3739,11 @@ Turning on Adoc mode runs the normal hook
`adoc-mode-hook'."
(setq-local font-lock-extend-after-change-region-function
#'adoc-font-lock-extend-after-change-region)
;; outline mode
- ;; BUG: if there are many spaces\tabs after =, level becomes wrong
- ;; Ideas make it work for two line titles: Investigate into
- ;; outline-heading-end-regexp. It seams like outline-regexp could also
contain
- ;; newlines.
(setq-local outline-regexp "=\\{1,5\\}[ \t]+[^ \t\n]")
+ (setq-local outline-level (lambda ()
+ (save-excursion
+ (skip-chars-forward "=")
+ (current-column))))
;; misc
(setq-local page-delimiter "^<<<+$")