From ba334ab67cd6142446e07059253c608073999f45 Mon Sep 17 00:00:00 2001 From: Tobias Zawada Date: Mon, 12 Feb 2024 04:07:34 +0100 Subject: [PATCH] Fall back to general fontification of source blocks if lang attr is not given --- adoc-mode.el | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 613301b..1df657c 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -2109,9 +2109,10 @@ Group 2 contains the block delimiter.") "Search for next adoc-code block up to LAST. NOERROR is the same as for `search-forward'. -Return the source block language and +Return a string with the source block language and set match data if a source block is found. -Otherwise return nil. +If the source block is given without the language attribute return t. +If no source block is found return nil. The overall match data begins at the header of the code block and ends at the end of the @@ -2167,9 +2168,11 @@ Use this function as matching function MATCHER in `font-lock-keywords'." (end-src (match-end 1)) (end-src+nl (if (eq (char-after end-src) ?\n) (1+ end-src) end-src)) (size (1+ (- end-src start-src)))) - (if (if (numberp adoc-fontify-code-blocks-natively) - (<= size adoc-fontify-code-blocks-natively) - adoc-fontify-code-blocks-natively) + (if (and + (if (numberp adoc-fontify-code-blocks-natively) + (<= size adoc-fontify-code-blocks-natively) + adoc-fontify-code-blocks-natively) + (stringp lang)) (adoc-fontify-code-block-natively lang start-block end-block start-src end-src) (add-text-properties start-src