summaryrefslogtreecommitdiff
path: root/lisp/ldg-complete.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-03-06 21:13:06 -0500
committerCraig Earls <enderw88@gmail.com>2013-03-06 21:13:06 -0500
commit27d27ecb6c5be3a9523fd4efc895b6d0b2a6cfb4 (patch)
tree35e45d46c2cfd17953a522f52106d9c0e17925f4 /lisp/ldg-complete.el
parent81eeb210e8e2b33077624fd9d0fd3ef63837701a (diff)
downloadfork-ledger-27d27ecb6c5be3a9523fd4efc895b6d0b2a6cfb4.tar.gz
fork-ledger-27d27ecb6c5be3a9523fd4efc895b6d0b2a6cfb4.tar.bz2
fork-ledger-27d27ecb6c5be3a9523fd4efc895b6d0b2a6cfb4.zip
Account auto formatting now works with tab completion
Diffstat (limited to 'lisp/ldg-complete.el')
-rw-r--r--lisp/ldg-complete.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/ldg-complete.el b/lisp/ldg-complete.el
index 3686d0fd..6607d372 100644
--- a/lisp/ldg-complete.el
+++ b/lisp/ldg-complete.el
@@ -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-+")