diff options
author | Moritz Ulrich <moritz@tarn-vedra.de> | 2014-01-02 18:24:54 +0100 |
---|---|---|
committer | Moritz Ulrich <moritz@tarn-vedra.de> | 2014-01-02 18:24:54 +0100 |
commit | 3ff5fddafd6bff3c0768eeae032f7eb6ab32db5b (patch) | |
tree | 2ed0025915fe3ad30549c823ee8e4090c1a6a2e5 /lisp | |
parent | 876cfa1f78d4c036332f3d918a88817fe72353e4 (diff) | |
download | fork-ledger-3ff5fddafd6bff3c0768eeae032f7eb6ab32db5b.tar.gz fork-ledger-3ff5fddafd6bff3c0768eeae032f7eb6ab32db5b.tar.bz2 fork-ledger-3ff5fddafd6bff3c0768eeae032f7eb6ab32db5b.zip |
Add `ledger-read-date' - Read date & default to today.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ledger-mode.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el index 0d683168..e18529c9 100644 --- a/lisp/ledger-mode.el +++ b/lisp/ledger-mode.el @@ -99,6 +99,17 @@ nil))) (ledger-read-string-with-default prompt default))) +(defun ledger-read-date (prompt) + "Returns user-supplied date after `PROMPT', defaults to today." + (let* ((default (ledger-year-and-month)) + (date (read-string prompt default))) + (if (or (string= date default) + (string= "" date)) + (format-time-string + (or (cdr (assoc "date-format" ledger-environment-alist)) + ledger-default-date-format)) + date))) + (defun ledger-read-string-with-default (prompt default) "Return user supplied string after PROMPT, or DEFAULT." (read-string (concat prompt |