diff options
author | Craig Earls <enderw88@gmail.com> | 2013-04-06 23:13:49 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-04-06 23:13:49 -0700 |
commit | 4df990014fede0c7b0c23396f32b1f2c7c636426 (patch) | |
tree | ec695fcacfffd67a6cb8e052830f433fdb8cd1b7 /lisp/ldg-complete.el | |
parent | 2f3053401a043495860d6d6ee1febe48c3b537aa (diff) | |
download | fork-ledger-4df990014fede0c7b0c23396f32b1f2c7c636426.tar.gz fork-ledger-4df990014fede0c7b0c23396f32b1f2c7c636426.tar.bz2 fork-ledger-4df990014fede0c7b0c23396f32b1f2c7c636426.zip |
Fixed reconciliation initialization. Now prompts with only account, not status and amount
Moved context function to leg-context, from leg-report. Cleaned up many regex in ldg-context.
Diffstat (limited to 'lisp/ldg-complete.el')
-rw-r--r-- | lisp/ldg-complete.el | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/lisp/ldg-complete.el b/lisp/ldg-complete.el index f01e6e90..bd907bc8 100644 --- a/lisp/ldg-complete.el +++ b/lisp/ldg-complete.el @@ -30,9 +30,12 @@ (defun ledger-parse-arguments () "Parse whitespace separated arguments in the current region." - (let* ((info (save-excursion - (cons (ledger-thing-at-point) (point)))) - (begin (cdr info)) + ;; this is more complex than it appears to need, so that it can work + ;; with pcomplete. See pcomplete-parse-arguments-function for + ;; details + (let* ((begin (save-excursion + (ledger-thing-at-point) ;; leave point at beginning of thing under point + (point))) (end (point)) begins args) (save-excursion @@ -45,6 +48,7 @@ args))) (cons (reverse args) (reverse begins))))) + (defun ledger-payees-in-buffer () "Scan buffer and return list of all payees." (let ((origin (point)) @@ -77,12 +81,12 @@ Return tree structure" (match-string-no-properties 2) ":")) (let ((root account-tree)) (while account-elements - (let ((entry (assoc (car account-elements) root))) - (if entry - (setq root (cdr entry)) - (setq entry (cons (car account-elements) (list t))) - (nconc root (list entry)) - (setq root (cdr entry)))) + (let ((xact (assoc (car account-elements) root))) + (if xact + (setq root (cdr xact)) + (setq xact (cons (car account-elements) (list t))) + (nconc root (list xact)) + (setq root (cdr xact)))) (setq account-elements (cdr account-elements))))))) account-tree)) @@ -93,11 +97,11 @@ Return tree structure" (root (ledger-find-accounts-in-buffer)) (prefix nil)) (while (cdr elements) - (let ((entry (assoc (car elements) root))) - (if entry + (let ((xact (assoc (car elements) root))) + (if xact (setq prefix (concat prefix (and prefix ":") (car elements)) - root (cdr entry)) + root (cdr xact)) (setq root nil elements nil))) (setq elements (cdr elements))) (and root @@ -136,7 +140,7 @@ Return tree structure" (throw 'pcompleted t))) (ledger-accounts))))) -(defun ledger-fully-complete-entry () +(defun ledger-fully-complete-xact () "Completes a transaction if there is another matching payee in the buffer. Does not use ledger xact" (interactive) |