Adjust navigate-find-end-of-act so that it will sort empty act.

This is a bit pathological but as it turns out the fix makes all sorting a bit faster.
This commit is contained in:
Craig Earls 2014-12-04 19:47:43 -07:00
parent b3f8f943d3
commit bb38cda880
2 changed files with 5 additions and 31 deletions

View file

@ -78,7 +78,7 @@ beginning with whitespace"
"Move point to end of xact." "Move point to end of xact."
(interactive) (interactive)
(ledger-navigate-next-xact-or-directive) (ledger-navigate-next-xact-or-directive)
(re-search-backward "^[ \t]") (re-search-backward ".$")
(end-of-line) (end-of-line)
(point)) (point))

View file

@ -26,46 +26,19 @@
;;; Code: ;;; Code:
;; (defun ledger-next-record-function ()
;; "Move point to next transaction."
;; ;; make sure we actually move to the next xact, even if we are the
;; ;; beginning of one now.
;; (if (looking-at ledger-payee-any-status-regex)
;; (forward-line))
;; (if (re-search-forward ledger-payee-any-status-regex nil t)
;; (goto-char (match-beginning 0))
;; (goto-char (point-max))))
;; (defun ledger-prev-record-function ()
;; "Move point to beginning of previous xact."
;; (ledger-beginning-record-function)
;; (re-search-backward ledger-xact-start-regex nil t))
;; (defun ledger-beginning-record-function ()
;; "Move point to the beginning of the current xact"
;; (interactive)
;; (unless (looking-at ledger-xact-start-regex)
;; (re-search-backward ledger-xact-start-regex nil t)
;; (beginning-of-line))
;; (point))
;; (defun ledger-end-record-function ()
;; "Move point to end of xact."
;; (interactive)
;; (ledger-navigate-next-xact)
;; (backward-char)
;; (end-of-line)
;; (point))
(defun ledger-sort-find-start () (defun ledger-sort-find-start ()
"Find the beginning of a sort region"
(if (re-search-forward ";.*Ledger-mode:.*Start sort" nil t) (if (re-search-forward ";.*Ledger-mode:.*Start sort" nil t)
(match-end 0))) (match-end 0)))
(defun ledger-sort-find-end () (defun ledger-sort-find-end ()
"Find the end of a sort region"
(if (re-search-forward ";.*Ledger-mode:.*End sort" nil t) (if (re-search-forward ";.*Ledger-mode:.*End sort" nil t)
(match-end 0))) (match-end 0)))
(defun ledger-sort-insert-start-mark () (defun ledger-sort-insert-start-mark ()
"Insert a marker to start a sort region"
(interactive) (interactive)
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
@ -75,6 +48,7 @@
(insert "\n; Ledger-mode: Start sort\n\n")) (insert "\n; Ledger-mode: Start sort\n\n"))
(defun ledger-sort-insert-end-mark () (defun ledger-sort-insert-end-mark ()
"Insert a marker to end a sort region"
(interactive) (interactive)
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))