From e9ea090035c46092d55f326c33bd071cd4a27381 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 31 May 2005 22:38:34 +0000 Subject: (ledger-do-reconcile): Only allow toggling of reconcilation entries that are found in the "main" ledger file (for now). --- ledger.el | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'ledger.el') diff --git a/ledger.el b/ledger.el index 918f109f..ea4fe283 100644 --- a/ledger.el +++ b/ledger.el @@ -232,16 +232,17 @@ Return the difference in the format of a time value." (account ledger-acct) (inhibit-read-only t) cleared) - (with-current-buffer ledger-buf - (goto-char (cdr where)) - (setq cleared (ledger-toggle-current 'pending))) - (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))) + (when (equal (car where) "") + (with-current-buffer ledger-buf + (goto-char (cdr where)) + (setq cleared (ledger-toggle-current 'pending))) + (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)))) (forward-line))) (defun ledger-auto-reconcile (balance date) @@ -308,19 +309,21 @@ Return the difference in the format of a time value." (defun ledger-reconcile-delete () (interactive) (let ((where (get-text-property (point) 'where))) - (with-current-buffer ledger-buf - (goto-char (cdr where)) - (ledger-delete-current-entry)) - (let ((inhibit-read-only t)) - (goto-char (line-beginning-position)) - (delete-region (point) (1+ (line-end-position))) - (set-buffer-modified-p t)))) + (when (equal (car where) "") + (with-current-buffer ledger-buf + (goto-char (cdr where)) + (ledger-delete-current-entry)) + (let ((inhibit-read-only t)) + (goto-char (line-beginning-position)) + (delete-region (point) (1+ (line-end-position))) + (set-buffer-modified-p t))))) (defun ledger-reconcile-visit () (interactive) (let ((where (get-text-property (point) 'where))) - (switch-to-buffer-other-window ledger-buf) - (goto-char (cdr where)))) + (when (equal (car where) "") + (switch-to-buffer-other-window ledger-buf) + (goto-char (cdr where))))) (defun ledger-reconcile-save () (interactive) @@ -340,7 +343,8 @@ Return the difference in the format of a time value." (while (not (eobp)) (let ((where (get-text-property (point) 'where)) (face (get-text-property (point) 'face))) - (if (eq face 'bold) + (if (and (eq face 'bold) + (equal (car where) "")) (with-current-buffer ledger-buf (goto-char (cdr where)) (ledger-toggle-current 'cleared)))) -- cgit v1.2.3