diff options
author | Craig Earls <enderw88@gmail.com> | 2013-02-09 21:03:58 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-02-09 21:03:58 -0700 |
commit | 6fce572806eb39b5ba607bd5336adb6ca3ac2295 (patch) | |
tree | e69c8ffbccf033d3ecd176da41cd667c297e2e42 /lisp | |
parent | 114be62d248723bfae12e383b168f364857d8793 (diff) | |
download | fork-ledger-6fce572806eb39b5ba607bd5336adb6ca3ac2295.tar.gz fork-ledger-6fce572806eb39b5ba607bd5336adb6ca3ac2295.tar.bz2 fork-ledger-6fce572806eb39b5ba607bd5336adb6ca3ac2295.zip |
ledger-mode now highlights the xact under point.
This can be configured with ledger-highlight-xact-under-point and ledger-font-highlight-face
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ldg-fonts.el | 5 | ||||
-rw-r--r-- | lisp/ldg-mode.el | 6 | ||||
-rw-r--r-- | lisp/ldg-occur.el | 19 | ||||
-rw-r--r-- | lisp/ldg-reconcile.el | 1 |
4 files changed, 11 insertions, 20 deletions
diff --git a/lisp/ldg-fonts.el b/lisp/ldg-fonts.el index 6032e361..62192881 100644 --- a/lisp/ldg-fonts.el +++ b/lisp/ldg-fonts.el @@ -31,6 +31,11 @@ "Default face for cleared (*) transactions" :group 'ledger-faces) +(defface ledger-font-highlight-face + `((t :background "#003366" :weight normal )) + "Default face for transaction under point" + :group 'ledger-faces) + (defface ledger-font-pending-face `((t :foreground "yellow" :weight normal )) "Default face for pending (!) transactions" diff --git a/lisp/ldg-mode.el b/lisp/ldg-mode.el index 83b5e5b4..a2c87048 100644 --- a/lisp/ldg-mode.el +++ b/lisp/ldg-mode.el @@ -60,6 +60,9 @@ customizable to ease retro-entry.") 'ledger-complete-at-point) (set (make-local-variable 'pcomplete-termination-string) "") + (add-hook 'post-command-hook 'ledger-highlight-xact-under-point nil t) + (make-variable-buffer-local 'highlight-overlay) + (let ((map (current-local-map))) (define-key map [(control ?c) (control ?a)] 'ledger-add-entry) (define-key map [(control ?c) (control ?d)] 'ledger-delete-current-entry) @@ -114,8 +117,7 @@ customizable to ease retro-entry.") (define-key map [add-xact] '(menu-item "Add Entry" ledger-add-entry :enable ledger-works)) (define-key map [sep3] '(menu-item "--")) (define-key map [reconcile] '(menu-item "Reconcile Account" ledger-reconcile :enable ledger-works)) - (define-key map [reconcile] '(menu-item "Hide Xacts" ledger-occur)) - )) + (define-key map [reconcile] '(menu-item "Hide Xacts" ledger-occur)))) (defun ledger-time-less-p (t1 t2) "Say whether time value T1 is less than time value T2." diff --git a/lisp/ldg-occur.el b/lisp/ldg-occur.el index d498b9e4..1afb0e90 100644 --- a/lisp/ldg-occur.el +++ b/lisp/ldg-occur.el @@ -208,23 +208,6 @@ When REGEX is nil, unhide everything, and remove higlight" buffer-matches) (setq overlays (nreverse overlays))))) -(defun ledger-occur-find-xact-extents (pos) - "return point for beginning of xact and and of xact containing - position. Requires empty line separating xacts" - (interactive "d") - (save-excursion - (goto-char pos) - (let ((end-pos pos) - (beg-pos pos)) - (backward-paragraph) - (forward-line) - (beginning-of-line) - (setq beg-pos (point)) - (forward-paragraph) - (forward-line -1) - (end-of-line) - (setq end-pos (1+ (point))) - (list beg-pos end-pos)))) (defun ledger-occur-find-matches (regex) "Returns a list of 2-number tuples, specifying begnning of the @@ -241,7 +224,7 @@ When REGEX is nil, unhide everything, and remove higlight" ;; if something found (when (setq endpoint (re-search-forward regex nil 'end)) (save-excursion - (let ((bounds (ledger-occur-find-xact-extents (match-beginning 0)))) + (let ((bounds (ledger-find-xact-extents (match-beginning 0)))) (push bounds lines) (setq curpoint (cadr bounds)))) ;move to the end of the ;xact, no need to search diff --git a/lisp/ldg-reconcile.el b/lisp/ldg-reconcile.el index e5048a8c..ed3fbcb5 100644 --- a/lisp/ldg-reconcile.el +++ b/lisp/ldg-reconcile.el @@ -156,6 +156,7 @@ (switch-to-buffer-other-window target-buffer) (goto-char (cdr where)) (recenter) + (ledger-highlight-xact-under-point) (if come-back (switch-to-buffer-other-window cur-buf)))))) |