summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-03-02 20:21:46 -0700
committerCraig Earls <enderw88@gmail.com>2013-03-02 20:21:46 -0700
commit4c608cccd0c6f06f403882dcca36cb62a40178a2 (patch)
tree9faa792c6e4477ff5c52435a5b9cd384c1081c79 /lisp
parentb3971e8bedcfde7c9c2c1bbb7460915aa6ca0731 (diff)
parent4810da9398809fc090c7f044d3545050a465d2bb (diff)
downloadfork-ledger-4c608cccd0c6f06f403882dcca36cb62a40178a2.tar.gz
fork-ledger-4c608cccd0c6f06f403882dcca36cb62a40178a2.tar.bz2
fork-ledger-4c608cccd0c6f06f403882dcca36cb62a40178a2.zip
Merge branch 'next' into ledger-mode-automatic-transactions
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ldg-post.el6
-rw-r--r--lisp/ldg-sort.el13
2 files changed, 13 insertions, 6 deletions
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el
index 2a736bfc..7105ef7a 100644
--- a/lisp/ldg-post.el
+++ b/lisp/ldg-post.el
@@ -133,10 +133,10 @@ the account"
(setq column ledger-post-amount-alignment-column))
(save-excursion
;; Position the account
- (beginning-of-line)
+ ;; (beginning-of-line)
(set-mark (point))
- (delete-horizontal-space)
- (insert ledger-default-acct-transaction-indent)
+ ;; (delete-horizontal-space)
+ ;; (insert ledger-default-acct-transaction-indent)
(goto-char (1+ (line-end-position)))
(let* ((mark-first (< (mark) (point)))
(begin (if mark-first (mark) (point)))
diff --git a/lisp/ldg-sort.el b/lisp/ldg-sort.el
index 361eead8..cc036492 100644
--- a/lisp/ldg-sort.el
+++ b/lisp/ldg-sort.el
@@ -54,8 +54,8 @@
;; the beginning of next record
;; after the region
(setq new-end (point))
- (narrow-to-region beg end)
- (goto-char (point-min))
+ (narrow-to-region new-beg new-end)
+ (goto-char new-beg)
(let ((inhibit-field-text-motion t))
(sort-subr
@@ -66,7 +66,14 @@
(defun ledger-sort-buffer ()
"Sort the entire buffer."
(interactive)
- (ledger-sort-region (point-min) (point-max)))
+ (let ((sort-start (point-min))
+ (sort-end (point-max)))
+ (goto-char (point-min))
+ (if (re-search-forward ";.*Ledger-mode:.*Start sort" nil t)
+ (set 'sort-start (match-end 0)))
+ (if (re-search-forward ";.*Ledger-mode:.*End sort" nil t)
+ (set 'sort-end (match-end 0)))
+ (ledger-sort-region sort-start sort-end)))
(provide 'ldg-sort)