From 2f9240ae00d04dc469df76334fd44e78212246d0 Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Sat, 12 Jul 2014 22:32:59 -0700 Subject: Improve report redo logic. --- lisp/ledger-report.el | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lisp/ledger-report.el b/lisp/ledger-report.el index 3c51fc10..cf7da31a 100644 --- a/lisp/ledger-report.el +++ b/lisp/ledger-report.el @@ -360,16 +360,18 @@ Optional EDIT the command." (defun ledger-report-redo () "Redo the report in the current ledger report buffer." (interactive) - - (if (and (get-buffer ledger-buf) - (get-buffer ledger-report-buffer-name)) - (progn - (pop-to-buffer (get-buffer ledger-report-buffer-name)) - (shrink-window-if-larger-than-buffer) - (setq buffer-read-only nil) - (erase-buffer) - (ledger-do-report ledger-report-cmd) - (setq buffer-read-only nil)))) + (let ((cur-buf (current-buffer))) + (if (and (string= mode-name "Ledger") + (get-buffer ledger-report-buffer-name)) + (progn + + (pop-to-buffer (get-buffer ledger-report-buffer-name)) + (shrink-window-if-larger-than-buffer) + (setq buffer-read-only nil) + (erase-buffer) + (ledger-do-report ledger-report-cmd) + (setq buffer-read-only nil) + (pop-to-buffer cur-buf))))) (defun ledger-report-quit () "Quit the ledger report buffer." -- cgit v1.2.3