Added menu and keybinding for ledger-post-edit-amount

editing the amount with calc is too cool for school.  I can't believe I didn't see it before.
It is in the docs now as well.
This commit is contained in:
Craig Earls 2013-02-01 22:34:28 -07:00
parent c875de881a
commit 7c618e541d
3 changed files with 19 additions and 10 deletions

View file

@ -2403,6 +2403,7 @@ kill the ledger report buffer
* Manual Entry Support::
* Automagically Adding new entries::
* Clearing Transactions::
* Calculating Values with EMACS Calc::
@end menu
@node Manual Entry Support, Automagically Adding new entries, Working with entries, Working with entries
@ -2487,6 +2488,18 @@ If, for some reason you need to clear a specific posting in the
transaction you can type @code{C-c C-c} and the posting at point will be
toggled.
@node Calculating Values with EMACS Calc, , Clearing Transactions, Working with entries
@subsubsection Calculating Values with EMACS Calc
EMACS come with a very power calculator built in. You can use it to
easily insert calculated amounts directly into your ledger buffer. From
the menu, select @code{Calc on Amount}. Calc will pull the current
amount to the top of the calc stack. Calulate the value as you normally
would with an RPN calculator. When you have the desired value on thetop
of the calc stack, press @code{y}, and calc will insert the value
in place of the previous amount.
@node Reconciling accounts, Generating Reports, Working with entries, Using EMACS
@subsection Reconciling accounts

View file

@ -62,10 +62,6 @@ customizable to ease retro-entry.")
(set (make-local-variable 'pcomplete-termination-string) "")
(let ((map (current-local-map)))
; (define-key map [(control ?c) (control ?a)] '(lambda (account)
; (interactive "sAccount:")
; (if ledger-works
; (ledger-add-entry account))))
(define-key map [(control ?c) (control ?a)] 'ledger-add-entry)
(define-key map [(control ?c) (control ?d)] 'ledger-delete-current-entry)
(define-key map [(control ?c) (control ?y)] 'ledger-set-year)
@ -75,6 +71,7 @@ customizable to ease retro-entry.")
(define-key map [(control ?c) (control ?r)] 'ledger-reconcile)
(define-key map [(control ?c) (control ?s)] 'ledger-sort-region)
(define-key map [(control ?c) (control ?t)] 'ledger-test-run)
(define-key map [(control ?c) (control ?v)] 'ledger-post-edit-amount)
(define-key map [tab] 'pcomplete)
(define-key map [(control ?i)] 'pcomplete)
(define-key map [(control ?c) tab] 'ledger-fully-complete-entry)
@ -86,7 +83,9 @@ customizable to ease retro-entry.")
(define-key map [(control ?c) (control ?o) (control ?e)] 'ledger-report-edit)
(define-key map [(control ?c) (control ?o) (control ?k)] 'ledger-report-kill)
(define-key map [(meta ?p)] 'ledger-post-prev-xact)
(define-key map [(meta ?n)] 'ledger-post-next-xact)
(define-key map [menu-bar] (make-sparse-keymap "ldg-menu"))
(define-key map [menu-bar ldg-menu] (cons "Ledger" map))
@ -106,6 +105,8 @@ customizable to ease retro-entry.")
(define-key map [toggle-post] '(menu-item "Toggle Current Posting" ledger-toggle-current))
(define-key map [toggle-xact] '(menu-item "Toggle Current Transaction" ledger-toggle-current-entry))
(define-key map [sep4] '(menu-item "--"))
(define-key map [edit-amount] '(menu-item "Calc on Amount" ledger-post-edit-amount))
(define-key map [sep] '(menu-item "--"))
(define-key map [delete-xact] '(menu-item "Delete Entry" ledger-delete-current-entry))
(define-key map [add-xact] '(menu-item "Add Entry" ledger-add-entry :enable ledger-works))
(define-key map [sep3] '(menu-item "--"))

View file

@ -183,11 +183,6 @@ This is done so that the last digit falls in COLUMN, which defaults to 52."
(goto-char (match-end ledger-regex-post-line-group-account))))
(defun ledger-post-setup ()
(let ((map (current-local-map)))
(define-key map [(meta ?p)] 'ledger-post-prev-xact)
(define-key map [(meta ?n)] 'ledger-post-next-xact)
(define-key map [(control ?c) (control ?c)] 'ledger-post-pick-account)
(define-key map [(control ?c) (control ?e)] 'ledger-post-edit-amount))
(if ledger-post-auto-adjust-amounts
(add-hook 'after-change-functions 'ledger-post-maybe-align t t))
(add-hook 'after-save-hook #'(lambda () (setq ledger-post-current-list nil))))