summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-02-01 22:34:28 -0700
committerCraig Earls <enderw88@gmail.com>2013-02-01 22:34:28 -0700
commit7c618e541d4c1e5e4ac476b6724abf2ec97a38b2 (patch)
tree88ff79940fc0b0cfdba4432d2e58ae1a961268f8
parentc875de881a3998ec9a9815acded80f381701e711 (diff)
downloadfork-ledger-7c618e541d4c1e5e4ac476b6724abf2ec97a38b2.tar.gz
fork-ledger-7c618e541d4c1e5e4ac476b6724abf2ec97a38b2.tar.bz2
fork-ledger-7c618e541d4c1e5e4ac476b6724abf2ec97a38b2.zip
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.
-rw-r--r--doc/ledger3.texi13
-rw-r--r--lisp/ldg-mode.el11
-rw-r--r--lisp/ldg-post.el5
3 files changed, 19 insertions, 10 deletions
diff --git a/doc/ledger3.texi b/doc/ledger3.texi
index be7d7e98..815c770b 100644
--- a/doc/ledger3.texi
+++ b/doc/ledger3.texi
@@ -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
diff --git a/lisp/ldg-mode.el b/lisp/ldg-mode.el
index c6d899de..c185c198 100644
--- a/lisp/ldg-mode.el
+++ b/lisp/ldg-mode.el
@@ -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 "--"))
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el
index 7cb525a7..14a8cdad 100644
--- a/lisp/ldg-post.el
+++ b/lisp/ldg-post.el
@@ -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))))