Skip to content

WIP: feat(xact): add default time when copying transaction #281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ledger-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,12 @@
(regexp-quote account))
(ledger-accounts-list))))

(defun ledger-read-date (prompt)
(defun ledger-read-date (prompt &optional default-time)
"Return user-supplied date after `PROMPT', defaults to today.
This uses `org-read-date', which see."
(ledger-format-date (let ((org-read-date-prefer-future nil))
(org-read-date nil t nil prompt))))
(ledger-format-date (let ((org-read-date-prefer-future nil)
(org-extend-today-until 0))
(org-read-date nil t nil prompt default-time))))

(defun ledger-get-minibuffer-prompt (prompt default)
"Return a minibuffer prompt string composing PROMPT and DEFAULT."
Expand Down
4 changes: 3 additions & 1 deletion ledger-xact.el
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ MOMENT is an encoded date"
"Ask for a new DATE and copy the transaction under point to that date.
Leave point on the first amount."
(interactive (list
(ledger-read-date "Copy to date: ")))
(ledger-read-date "Copy to date: "
(ledger-parse-iso-date
(ledger-xact-date)))))
(let* ((extents (ledger-navigate-find-xact-extents (point)))
(transaction (buffer-substring-no-properties (car extents) (cadr extents)))
(encoded-date (ledger-parse-iso-date date)))
Expand Down