Fix minor navigation bugs. Prev and next act now properly handle directives and empty lines
This commit is contained in:
parent
4dbc822f90
commit
db7e4fd741
2 changed files with 8 additions and 5 deletions
|
|
@ -262,7 +262,7 @@ With a prefix argument, remove the effective date. "
|
||||||
(define-key map [(control ?c) (control ?o) (control ?r)] 'ledger-report)
|
(define-key map [(control ?c) (control ?o) (control ?r)] 'ledger-report)
|
||||||
(define-key map [(control ?c) (control ?o) (control ?s)] 'ledger-report-save)
|
(define-key map [(control ?c) (control ?o) (control ?s)] 'ledger-report-save)
|
||||||
|
|
||||||
(define-key map [(meta ?p)] 'ledger-navigate-prev-xact)
|
(define-key map [(meta ?p)] 'ledger-navigate-prev-xact-or-directive)
|
||||||
(define-key map [(meta ?n)] 'ledger-navigate-next-xact-or-directive)
|
(define-key map [(meta ?n)] 'ledger-navigate-next-xact-or-directive)
|
||||||
map)
|
map)
|
||||||
"Keymap for `ledger-mode'.")
|
"Keymap for `ledger-mode'.")
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,14 @@ beginning with whitespace"
|
||||||
(ledger-navigate-start-xact-or-directive-p)))
|
(ledger-navigate-start-xact-or-directive-p)))
|
||||||
(forward-line))))
|
(forward-line))))
|
||||||
|
|
||||||
(defun ledger-navigate-prev-xact ()
|
(defun ledger-navigate-prev-xact-or-directive ()
|
||||||
"Move point to beginning of previous xact."
|
"Move point to beginning of previous xact."
|
||||||
(interactive)
|
(interactive)
|
||||||
(ledger-navigate-beginning-of-xact)
|
(let ((context (car (ledger-context-at-point))))
|
||||||
(re-search-backward ledger-xact-start-regex nil t))
|
(when (equal context 'acct-transaction)
|
||||||
|
(ledger-navigate-beginning-of-xact))
|
||||||
|
(beginning-of-line)
|
||||||
|
(re-search-backward "^[[:graph:]]" nil t)))
|
||||||
|
|
||||||
(defun ledger-navigate-beginning-of-xact ()
|
(defun ledger-navigate-beginning-of-xact ()
|
||||||
"Move point to the beginning of the current xact"
|
"Move point to the beginning of the current xact"
|
||||||
|
|
@ -75,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)
|
||||||
(backward-char)
|
(re-search-backward "^[ \t]")
|
||||||
(end-of-line)
|
(end-of-line)
|
||||||
(point))
|
(point))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue