summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMoritz Ulrich <moritz@tarn-vedra.de>2014-01-02 18:43:53 +0100
committerMoritz Ulrich <moritz@tarn-vedra.de>2014-01-02 18:43:53 +0100
commit26bc890d882586e808b9def9ddf68a752b4c8e18 (patch)
tree545e7a0b1fb9cc280822762965fd9bd06fcfa0a7 /lisp
parent3ff5fddafd6bff3c0768eeae032f7eb6ab32db5b (diff)
downloadfork-ledger-26bc890d882586e808b9def9ddf68a752b4c8e18.tar.gz
fork-ledger-26bc890d882586e808b9def9ddf68a752b4c8e18.tar.bz2
fork-ledger-26bc890d882586e808b9def9ddf68a752b4c8e18.zip
`ledger-insert-effective-date': use `ledger-read-date'.
Running `ledger-insert-effective-date' will now prompt for a date with a pre-filled value of the `(ledger-year-and-month)' ("2014/01/"). Just pressing RET without inserting the 'day'-portion will insert the date of today.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-mode.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index e18529c9..4edd745f 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -184,22 +184,21 @@ Can indent, complete or align depending on context."
nil 'noerr)
(replace-match ""))))))))
-(defun ledger-insert-effective-date (&optional arg)
- "Insert an effective date to the transaction or posting.
+(defun ledger-insert-effective-date (&optional date)
+ "Insert effective date `DATE' to the transaction or posting.
+
+If `DATE' is nil, prompt the user a date.
Replace the current effective date if there's one in the same
line.
With a prefix argument, remove the effective date. "
- (interactive "P")
- (if (and (listp arg)
- (= 4 (prefix-numeric-value arg)))
+ (interactive)
+ (if (and (listp current-prefix-arg)
+ (= 4 (prefix-numeric-value current-prefix-arg)))
(ledger-remove-effective-date)
(let* ((context (car (ledger-context-at-point)))
- (date-format (or
- (cdr (assoc "date-format" ledger-environment-alist))
- ledger-default-date-format))
- (date-string (format-time-string date-format)))
+ (date-string (or date (ledger-read-date "Effective date: "))))
(save-restriction
(narrow-to-region (point-at-bol) (point-at-eol))
(cond