[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/csv2ledger 98ab50c9a7 185/190: New command c2l-read-accoun
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/csv2ledger 98ab50c9a7 185/190: New command c2l-read-account-matchers |
Date: |
Sun, 2 Jun 2024 16:00:01 -0400 (EDT) |
branch: elpa/csv2ledger
commit 98ab50c9a76fdd0b384b23dd8e27f9393c28a335
Author: Joost Kremers <joostkremers@fastmail.com>
Commit: Joost Kremers <joostkremers@fastmail.com>
New command c2l-read-account-matchers
After manually updating the account matchers file, this command can be used
to
reread it.
---
csv2ledger.el | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/csv2ledger.el b/csv2ledger.el
index 5cc915d8ef..122b1eeab5 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -214,7 +214,7 @@ used as the target account.
This variable is normally given a value based on the matchers in
`c2l-account-matchers-file', but it can also be set directly.")
-(defun c2l--read-account-matchers (file)
+(defun c2l--read-account-matchers-file (file)
"Read account matchers from FILE.
See the documentation for the variable
`c2l-account-matchers-file' for details on the matcher file."
@@ -244,15 +244,18 @@ for that account."
(car e)))
(seq-group-by #'cdr accounts)))
-(defun c2l-set-matcher-regexps ()
+(defun c2l-set-matcher-regexps (&optional force)
"Set `c2l-matcher-regexps' based on the file in `c2l-account-matchers-file'.
-If `c2l-matcher-regexps' already has a value, do not change it.
-Return the (new) value of `c2l-matcher-regexps'."
- (or c2l-matcher-regexps
- (setq-local c2l-matcher-regexps
- (thread-first c2l-account-matchers-file
- (c2l--read-account-matchers)
- (c2l--compile-matcher-regexps)))))
+If `c2l-matcher-regexps' already has a value, do not change it,
+unless FORCE is non-nil. Return the (new) value of
+`c2l-matcher-regexps'."
+ (when (or force
+ c2l-matcher-regexps)
+ (setq-local c2l-matcher-regexps
+ (thread-first c2l-account-matchers-file
+ (c2l--read-account-matchers-file)
+ (c2l--compile-matcher-regexps))))
+ c2l-matcher-regexps)
;;;###autoload (put 'c2l-target-match-fields 'safe-local-variable '(lambda (v)
(seq-every-p #'stringp v)))
(defcustom c2l-target-match-fields '(payee description)
@@ -497,6 +500,10 @@ new buffer is created."
(setq c2l--accounts (c2l--read-accounts c2l-accounts-file)))
(setq c2l-base-account (completing-read "Base account for current buffer: "
c2l--accounts)))
+(defun c2l-read-account-matchers ()
+ "(Re)read the account matchers file."
+ (c2l-set-matcher-regexps 'force))
+
;;;###autoload
(defun c2l-csv-entry-as-kill ()
"Convert the current CSV row to a Ledger entry and place it in the kill ring.
- [nongnu] elpa/csv2ledger c1fb4a3255 013/190: Reconcile commits 6023fa3 and 1e4bd7c., (continued)
- [nongnu] elpa/csv2ledger c1fb4a3255 013/190: Reconcile commits 6023fa3 and 1e4bd7c., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 7635ee6fe3 007/190: Update "Created" year in header., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger b4f6fac379 002/190: Add .gitignore, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 6023fa373b 012/190: Use lower-case column names in `c2l-csv-columns`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger a4ded4f5dc 109/190: Change the default value of c2l-csv-columns to the empty list., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 170dc4ae5c 102/190: Update README.md, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 07281e2558 097/190: Update to the README., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger f234878bd2 180/190: Update to the README, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 3b203a66e1 118/190: Improve code layout., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 64da760597 119/190: Update copyright year., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 98ab50c9a7 185/190: New command c2l-read-account-matchers,
ELPA Syncer <=
- [nongnu] elpa/csv2ledger e744d0706f 186/190: Update version number., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 188ddacde7 057/190: Rename target account to balancing account., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger a1b0dd35e1 053/190: Update README., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 88c394d5bb 066/190: Rename c2l-payee-or-sender to c2l-title-is-payee-or-sender., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger e8a7609736 050/190: Add user option `c2l-alignment-column`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 0af0aa3de2 021/190: Rename `c2l-parse-date` and update doc string., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 900eef1457 017/190: Move definition of `c2l-account-matchers-file`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger c5b7b0766e 024/190: Rewrite `c2l-compose-entry` and `c2l-csv-line-to-ledger`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 6597b8cd22 003/190: Initial commit of csv2ledger.el, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 1ce1fe5297 005/190: Remove BSD license from header, point to GNU license., ELPA Syncer, 2024/06/03