Skip to content

Commit

Permalink
ledger-rename-account: Default old-name prompt to account at point
Browse files Browse the repository at this point in the history
Also, default the new-name to be the same as the old-name (so the user can press
M-n and edit the old-name slightly).
  • Loading branch information
bcc32 committed Aug 4, 2024
1 parent d2c8d00 commit a6be7a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ledger-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,12 @@ By default, child accounts of OLD are also renamed to
corresponding child accounts of NEW. With \\[universal-argument]
prefix, child accounts are not renamed. When called from Lisp,
TOPLEVEL-ONLY has the same meaning."
(interactive "sOld name: \nsNew name: \nP")
(interactive
(let* ((old-name
(ledger-read-account-with-prompt "Old name: "))
(new-name
(ledger-read-string-with-default "New name: " old-name)))
(list old-name new-name current-prefix-arg)))
(save-excursion
(goto-char (point-min))
(while (re-search-forward ledger-account-name-or-directive-regex nil t)
Expand Down

0 comments on commit a6be7a2

Please sign in to comment.