Make sure ledger-fully-complete-entry copies the rest of the payee line

This commit is contained in:
Craig Earls 2013-02-16 08:56:25 -07:00
parent d37a369c12
commit 0357f92f81

View file

@ -146,13 +146,17 @@ Return tree structure"
Does not use ledger xact" Does not use ledger xact"
(interactive) (interactive)
(let ((name (caar (ledger-parse-arguments))) (let ((name (caar (ledger-parse-arguments)))
rest-of-name
xacts) xacts)
(save-excursion (save-excursion
(when (eq 'transaction (ledger-thing-at-point)) (when (eq 'transaction (ledger-thing-at-point))
;; Search backward for a matching payee
(when (re-search-backward (when (re-search-backward
(concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+" (concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+"
(regexp-quote name) ) nil t) ;; "\\(\t\\|\n\\| [ \t]\\)" (regexp-quote name) ) nil t) ;; "\\(\t\\|\n\\| [ \t]\\)"
(forward-line) (setq rest-of-name (buffer-substring-no-properties (match-end 0) (line-end-position)))
;; Start copying the postings
(forward-line)
(while (looking-at "^\\s-+") (while (looking-at "^\\s-+")
(setq xacts (cons (buffer-substring-no-properties (setq xacts (cons (buffer-substring-no-properties
(line-beginning-position) (line-beginning-position)
@ -162,6 +166,7 @@ Does not use ledger xact"
(setq xacts (nreverse xacts))))) (setq xacts (nreverse xacts)))))
(when xacts (when xacts
(save-excursion (save-excursion
(insert rest-of-name)
(insert ?\n) (insert ?\n)
(while xacts (while xacts
(insert (car xacts) ?\n) (insert (car xacts) ?\n)