Merge branch 'next' into ledger-mode-automatic-transactions
This commit is contained in:
commit
a3c958a191
4 changed files with 6 additions and 3 deletions
|
|
@ -1559,7 +1559,7 @@ whose market value disregards any future changes in the price of
|
||||||
gasoline.
|
gasoline.
|
||||||
|
|
||||||
If you do not want price fixing, you can specify this same transaction
|
If you do not want price fixing, you can specify this same transaction
|
||||||
in one of two ways, both equivalent (note the lack of the equal sing
|
in one of two ways, both equivalent (note the lack of the equal sign
|
||||||
from the transaction above):
|
from the transaction above):
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@
|
||||||
This only has effect interfacing to calc mode in edit amount"
|
This only has effect interfacing to calc mode in edit amount"
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'ledger)
|
:group 'ledger)
|
||||||
|
|
||||||
(defun ledger-split-commodity-string (str)
|
(defun ledger-split-commodity-string (str)
|
||||||
"Split a commoditized amount into two parts"
|
"Split a commoditized amount into two parts"
|
||||||
(let (val
|
(let (val
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(require 'cl))
|
(require 'cl))
|
||||||
|
|
||||||
|
(defvar ledger-date-regex "\\([0-9]+\\)[/-]\\([0-9]+\\)[/-]\\([0-9]+\\)")
|
||||||
|
|
||||||
(defmacro ledger-define-regexp (name regex docs &rest args)
|
(defmacro ledger-define-regexp (name regex docs &rest args)
|
||||||
"Simplify the creation of a Ledger regex and helper functions."
|
"Simplify the creation of a Ledger regex and helper functions."
|
||||||
(let ((defs
|
(let ((defs
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ within the transaction."
|
||||||
(extents (ledger-find-xact-extents (point)))
|
(extents (ledger-find-xact-extents (point)))
|
||||||
(transaction (buffer-substring (car extents) (cadr extents)))
|
(transaction (buffer-substring (car extents) (cadr extents)))
|
||||||
encoded-date)
|
encoded-date)
|
||||||
(if (string-match "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)" date)
|
(if (string-match ledger-date-regex date)
|
||||||
(setq encoded-date
|
(setq encoded-date
|
||||||
(encode-time 0 0 0 (string-to-number (match-string 3 date))
|
(encode-time 0 0 0 (string-to-number (match-string 3 date))
|
||||||
(string-to-number (match-string 2 date))
|
(string-to-number (match-string 2 date))
|
||||||
|
|
@ -114,7 +114,7 @@ within the transaction."
|
||||||
(ledger-find-slot encoded-date)
|
(ledger-find-slot encoded-date)
|
||||||
(insert transaction "\n")
|
(insert transaction "\n")
|
||||||
(backward-paragraph)
|
(backward-paragraph)
|
||||||
(re-search-forward "\\([0-9]+\\)/\\([0-9]+\\)/\\([0-9]+\\)")
|
(re-search-forward ledger-date-regex)
|
||||||
(replace-match date)
|
(replace-match date)
|
||||||
(re-search-forward "[1-9][0-9]+\.[0-9]+")))
|
(re-search-forward "[1-9][0-9]+\.[0-9]+")))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue