[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/csv2ledger 7cc0cd1a0a 029/190: Warn if trying to read a fi
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/csv2ledger 7cc0cd1a0a 029/190: Warn if trying to read a file that cannot be found. |
Date: |
Sun, 2 Jun 2024 15:59:43 -0400 (EDT) |
branch: elpa/csv2ledger
commit 7cc0cd1a0a444ee9cb48a8826cf36edb2aefeae1
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>
Warn if trying to read a file that cannot be found.
---
csv2ledger.el | 48 +++++++++++++++++++++++++-----------------------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/csv2ledger.el b/csv2ledger.el
index d680283609..3772b02966 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -202,34 +202,36 @@ reversed. FROM and TO default to `c2l-fallback-account'
and
(defun c2l-read-accounts (file)
"Read list of accounts from FILE."
- (when (and (stringp file)
- (file-readable-p file))
- (with-temp-buffer
- (insert-file-contents file)
- (goto-char (point-min))
- (let (accounts)
- (while (not (eobp))
- (if (looking-at "^account \\([[:print:]]+\\)$")
- (push (match-string 1) accounts))
- (forward-line 1))
- accounts))))
+ (when (stringp file)
+ (if (file-readable-p file)
+ (with-temp-buffer
+ (insert-file-contents file)
+ (goto-char (point-min))
+ (let (accounts)
+ (while (not (eobp))
+ (if (looking-at "^account \\([[:print:]]+\\)$")
+ (push (match-string 1) accounts))
+ (forward-line 1))
+ accounts))
+ (user-error "Accounts file `%s' not found" file))))
(defun c2l-read-account-matchers (file)
"Read account matchers from FILE.
See the documentation for the variable
`c2l-account-matchers-file' for details on the matcher file."
- (when (and (stringp file)
- (file-readable-p file))
- (with-temp-buffer
- (insert-file-contents file)
- (goto-char (point-min))
- (let (accounts)
- (while (looking-at "\\([[:print:]]+\\)\t\\([[:print:]]+\\)")
- (let ((matcher (match-string 1))
- (account (match-string 2)))
- (push (cons matcher account) accounts))
- (forward-line 1))
- accounts))))
+ (when (stringp file)
+ (if (file-readable-p file)
+ (with-temp-buffer
+ (insert-file-contents file)
+ (goto-char (point-min))
+ (let (accounts)
+ (while (looking-at "\\([[:print:]]+\\)\t\\([[:print:]]+\\)")
+ (let ((matcher (match-string 1))
+ (account (match-string 2)))
+ (push (cons matcher account) accounts))
+ (forward-line 1))
+ accounts))
+ (user-error "Account matcher file `%s' not found" file))))
(defun c2l-compile-matcher-regexes (accounts)
"Create efficient regular expressions for the matchers in ACCOUNTS.
- [nongnu] elpa/csv2ledger 88c394d5bb 066/190: Rename c2l-payee-or-sender to c2l-title-is-payee-or-sender., (continued)
- [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
- [nongnu] elpa/csv2ledger f19910d17b 099/190: Add option c2l-entry-function., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger aa55c01cc1 106/190: New user option c2l-transaction-modify-functions., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger d1910389f1 100/190: Rename c2l-title-is-payee-or-sender to c2l-payee-or-sender., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 7cc0cd1a0a 029/190: Warn if trying to read a file that cannot be found.,
ELPA Syncer <=
- [nongnu] elpa/csv2ledger 59ba841805 086/190: Guard against empty payee and sender in c2l-title-is-payee-or-sender, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 6076653a0f 084/190: Rename local variable in c2l--csv-line-to-ledger., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger af1129653d 178/190: Make auto-clearing of transactions with effective date optional., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 66d5a39b99 116/190: Replace point-at-{bol|eol} with pos-{bol|eol}., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 3925c6b34a 113/190: Small fixes to the README., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger e6a7312467 112/190: Small updates to the README., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger cc5050faaf 117/190: Fix doc string for c2l-create-amount, ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger d00914d9f1 044/190: c2l-csv-line-to-ledger: Check c2l-fallback-account before asking the user., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 466a098d2b 034/190: Extract new function `c2l-get-current-row` from `c2l-csv-entry-as-kill`., ELPA Syncer, 2024/06/03
- [nongnu] elpa/csv2ledger 799beb345b 035/190: New function `c2l-has-header`., ELPA Syncer, 2024/06/03