summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-fontify.el6
-rw-r--r--lisp/ledger-fonts.el7
-rw-r--r--lisp/ledger-navigate.el16
3 files changed, 27 insertions, 2 deletions
diff --git a/lisp/ledger-fontify.el b/lisp/ledger-fontify.el
index 45baa433..d876e5e3 100644
--- a/lisp/ledger-fontify.el
+++ b/lisp/ledger-fontify.el
@@ -52,7 +52,7 @@
(interactive "d")
(save-excursion
(goto-char position)
- (let ((extents (ledger-navigate-find-xact-extents position))
+ (let ((extents (ledger-navigate-find-element-extents position))
(state (ledger-transaction-state)))
(if (and ledger-fontify-xact-state-overrides state)
(cond ((eq state 'cleared)
@@ -115,7 +115,7 @@ Fontify the first line of an xact"
'ledger-font-comment-face)))
(defun ledger-fontify-directive-at (position)
- (let ((extents (ledger-navigate-find-xact-extents position))
+ (let ((extents (ledger-navigate-find-element-extents position))
(face 'ledger-font-default-face))
(cond ((looking-at "=")
(setq face 'ledger-font-auto-xact-face))
@@ -153,6 +153,8 @@ Fontify the first line of an xact"
(setq face 'ledger-font-include-directive-face))
((looking-at "payee")
(setq face 'ledger-font-payee-directive-face))
+ ((looking-at "P")
+ (setq face 'ledger-font-price-directive-face))
((looking-at "tag")
(setq face 'ledger-font-tag-directive-face)))
(ledger-fontify-set-face extents face)))
diff --git a/lisp/ledger-fonts.el b/lisp/ledger-fonts.el
index f8ca3fa6..99927315 100644
--- a/lisp/ledger-fonts.el
+++ b/lisp/ledger-fonts.el
@@ -70,6 +70,8 @@
"Default face for pending (!) payees"
:group 'ledger-faces)
+
+
(defface ledger-font-xact-highlight-face
`((t :inherit ledger-occur-xact-face))
"Default face for transaction under point"
@@ -95,6 +97,11 @@
"Default face for other transactions"
:group 'ledger-faces)
+(defface ledger-font-price-directive-face
+ `((t :inherit ledger-font-directive-face))
+ "Default face for other transactions"
+ :group 'ledger-faces)
+
(defface ledger-font-apply-directive-face
`((t :inherit ledger-font-directive-face))
"Default face for other transactions"
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