summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-02-11 10:50:13 -0700
committerCraig Earls <enderw88@gmail.com>2013-02-11 10:50:13 -0700
commite245e41d6bfb1ef8799d9174e2bc5c6687880aa8 (patch)
treef9b6e4772fe14fc24a4ea64b337a11d4169ef255
parenteef9245eb810820643a5960426265edd5578c656 (diff)
downloadfork-ledger-e245e41d6bfb1ef8799d9174e2bc5c6687880aa8.tar.gz
fork-ledger-e245e41d6bfb1ef8799d9174e2bc5c6687880aa8.tar.bz2
fork-ledger-e245e41d6bfb1ef8799d9174e2bc5c6687880aa8.zip
Bug 887. Remove folding if the reconcile buffer is killed
This ensure adequate cleanup if the reconciliation buffer is killed vice quit from.
-rw-r--r--lisp/ldg-reconcile.el28
1 files changed, 19 insertions, 9 deletions
diff --git a/lisp/ldg-reconcile.el b/lisp/ldg-reconcile.el
index 3c258d13..5f023eb5 100644
--- a/lisp/ldg-reconcile.el
+++ b/lisp/ldg-reconcile.el
@@ -170,17 +170,25 @@
(defun ledger-reconcile-quit ()
(interactive)
+ ;(ledger-reconcile-quit-cleanup)
(let ((buf ledger-buf)
- (reconcile-buf (current-buffer)))
- (with-current-buffer ledger-buf
+ (recon-buf (get-buffer ledger-recon-buffer-name)))
+ ;Make sure you delete the window before you delete the buffer,
+ ;otherwise, madness ensues
+ (with-current-buffer recon-buf
+ (delete-window (get-buffer-window recon-buf))
+ (kill-buffer recon-buf))
+ (set-window-buffer (selected-window) buf)))
+
+(defun ledger-reconcile-quit-cleanup ()
+ (interactive)
+ (let ((buf ledger-buf)
+ (reconcile-buf (get-buffer ledger-recon-buffer-name)))
+ (with-current-buffer buf
(remove-hook 'after-save-hook 'ledger-reconcile-refresh-after-save t))
-
- ;Make sure you delete the window before you delete the buffer,
- ;otherwise, madness ensues
- (delete-window (get-buffer-window reconcile-buf))
- (kill-buffer reconcile-buf)
(if ledger-fold-on-reconcile
- (ledger-occur-quit-buffer buf))))
+ (ledger-occur-quit-buffer buf))))
+
(defun ledger-marker-where-xact-is (emacs-xact)
"find the position of the xact in the ledger-buf buffer using
@@ -330,6 +338,8 @@
(define-key map [menu-bar ldg-recon-menu ref] '("Refresh" . ledger-reconcile-refresh))
(define-key map [menu-bar ldg-recon-menu sav] '("Save" . ledger-reconcile-save))
- (use-local-map map)))
+ (use-local-map map)
+
+ (add-hook 'kill-buffer-hook 'ledger-reconcile-quit-cleanup nil t)))
(provide 'ldg-reconcile) \ No newline at end of file