Skip to content

Commit

Permalink
Merge pull request #390 from bcc32/fix-calc-window-height-changing
Browse files Browse the repository at this point in the history
Fix calc-window-height decreasing each time ledger-post-edit-amount is called
  • Loading branch information
purcell authored Jan 7, 2024
2 parents 34ccac0 + 6aaa363 commit c0e58e8
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions ledger-post.el
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ regular text."
(t (call-interactively 'ledger-post-align-xact))))

(defun ledger-post-edit-amount ()
"Call `calc' and push the amount in the posting to the top of stack, if any."
"Call `calc' and push the amount in the posting to the top of stack, if any.
In the calc buffer, press y to use the top value in the stack as
the amount and return to ledger."
(interactive)
(beginning-of-line)
(when (re-search-forward ledger-post-line-regexp (line-end-position) t)
Expand All @@ -181,14 +184,7 @@ regular text."
(end-of-line)
(insert " "))
(push-mark (point) 'nomsg)
(calc))

;; Preserve calc's own welcome message, if any, and append our own.
(message "%s%s"
(if-let (msg (current-message))
(concat msg "\n\n")
"")
(substitute-command-keys "Press \\[universal-argument] \\[calc-copy-to-buffer] to use the top of stack as the new amount."))))
(calc))))

(provide 'ledger-post)

Expand Down

0 comments on commit c0e58e8

Please sign in to comment.