diff options
author | Craig Earls <enderw88@gmail.com> | 2015-01-04 19:58:29 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2015-01-04 19:58:29 -0700 |
commit | 36ab11ae829a81be3e3728f2b6289ae7e293d770 (patch) | |
tree | 15aa3e8e88d48fc2c39e4c6dc97a3a4e34f5322d /lisp/ledger-report.el | |
parent | e2631ca36c321670497691f7036db8fd40340de1 (diff) | |
parent | 5ff724c451fb09e73f055bcadc8b7ed2f79e0914 (diff) | |
download | fork-ledger-36ab11ae829a81be3e3728f2b6289ae7e293d770.tar.gz fork-ledger-36ab11ae829a81be3e3728f2b6289ae7e293d770.tar.bz2 fork-ledger-36ab11ae829a81be3e3728f2b6289ae7e293d770.zip |
Merge pull request #363 from lowdef/ledger-mode-bug-1089-auto-refresh-sticky-cursor
ledger-mode bug 1089 introduce sticky cursor for report auto refresh
Thanks.
Diffstat (limited to 'lisp/ledger-report.el')
-rw-r--r-- | lisp/ledger-report.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/ledger-report.el b/lisp/ledger-report.el index dee96205..c477707f 100644 --- a/lisp/ledger-report.el +++ b/lisp/ledger-report.el @@ -71,6 +71,11 @@ text that should replace the format specifier." :type 'boolean :group 'ledger-report) +(defcustom ledger-report-auto-refresh-sticky-cursor nil + "If t then try to place cursor at same relative position as it was before auto-refresh." + :type 'boolean + :group 'ledger-report) + (defvar ledger-report-buffer-name "*Ledger Report*") (defvar ledger-report-name nil) @@ -83,6 +88,7 @@ text that should replace the format specifier." (defvar ledger-report-mode-abbrev-table) (defvar ledger-report-is-reversed nil) +(defvar ledger-report-cursor-line-number nil) (defun ledger-report-reverse-report () "Reverse the order of the report." @@ -391,10 +397,12 @@ Optional EDIT the command." (pop-to-buffer (get-buffer ledger-report-buffer-name)) (shrink-window-if-larger-than-buffer) (setq buffer-read-only nil) + (setq ledger-report-cursor-line-number (line-number-at-pos)) (erase-buffer) (ledger-do-report ledger-report-cmd) (setq buffer-read-only nil) (if ledger-report-is-reversed (ledger-report-reverse-lines)) + (if ledger-report-auto-refresh-sticky-cursor (forward-line (- ledger-report-cursor-line-number 5))) (pop-to-buffer cur-buf))))) (defun ledger-report-quit () |