summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2011-08-18 11:09:24 -0400
committerJohn Wiegley <johnw@newartisans.com>2011-08-18 11:09:24 -0400
commitbed70c8670cd328447f61439832ffc7b3a7affb4 (patch)
tree17d1a118f0f82a057a41cad3339d2d74043404be
parentf2ca0ee4744d2a77f91548b637588d94fe445a1d (diff)
downloadfork-ledger-bed70c8670cd328447f61439832ffc7b3a7affb4.tar.gz
fork-ledger-bed70c8670cd328447f61439832ffc7b3a7affb4.tar.bz2
fork-ledger-bed70c8670cd328447f61439832ffc7b3a7affb4.zip
Added ledger-create-test to ldg-new.el
-rw-r--r--lisp/ldg-new.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/lisp/ldg-new.el b/lisp/ldg-new.el
index 84863c95..64377bb9 100644
--- a/lisp/ldg-new.el
+++ b/lisp/ldg-new.el
@@ -53,4 +53,30 @@
(provide 'ledger)
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun ledger-create-test ()
+ (interactive)
+ (save-restriction
+ (org-narrow-to-subtree)
+ (save-excursion
+ (let (text beg)
+ (goto-char (point-min))
+ (forward-line 1)
+ (setq beg (point))
+ (search-forward ":PROPERTIES:")
+ (goto-char (line-beginning-position))
+ (setq text (buffer-substring-no-properties beg (point)))
+ (goto-char (point-min))
+ (re-search-forward ":ID:\\s-+\\([^-]+\\)")
+ (find-file-other-window
+ (format "~/src/ledger/test/regress/%s.test" (match-string 1)))
+ (sit-for 0)
+ (insert text)
+ (goto-char (point-min))
+ (while (not (eobp))
+ (goto-char (line-beginning-position))
+ (delete-char 3)
+ (forward-line 1))))))
+
;;; ledger.el ends here