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.
This commit is contained in:
parent
3ff5fddafd
commit
26bc890d88
1 changed files with 8 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue