ledger-mode now highlights the xact under point.
This can be configured with ledger-highlight-xact-under-point and ledger-font-highlight-face
This commit is contained in:
parent
114be62d24
commit
6fce572806
4 changed files with 11 additions and 20 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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."
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue