branch: elpa/csv2ledger
commit 163559956fa266d23ba1cc2d63ac7a27f5353c1b
Author: Joost Kremers <joostkrem...@fastmail.fm>
Commit: Joost Kremers <joostkrem...@fastmail.fm>

    Change return value of c2l--amount-p.
    
    Instead of returning whatever string-match-p returns, explicitly return the
    string passed to c2l--amount-p. This enable it to be used in constructions 
such
    as:
    
    ```
    (let ((amount (or (c2l--amount-p string1))
                      (c2l--amount-p string2)))
       ...)
    ```
---
 csv2ledger.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/csv2ledger.el b/csv2ledger.el
index fc61eec1ac..d3ffdea79c 100644
--- a/csv2ledger.el
+++ b/csv2ledger.el
@@ -288,7 +288,8 @@ make sure to add one using `c2l-field-parse-functions'."
 
 (defun c2l--amount-p (str)
   "Return non-nil is STR is likely to be an amount."
-  (string-match-p "[0-9]+[0-9.,]*[.,][0-9]\\{2\\}" str))
+  (if (string-match-p "[0-9]+[0-9.,]*[.,][0-9]\\{2\\}" str)
+      str))
 
 (defun c2l-compose-entry (transaction)
   "Create a ledger entry.

Reply via email to