extend anchored matches past the current line if \ broken
This commit is contained in:
parent
839094df0e
commit
23c0caf214
20
systemd.el
20
systemd.el
@ -266,6 +266,14 @@ file, defaulting to the link under point, if any."
|
|||||||
(1 (when (systemd-construct-start-p) (string-to-syntax "<")))))
|
(1 (when (systemd-construct-start-p) (string-to-syntax "<")))))
|
||||||
start end)))
|
start end)))
|
||||||
|
|
||||||
|
(defun systemd-value-extend-region ()
|
||||||
|
"Return the EOL position of the last line of the construct at point."
|
||||||
|
(while (and (= (char-before (line-end-position)) ?\\)
|
||||||
|
(skip-chars-forward " \t")
|
||||||
|
(not (memq (following-char) '(?# ?\;)))
|
||||||
|
(zerop (forward-line))))
|
||||||
|
(line-end-position))
|
||||||
|
|
||||||
(defun systemd-font-lock-extend-region ()
|
(defun systemd-font-lock-extend-region ()
|
||||||
(goto-char font-lock-beg)
|
(goto-char font-lock-beg)
|
||||||
(while (and (zerop (forward-line -1))
|
(while (and (zerop (forward-line -1))
|
||||||
@ -274,11 +282,7 @@ file, defaulting to the link under point, if any."
|
|||||||
(not (memq (following-char) '(?# ?\;)))))
|
(not (memq (following-char) '(?# ?\;)))))
|
||||||
(setq font-lock-beg (point-marker))
|
(setq font-lock-beg (point-marker))
|
||||||
(goto-char font-lock-end)
|
(goto-char font-lock-end)
|
||||||
(while (and (= (char-before (line-end-position)) ?\\)
|
(setq font-lock-end (systemd-value-extend-region)))
|
||||||
(skip-chars-forward " \t")
|
|
||||||
(not (memq (following-char) '(?# ?\;)))
|
|
||||||
(zerop (forward-line))))
|
|
||||||
(setq font-lock-end (line-end-position)))
|
|
||||||
|
|
||||||
(defmacro define-systemd-matcher (name regexp &optional docstring)
|
(defmacro define-systemd-matcher (name regexp &optional docstring)
|
||||||
"Define a new function NAME that matches REGEXP in a multi-line construct.
|
"Define a new function NAME that matches REGEXP in a multi-line construct.
|
||||||
@ -330,9 +334,11 @@ See `font-lock-keywords' and (info \"(elisp) Search-based Fontification\")."
|
|||||||
(systemd-exec-prefix-anchored-matcher
|
(systemd-exec-prefix-anchored-matcher
|
||||||
nil nil (0 'font-lock-negation-char-face))
|
nil nil (0 'font-lock-negation-char-face))
|
||||||
;; environment variables
|
;; environment variables
|
||||||
("\\$[A-Z_]+\\>" nil nil (0 'font-lock-variable-name-face))
|
("\\$[A-Z_]+\\>"
|
||||||
|
(systemd-value-extend-region) nil (0 'font-lock-variable-name-face))
|
||||||
;; specifiers
|
;; specifiers
|
||||||
("%[nNpPiIfcrRtuUhsmbHv%]" nil nil (0 'font-lock-constant-face))))
|
("%[nNpPiIfcrRtuUhsmbHv%]"
|
||||||
|
(systemd-value-extend-region) nil (0 'font-lock-constant-face))))
|
||||||
"Extended expressions to highlight in `systemd-mode'.")
|
"Extended expressions to highlight in `systemd-mode'.")
|
||||||
|
|
||||||
(defconst systemd-font-lock-keywords-3
|
(defconst systemd-font-lock-keywords-3
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user