mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-08 15:23:35 -05:00
feat(beancount): support lines only read by linter
Adds support for meta lines that only the flymake linter will see. These are lines prefixed by any number of semicolons followed by a hash then space. E.g. ;# include "../config.beancount" ;# 2025-01-01 pad Assets:Bank Equity:Opening-Balances This is useful for silencing the linter in multi-file beancount projects rather than suffer the usual deluge of multiple-include errors and redundancies.
This commit is contained in:
@@ -44,18 +44,23 @@
|
||||
(widen)
|
||||
(with-temp-buffer
|
||||
(save-excursion (insert-buffer-substring source))
|
||||
(while (re-search-forward (rx bol
|
||||
(or (seq (= 4 num) "-" (= 2 num) "-" (= 2 num) (+ " ")
|
||||
"document" (+ " ")
|
||||
(+ (or alnum ":" "_" "-")))
|
||||
"include"
|
||||
(seq "option" (+ " ") "\"documents\""))
|
||||
(+ " ") "\""
|
||||
(group (+ (not "\""))))
|
||||
nil t)
|
||||
(replace-match (expand-file-name
|
||||
(match-string-no-properties 1))
|
||||
t t nil 1))
|
||||
(save-excursion
|
||||
(while (re-search-forward "^;+# " nil t)
|
||||
(replace-match "" t t)))
|
||||
(while (re-search-forward
|
||||
(rx bol
|
||||
(or (seq (= 4 num) "-" (= 2 num) "-" (= 2 num) (+ " ")
|
||||
"document" (+ " ")
|
||||
(+ (or alnum ":" "_" "-")))
|
||||
"include"
|
||||
(seq "option" (+ " ") "\"documents\""))
|
||||
(+ " ") "\""
|
||||
(group (+ (not "\""))))
|
||||
nil t)
|
||||
(unless (file-name-absolute-p (match-string-no-properties 1))
|
||||
(replace-match (expand-file-name
|
||||
(match-string-no-properties 1))
|
||||
t t nil 1)))
|
||||
(buffer-substring-no-properties (point-min) (point-max)))))
|
||||
(process-send-eof flymake-bean-check-process)))
|
||||
|
||||
|
Reference in New Issue
Block a user