summaryrefslogtreecommitdiff
path: root/lisp/ldg-complete.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-03-09 12:27:08 -0500
committerCraig Earls <enderw88@gmail.com>2013-03-09 12:27:08 -0500
commitca99c0de03432393aa6576244005c9ad8806fa29 (patch)
treebf0dd4586adb4b7df1adad8a5eff5d2bca36f4e3 /lisp/ldg-complete.el
parent4c608cccd0c6f06f403882dcca36cb62a40178a2 (diff)
parentbfe360d4c992caf2e7da09ab058599c0404f1348 (diff)
downloadfork-ledger-ca99c0de03432393aa6576244005c9ad8806fa29.tar.gz
fork-ledger-ca99c0de03432393aa6576244005c9ad8806fa29.tar.bz2
fork-ledger-ca99c0de03432393aa6576244005c9ad8806fa29.zip
Merge branch 'next' into ledger-mode-automatic-transactions
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-+")