summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ledger-report.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/ledger-report.el b/lisp/ledger-report.el
index eb3d8435..dee96205 100644
--- a/lisp/ledger-report.el
+++ b/lisp/ledger-report.el
@@ -82,8 +82,15 @@ text that should replace the format specifier."
(defvar ledger-minibuffer-history nil)
(defvar ledger-report-mode-abbrev-table)
+(defvar ledger-report-is-reversed nil)
+
+(defun ledger-report-reverse-report ()
+ "Reverse the order of the report."
+ (interactive)
+ (ledger-report-reverse-lines)
+ (setq ledger-report-is-reversed (not ledger-report-is-reversed)))
+
(defun ledger-report-reverse-lines ()
- (interactive)
(goto-char (point-min))
(forward-paragraph)
(forward-line)
@@ -96,7 +103,7 @@ text that should replace the format specifier."
(define-key map [? ] 'scroll-up)
(define-key map [backspace] 'scroll-down)
(define-key map [?r] 'ledger-report-redo)
- (define-key map [(shift ?r)] 'ledger-report-reverse-lines)
+ (define-key map [(shift ?r)] 'ledger-report-reverse-report)
(define-key map [?s] 'ledger-report-save)
(define-key map [?k] 'ledger-report-kill)
(define-key map [?e] 'ledger-report-edit-report)
@@ -123,7 +130,7 @@ text that should replace the format specifier."
["Edit All Reports" ledger-report-edit-reports]
["Re-run Report" ledger-report-redo]
"---"
- ["Reverse report order" ledger-report-reverse-lines]
+ ["Reverse report order" ledger-report-reverse-report]
"---"
["Scroll Up" scroll-up]
["Visit Source" ledger-report-visit-source]
@@ -190,6 +197,7 @@ used to generate the buffer, navigating the buffer, etc."
(set (make-local-variable 'ledger-buf) buf)
(set (make-local-variable 'ledger-report-name) report-name)
(set (make-local-variable 'ledger-original-window-cfg) wcfg)
+ (set (make-local-variable 'ledger-report-is-reversed) nil)
(ledger-do-report (ledger-report-cmd report-name edit))
(shrink-window-if-larger-than-buffer)
(set-buffer-modified-p nil)
@@ -386,6 +394,7 @@ Optional EDIT the command."
(erase-buffer)
(ledger-do-report ledger-report-cmd)
(setq buffer-read-only nil)
+ (if ledger-report-is-reversed (ledger-report-reverse-lines))
(pop-to-buffer cur-buf)))))
(defun ledger-report-quit ()