@@ -1788,16 +1788,16 @@ Concerning TYPE, LEVEL and SUB-TYPE see `adoc-re-llisti'."
17881788
17891789; ; admonition paragraph. Note that there is also the style with the leading attribute list.
17901790; ; (?s)^\s*(?P<style>NOTE|TIP|IMPORTANT|WARNING|CAUTION):\s+(?P<text>.+)
1791- (defmacro adoc-kw-admonition-paragraph ()
1792- " Creates a keyword which highlights admonition paragraphs"
1793- ` (list
1794- ; ; matcher function
1795- (lambda (end )
1796- (and (adoc-kwf-search " ^[ \t ]*\\ (\\ (?:CAUTION\\ |WARNING\\ |IMPORTANT\\ |TIP\\ |NOTE\\ ):\\ )\\ ([ \t ]+\\ )" end t )
1797- (not (text-property-not-all (match-beginning 0 ) (match-end 0 ) 'adoc-reserved nil ))))
1798- ; ; highlighers
1799- '(1 '(face adoc-complex-replacement-face adoc-reserved t ))
1800- '(2 '(face adoc-align-face adoc-reserved t ))))
1791+ (defun adoc-kw-admonition-paragraph ()
1792+ " Creates a keyword which highlights admonition paragraphs. "
1793+ (list
1794+ ; ; matcher function
1795+ (lambda (end )
1796+ (and (adoc-kwf-search " ^[ \t ]*\\ (\\ (?:CAUTION\\ |WARNING\\ |IMPORTANT\\ |TIP\\ |NOTE\\ ):\\ )\\ ([ \t ]+\\ )" end t )
1797+ (not (text-property-not-all (match-beginning 0 ) (match-end 0 ) 'adoc-reserved nil ))))
1798+ ; ; highlighters
1799+ '(1 '(face adoc-complex-replacement-face adoc-reserved t ))
1800+ '(2 '(face adoc-align-face adoc-reserved t ))))
18011801
18021802(defun adoc-kw-verbatim-paragraph-sequence ()
18031803 " Creates a keyword which highlights a sequence of verbatim paragraphs."
@@ -1929,37 +1929,34 @@ TEXTPROPS is an additional plist with textproperties."
19291929; ; possible. The string inserted with the ovlerlay property after-string gets
19301930; ; the face of the text 'around' it, which is in this case the text following
19311931; ; the replacement.
1932- (defmacro adoc-kw-replacement (regexp &optional replacement )
1932+ (defun adoc-kw-replacement (regexp &optional replacement )
19331933 " Creates a keyword for font-lock which highlights replacements."
1934- `(list
1935- ; ; matcher function
1936- (lambda (end )
1937- (let (found)
1938- (while (and (setq found (adoc-kwf-search , regexp end t ))
1939- (text-property-not-all (match-beginning 1 ) (match-end 1 ) 'adoc-reserved nil ))
1940- (goto-char (+ (match-beginning 0 ) 1 )))
1941- (when (and found adoc-insert-replacement , replacement )
1942- (let* ((s (cond
1943- ((stringp , replacement )
1944- , replacement )
1945- ((functionp , replacement )
1946- (funcall , replacement (match-string-no-properties 1 )))
1947- (t (error " Invalid replacement type " ))))
1948- (o (when (stringp s)
1949- (make-overlay (match-end 1 ) (match-end 1 )))))
1950- (setq adoc-replacement-failed (not o))
1951- (unless adoc-replacement-failed
1952- (overlay-put o 'adoc-kw-replacement t )
1953- (overlay-put o 'after-string s))))
1954- found))
1955-
1956- ; ; highlighers
1957- ; ; TODO: replacement instead warining face if resolver is not given
1958- (if (and adoc-insert-replacement , replacement )
1959- ; ; '((1 (if adoc-replacement-failed adoc-warning-face adoc-hide-delimiter) t)
1960- ; ; (1 '(face nil adoc-reserved t) t))
1961- '(1 '(face adoc-hide-delimiter adoc-reserved t ) t )
1962- '(1 '(face adoc-replacement-face adoc-reserved t ) t ))))
1934+ (list
1935+ ; ; matcher function
1936+ (lambda (end )
1937+ (let (found)
1938+ (while (and (setq found (adoc-kwf-search regexp end t ))
1939+ (text-property-not-all (match-beginning 1 ) (match-end 1 ) 'adoc-reserved nil ))
1940+ (goto-char (+ (match-beginning 0 ) 1 )))
1941+ (when (and found adoc-insert-replacement replacement)
1942+ (let* ((s (cond
1943+ ((stringp replacement)
1944+ replacement)
1945+ ((functionp replacement)
1946+ (funcall replacement (match-string-no-properties 1 )))
1947+ (t (error " Invalid replacement type " ))))
1948+ (o (when (stringp s)
1949+ (make-overlay (match-end 1 ) (match-end 1 )))))
1950+ (setq adoc-replacement-failed (not o))
1951+ (unless adoc-replacement-failed
1952+ (overlay-put o 'adoc-kw-replacement t )
1953+ (overlay-put o 'after-string s))))
1954+ found))
1955+
1956+ ; ; highlighters
1957+ (if (and adoc-insert-replacement replacement)
1958+ '(1 '(face adoc-hide-delimiter adoc-reserved t ) t )
1959+ '(1 '(face adoc-replacement-face adoc-reserved t ) t ))))
19631960
19641961; ; - To ensure that indented lines are nicely aligned. They only look aligned if
19651962; ; the whites at line beginning have a fixed with font.
@@ -2802,7 +2799,7 @@ which can be truthy even without an active region."
28022799
28032800(defun adoc-tempo-define (&rest args )
28042801 (if (eq adoc-tempo-frwk 'tempo-snippets )
2805- (apply # 'tempo-define-snippet args)
2802+ (apply 'tempo-define-snippet args) ; ; optional package, not always available
28062803 (apply #'tempo-define-template args)))
28072804
28082805(defun adoc-template-str-title (&optional level title-text )
0 commit comments