Account auto formatting now works with tab completion

This commit is contained in:
Craig Earls 2013-03-06 21:13:06 -05:00
parent 81eeb210e8
commit 27d27ecb6c
4 changed files with 16 additions and 13 deletions

View file

@ -145,16 +145,17 @@ Return tree structure"
"Completes a transaction if there is another matching payee in the buffer.
Does not use ledger xact"
(interactive)
(let ((name (caar (ledger-parse-arguments)))
rest-of-name
(let* ((name (caar (ledger-parse-arguments)))
(rest-of-name name)
xacts)
(save-excursion
(when (eq 'transaction (ledger-thing-at-point))
(delete-region (point) (+ (length name) (point)))
;; Search backward for a matching payee
(when (re-search-backward
(concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+"
(regexp-quote name) ) nil t) ;; "\\(\t\\|\n\\| [ \t]\\)"
(setq rest-of-name (buffer-substring-no-properties (match-end 0) (line-end-position)))
(concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+\\(.*"
(regexp-quote name) ".*\\)" ) nil t) ;; "\\(\t\\|\n\\| [ \t]\\)"
(setq rest-of-name (match-string 3))
;; Start copying the postings
(forward-line)
(while (looking-at "^\\s-+")

View file

@ -133,10 +133,15 @@ the account"
(setq column ledger-post-amount-alignment-column))
(save-excursion
;; Position the account
;; (beginning-of-line)
(set-mark (point))
;; (delete-horizontal-space)
;; (insert ledger-default-acct-transaction-indent)
(if (not
(and (looking-at "[ \t]+\n")
(looking-back "[ \n]" (- (point) 2))))
(progn
(beginning-of-line)
(set-mark (point))
(delete-horizontal-space)
(insert ledger-default-acct-transaction-indent))
(set-mark (point)))
(goto-char (1+ (line-end-position)))
(let* ((mark-first (< (mark) (point)))
(begin (if mark-first (mark) (point)))

View file

@ -397,7 +397,7 @@ POSTING is used in `ledger-clear-whole-transactions' is nil."
(defvar ledger-reconcile-mode-abbrev-table)
(defun ledger-reconcile-change-target ()
"Change the traget amount for the reconciliation process."
"Change the target amount for the reconciliation process."
(interactive)
(setq ledger-target (ledger-read-commodity-string "Set reconciliation target")))

View file

@ -118,9 +118,6 @@ within the transaction."
(replace-match date)
(re-search-forward "[1-9][0-9]+\.[0-9]+")))
(provide 'ldg-xact)
(provide 'ldg-xact)
;;; ldg-xact.el ends here