summaryrefslogtreecommitdiff
path: root/lisp/ledger-navigate.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2014-11-07 18:19:57 -0700
committerCraig Earls <enderw88@gmail.com>2014-11-07 18:19:57 -0700
commit1bd67755fa3127d80b7534d15f1f9de1b477c19a (patch)
tree7173c72aac2eed11a1315c903efe09ea3039ca04 /lisp/ledger-navigate.el
parenta66001382cd68c1d989bbe4ced629cc87370a4ce (diff)
downloadfork-ledger-1bd67755fa3127d80b7534d15f1f9de1b477c19a.tar.gz
fork-ledger-1bd67755fa3127d80b7534d15f1f9de1b477c19a.tar.bz2
fork-ledger-1bd67755fa3127d80b7534d15f1f9de1b477c19a.zip
Improve finding boundaries of elements for fontification. Also added P for price directives.
Diffstat (limited to 'lisp/ledger-navigate.el')
-rw-r--r--lisp/ledger-navigate.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/ledger-navigate.el b/lisp/ledger-navigate.el
index 1e66dde2..1843430a 100644
--- a/lisp/ledger-navigate.el
+++ b/lisp/ledger-navigate.el
@@ -91,4 +91,20 @@ Requires empty line separating xacts."
(list (ledger-navigate-beginning-of-xact)
(ledger-navigate-end-of-xact))))
+(defun ledger-navigate-find-directive-extents (pos)
+ (goto-char pos)
+ (list (progn (beginning-of-line)
+ (point))
+ (progn (end-of-line)
+ (point))))
+
+(defun ledger-navigate-find-element-extents (pos)
+ "return list containing beginning and end of the entity surrounding point"
+ (interactive "d")
+ (save-excursion
+ (goto-char pos)
+ (beginning-of-line)
+ (if (looking-at "[ 0-9]")
+ (ledger-navigate-find-xact-extents pos)
+ (ledger-navigate-find-directive-extents pos))))
;;; ledger-navigate.el ends here