[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/beancount 5be04a37d6 081/103: (Merge branch 'main' into co
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/beancount 5be04a37d6 081/103: (Merge branch 'main' into cost) |
Date: |
Mon, 29 Apr 2024 15:59:48 -0400 (EDT) |
branch: elpa/beancount
commit 5be04a37d6a189f1680cb47d022a85d9faeba8fc
Merge: dd024c867b e98047d715
Author: blais <blais@furius.ca>
Commit: blais <blais@furius.ca>
(Merge branch 'main' into cost)
---
.github/workflows/tests.yaml | 21 ++++++++++++
Makefile | 4 +--
beancount-tests.el | 20 +++++++----
beancount.el | 79 ++++++++++++++++++++++++++++++++------------
4 files changed, 94 insertions(+), 30 deletions(-)
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
new file mode 100644
index 0000000000..0d6eb8dc9c
--- /dev/null
+++ b/.github/workflows/tests.yaml
@@ -0,0 +1,21 @@
+name: tests
+
+on:
+ pull_request:
+ push:
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ emacs: ['26.1', '26.2', '26.3', '27.1', '27.2']
+ steps:
+ - uses: purcell/setup-emacs@master
+ with:
+ version: ${{ matrix.emacs }}
+ - run: pip install beancount
+ - uses: actions/checkout@v2
+ - run: make compile
+ - run: make test
diff --git a/Makefile b/Makefile
index e80b067359..22e1c72258 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ SRC = beancount.el
TESTS = beancount-tests.el
compile: $(SRC)
- $(EMACS) -batch -f batch-byte-compile $<
+ $(EMACS) -Q -batch -f batch-byte-compile $<
test:
- $(EMACS) -batch -L . -l ert -l $(TESTS) -f ert-run-tests-batch-and-exit
+ $(EMACS) -Q -batch -L . -l ert -l $(TESTS) -f
ert-run-tests-batch-and-exit
diff --git a/beancount-tests.el b/beancount-tests.el
index 41d7576d96..2dec821e7e 100644
--- a/beancount-tests.el
+++ b/beancount-tests.el
@@ -17,6 +17,7 @@
(require 'ert)
(require 'beancount)
+(require 'imenu)
(ert-deftest beancount/smoke-001 ()
:tags '(regress)
@@ -129,6 +130,15 @@ Return a list of substrings each followed by its face."
"1.00 USD" beancount-amount
"Assets:Checking" beancount-account)))
+(ert-deftest beancount/fontify-005 ()
+ :tags '(font regress)
+ (beancount-test-font-lock "
+2019-01-01 open Assets:TD:TDB900 TDB900
+"
+ '("2019-01-01" beancount-date
+ "open" beancount-directive
+ "Assets:TD:TDB900" beancount-account)))
+
(ert-deftest beancount/indent-001 ()
:tags '(indent regress)
(with-temp-buffer
@@ -230,9 +240,9 @@ known option nmaes."
(font-lock-ensure)
(buffer-string))))
(should (equal (beancount-test-face-groups fontified)
- '("* A" org-level-1
- "** B" org-level-2
- "*** C" org-level-3)))))
+ '("* A" beancount-outline-1
+ "** B" beancount-outline-2
+ "*** C" beancount-outline-3)))))
(ert-deftest beancount/account-currency-001 ()
:tags '(regress)
@@ -308,8 +318,6 @@ known option nmaes."
:tags '(regress thing-at-point)
(with-temp-buffer
(insert "^link")
- (beancount-mode)
- (goto-char 2)
(should (equal (thing-at-point 'beancount-link) "^link"))))
(ert-deftest beancount/link-at-point-002 ()
@@ -322,5 +330,5 @@ known option nmaes."
:tags '(regress thing-at-point)
(with-temp-buffer
(insert "foo ^link baz")
- (goto-char 15)
+ (goto-char 7)
(should (equal (thing-at-point 'beancount-link) "^link"))))
diff --git a/beancount.el b/beancount.el
index a3af7556dd..fa49eb94b5 100644
--- a/beancount.el
+++ b/beancount.el
@@ -34,6 +34,7 @@
(require 'subr-x)
(require 'outline)
(require 'thingatpt)
+(require 'cl-lib)
(defgroup beancount ()
"Editing mode for Beancount files."
@@ -66,49 +67,81 @@ from the open directive for the relevant account."
(defgroup beancount-faces nil "Beancount mode highlighting" :group 'beancount)
(defface beancount-directive
- `((t :inherit font-lock-keyword-face))
+ '((t :inherit font-lock-keyword-face))
"Face for Beancount directives.")
(defface beancount-tag
- `((t :inherit font-lock-type-face))
+ '((t :inherit font-lock-type-face))
"Face for Beancount tags.")
(defface beancount-link
- `((t :inherit font-lock-type-face))
+ '((t :inherit font-lock-type-face))
"Face for Beancount links.")
(defface beancount-date
- `((t :inherit font-lock-constant-face))
+ '((t :inherit font-lock-constant-face))
"Face for Beancount dates.")
(defface beancount-account
- `((t :inherit font-lock-builtin-face))
+ '((t :inherit font-lock-builtin-face))
"Face for Beancount account names.")
(defface beancount-amount
- `((t :inherit font-lock-default-face))
+ '((t :inherit font-lock-default-face))
"Face for Beancount amounts.")
(defface beancount-narrative
- `((t :inherit font-lock-builtin-face))
+ '((t :inherit font-lock-builtin-face))
"Face for Beancount transactions narrative.")
(defface beancount-narrative-cleared
- `((t :inherit font-lock-string-face))
+ '((t :inherit font-lock-string-face))
"Face for Beancount cleared transactions narrative.")
(defface beancount-narrative-pending
- `((t :inherit font-lock-keyword-face))
+ '((t :inherit font-lock-keyword-face))
"Face for Beancount pending transactions narrative.")
(defface beancount-metadata
- `((t :inherit font-lock-type-face))
+ '((t :inherit font-lock-type-face))
"Face for Beancount metadata.")
(defface beancount-highlight
- `((t :inherit highlight))
+ '((t :inherit highlight))
"Face to highlight Beancount transaction at point.")
+(defface beancount-outline-1
+ '((t :inherit outline-1))
+ "Outline level 1.")
+
+(defface beancount-outline-2
+ '((t :inherit outline-2))
+ "Outline level 2.")
+
+(defface beancount-outline-3
+ '((t :inherit outline-3))
+ "Outline level 3.")
+
+(defface beancount-outline-4
+ '((t :inherit outline-4))
+ "Outline level 4.")
+
+(defface beancount-outline-5
+ '((t :inherit outline-5))
+ "Outline level 5.")
+
+(defface beancount-outline-6
+ '((t :inherit outline-6))
+ "Outline level 6.")
+
+(defface beancount-outline-7
+ '((t :inherit outline-7))
+ "Outline level 7.")
+
+(defface beancount-outline-8
+ '((t :inherit outline-8))
+ "Outline level 8.")
+
(defconst beancount-account-directive-names
'("balance"
"close"
@@ -221,7 +254,7 @@ from the open directive for the relevant account."
(defun beancount-outline-level ()
(let ((len (- (match-end 1) (match-beginning 1))))
- (if (equal (substring (match-string 1) 0 1) ";")
+ (if (string-equal (substring (match-string 1) 0 1) ";")
(- len 2)
len)))
@@ -233,13 +266,15 @@ from the open directive for the relevant account."
(defun beancount-outline-face ()
(if outline-minor-mode
(cl-case (funcall outline-level)
- (1 'org-level-1)
- (2 'org-level-2)
- (3 'org-level-3)
- (4 'org-level-4)
- (5 'org-level-5)
- (6 'org-level-6)
- (otherwise nil))
+ (1 'beancount-outline-1)
+ (2 'beancount-outline-2)
+ (3 'beancount-outline-3)
+ (4 'beancount-outline-4)
+ (5 'beancount-outline-5)
+ (6 'beancount-outline-6)
+ (7 'beancount-outline-7)
+ (8 'beancount-outline-8)
+ (otherwise nil))
nil))
(defvar beancount-font-lock-keywords
@@ -254,14 +289,14 @@ from the open directive for the relevant account."
(,beancount-timestamped-directive-regexp (1 'beancount-date)
(2 'beancount-directive))
;; Fontify section headers when composed with outline-minor-mode.
- (,(concat "^\\(" beancount-outline-regexp "\\).*") . (0
(beancount-outline-face)))
+ (,(concat "^\\(" beancount-outline-regexp "\\).*") (0
(beancount-outline-face)))
;; Tags and links.
(,(concat "\\#[" beancount-tag-chars "]*") . 'beancount-tag)
(,(concat "\\^[" beancount-tag-chars "]*") . 'beancount-link)
- ;; Number followed by currency not covered by previous rules.
- (,(concat beancount-number-regexp "\\s-+" beancount-currency-regexp) .
'beancount-amount)
;; Accounts not covered by previous rules.
(,beancount-account-regexp . 'beancount-account)
+ ;; Number followed by currency not covered by previous rules.
+ (,(concat beancount-number-regexp "\\s-+" beancount-currency-regexp) .
'beancount-amount)
))
(defun beancount-tab-dwim (&optional arg)
- [nongnu] elpa/beancount ba6bada870 058/103: beancount.el: Rework imenu support and add tests, (continued)
- [nongnu] elpa/beancount ba6bada870 058/103: beancount.el: Rework imenu support and add tests, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 05d4798156 059/103: (emacs) Added experimental beancount-mode support for running a journal for the account under the cursor., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 7410724924 065/103: beancount-region: Added bindings for region_value variant., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 9508e5640c 060/103: Add README.org, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 3c04745fa5 069/103: Add missing paren to configuration example in README.org, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount dcb317ed0a 064/103: If the cursor is over a link, invoke 'bean-doctor linked' command with the link, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 5ff509075d 063/103: Fixes to /etc, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 7785e8803f 067/103: Improve thing-at-point definition for beancount-link, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 194a9e9697 061/103: Added license., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 90c3992269 076/103: Fix imenu tests, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 5be04a37d6 081/103: (Merge branch 'main' into cost),
ELPA Syncer <=
- [nongnu] elpa/beancount 7b8f02ebcd 077/103: Cleanup faces definitions, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount dbafe6a73d 082/103: Shift beancount-insert-date by DAYS from today using prefix args, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount e32e44e8d2 092/103: Added personal binding to aggregate balance binding., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 73b2afcff6 087/103: (Merge remote-tracking branch 'github/main'), ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 42edc5bf07 083/103: Align amounts in balance directives in the same way as in postings, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 41039a8d7b 085/103: Added support for accounts in thing-at-point., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 3725c02702 103/103: Update account name regex to allow starting with a number, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 77027e2cf8 037/103: beancount.el: Add outline-minor-mode integration tests, ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 83cd9330e3 050/103: beancount.el: Include underscore and dash to metadata regexp., ELPA Syncer, 2024/04/29
- [nongnu] elpa/beancount 8091f35803 056/103: beancount.el: Add beancount-electric-currency, ELPA Syncer, 2024/04/29