From e604fe5cbb50a70d9c938c5076b2f971145328ec Mon Sep 17 00:00:00 2001 From: George Kettleborough Date: Sat, 13 Apr 2013 21:57:03 +0100 Subject: Allow completion on accounts and metadata --- lisp/ldg-mode.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lisp/ldg-mode.el') diff --git a/lisp/ldg-mode.el b/lisp/ldg-mode.el index 4bc195ed..86889dda 100644 --- a/lisp/ldg-mode.el +++ b/lisp/ldg-mode.el @@ -68,13 +68,18 @@ And calculate the target-delta of the account being reconciled." (message balance)))) (defun ledger-magic-tab (&optional interactively) - "Decide what to with with . -Can be pcomplete, or align-posting" + "Decide what to with with . +Can indent, complete or align depending on context." (interactive "p") - (if (and (> (point) 1) - (looking-back "[:A-Za-z0-9]" 1)) - (ledger-pcomplete interactively) - (ledger-post-align-postings))) + (when (= (point) (line-end-position)) + (if (= (point) (line-beginning-position)) + (indent-to ledger-post-account-alignment-column) + (save-excursion + (re-search-backward ledger-account-or-metadata-regex + (line-beginning-position) t)) + (when (= (point) (match-end 0)) + (ledger-pcomplete interactively)))) + (ledger-post-align-postings)) (defvar ledger-mode-abbrev-table) -- cgit v1.2.3