diff options
author | Craig Earls <enderw88@gmail.com> | 2013-05-14 16:23:00 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-05-14 16:23:00 -0700 |
commit | a22ae041365a8bb6798429f444470072a99129c8 (patch) | |
tree | 62bb7519e47c26fee9b95453e280f4ca226b99f9 /lisp | |
parent | 47142e5846ab4bdaa5d7b3d89a5be411af9dd22f (diff) | |
download | fork-ledger-a22ae041365a8bb6798429f444470072a99129c8.tar.gz fork-ledger-a22ae041365a8bb6798429f444470072a99129c8.tar.bz2 fork-ledger-a22ae041365a8bb6798429f444470072a99129c8.zip |
Prevent failure if ledger sort buffer is called with point before the ledger start marker.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ldg-sort.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/ldg-sort.el b/lisp/ldg-sort.el index 06efd348..42b49648 100644 --- a/lisp/ldg-sort.el +++ b/lisp/ldg-sort.el @@ -22,7 +22,7 @@ ;;; Commentary: -;; +;; ;;; Code: @@ -45,7 +45,7 @@ (match-end 0))) (defun ledger-sort-insert-start-mark () - (interactive) + (interactive) (save-excursion (goto-char (point-min)) (if (ledger-sort-find-start) @@ -54,7 +54,7 @@ (insert "\n; Ledger-mode: Start sort\n\n")) (defun ledger-sort-insert-end-mark () - (interactive) + (interactive) (save-excursion (goto-char (point-min)) (if (ledger-sort-find-end) @@ -79,7 +79,7 @@ (setq point-delta (- (point) (car bounds))) (setq target-xact (buffer-substring (car bounds) (cadr bounds))) (setq inhibit-modification-hooks t) - (save-excursion + (save-excursion (save-restriction (goto-char beg) (ledger-next-record-function) ;; make sure point is at the @@ -100,7 +100,7 @@ 'ledger-end-record-function 'ledger-sort-startkey)))) - (goto-char beg) + (goto-char (point-min)) (re-search-forward (regexp-quote target-xact)) (goto-char (+ (match-beginning 0) point-delta)) (setq inhibit-modification-hooks nil))) @@ -108,7 +108,7 @@ (defun ledger-sort-buffer () "Sort the entire buffer." (interactive) - (let (sort-start + (let (sort-start sort-end) (save-excursion (goto-char (point-min)) @@ -116,7 +116,7 @@ sort-end (ledger-sort-find-end))) (ledger-sort-region (if sort-start sort-start - (point-min)) + (point-min)) (if sort-end sort-end (point-max))))) |