Add custom faces to the reconciler

This commit is contained in:
Craig Earls 2013-02-01 11:39:48 -07:00
parent 0675208a63
commit edd82b2639
2 changed files with 26 additions and 6 deletions

View file

@ -56,6 +56,21 @@
"Face for Ledger comments"
:group 'ledger-faces)
(defface ledger-font-reconciler-uncleared-face
`((t :foreground "green" :weight normal ))
"Default face for uncleared transactions in the reconcile window"
:group 'ledger-faces)
(defface ledger-font-reconciler-cleared-face
`((t :foreground "grey70" :weight normal ))
"Default face for cleared (*) transactions in the reconcile window"
:group 'ledger-faces)
(defface ledger-font-reconciler-pending-face
`((t :foreground "yellow" :weight normal ))
"Default face for pending (!) transactions in the reconcile window"
:group 'ledger-faces)
(defvar ledger-font-lock-keywords
'(("^[0-9]+[-/.=][-/.=0-9]+\\s-\\!\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(\\( ;\\| ;\\|$\\)\\)" 2 'ledger-font-pending-face)

View file

@ -55,13 +55,17 @@
(with-current-buffer ledger-buf
(goto-char (cdr where))
(setq cleared (ledger-toggle-current-entry)))
;remove the existing face and add the new face
(remove-text-properties (line-beginning-position)
(line-end-position)
(list 'face))
(if cleared
(add-text-properties (line-beginning-position)
(line-end-position)
(list 'face 'bold))
(remove-text-properties (line-beginning-position)
(line-end-position)
(list 'face))))
(list 'face 'ledger-font-reconciler-cleared-face ))
(add-text-properties (line-beginning-position)
(line-end-position)
(list 'face 'ledger-font-reconciler-uncleared-face ))))
(forward-line)
(ledger-display-balance)))
@ -172,10 +176,11 @@
(nth 4 item) (nth 1 xact) (nth 2 xact)))
(if (nth 3 xact)
(set-text-properties beg (1- (point))
(list 'face 'bold
(list 'face 'ledger-font-reconciler-cleared-face
'where where))
(set-text-properties beg (1- (point))
(list 'where where))))
(list 'face 'ledger-font-reconciler-uncleared-face
'where where))))
(setq index (1+ index)))))
(goto-char (point-min))
(set-buffer-modified-p nil)