summaryrefslogtreecommitdiff
path: root/lisp/ldg-occur.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-02-09 06:38:08 -0800
committerCraig Earls <enderw88@gmail.com>2013-02-09 06:38:08 -0800
commitf89d6c4419551187a3ed9755d43db959c18938f1 (patch)
tree8a168797621d4b416a193b571b2c65c0747f21fb /lisp/ldg-occur.el
parent1d22862c35465c99008f1730392130b01c396b6c (diff)
parentd3964b66d556557b16053aa781220d298dc60d3a (diff)
downloadfork-ledger-f89d6c4419551187a3ed9755d43db959c18938f1.tar.gz
fork-ledger-f89d6c4419551187a3ed9755d43db959c18938f1.tar.bz2
fork-ledger-f89d6c4419551187a3ed9755d43db959c18938f1.zip
Merge pull request #152 from vanicat/t/occur-bugs
T/occur bugs
Diffstat (limited to 'lisp/ldg-occur.el')
-rw-r--r--lisp/ldg-occur.el46
1 files changed, 24 insertions, 22 deletions
diff --git a/lisp/ldg-occur.el b/lisp/ldg-occur.el
index 0f1f4616..d498b9e4 100644
--- a/lisp/ldg-occur.el
+++ b/lisp/ldg-occur.el
@@ -70,13 +70,14 @@
"A list of currently active overlays to the ledger buffer.")
(make-variable-buffer-local 'ledger-occur-overlay-list)
-
(defun ledger-occur-mode (regex buffer)
+ "Higlight transaction that match REGEX, hiding others
+
+When REGEX is nil, unhide everything, and remove higlight"
(progn
(set-buffer buffer)
(setq ledger-occur-mode
- (if (or ledger-occur-mode
- (null regex)
+ (if (or (null regex)
(zerop (length regex)))
nil
(concat " Ledger-Folded: " regex)))
@@ -128,31 +129,32 @@
prompt))
(defun ledger-occur-create-folded-overlays(buffer-matches)
- (let ((overlays
- (let ((prev-end (point-min))
- (temp (point-max)))
- (mapcar (lambda (match)
- (progn
- (setq temp prev-end) ;need a swap so that the
+ (if buffer-matches
+ (let ((overlays
+ (let ((prev-end (point-min))
+ (temp (point-max)))
+ (mapcar (lambda (match)
+ (progn
+ (setq temp prev-end) ;need a swap so that the
;last form in the lambda
;is the (make-overlay)
- (setq prev-end (1+ (cadr match))) ;add 1 so
+ (setq prev-end (1+ (cadr match))) ;add 1 so
;that we skip
;the empty
;line after
;the xact
- (make-overlay
- temp
- (car match)
- (current-buffer) t nil)))
- buffer-matches))))
- (mapcar (lambda (ovl)
- (overlay-put ovl ledger-occur-overlay-property-name t)
- (overlay-put ovl 'invisible t)
- (overlay-put ovl 'intangible t))
- (push (make-overlay (cadr (car(last buffer-matches)))
- (point-max)
- (current-buffer) t nil) overlays))))
+ (make-overlay
+ temp
+ (car match)
+ (current-buffer) t nil)))
+ buffer-matches))))
+ (mapcar (lambda (ovl)
+ (overlay-put ovl ledger-occur-overlay-property-name t)
+ (overlay-put ovl 'invisible t)
+ (overlay-put ovl 'intangible t))
+ (push (make-overlay (cadr (car(last buffer-matches)))
+ (point-max)
+ (current-buffer) t nil) overlays)))))
(defun ledger-occur-create-xact-overlays (ovl-bounds)