From 119d86d31bc18100b52dc4707eb4f5afa88d71f5 Mon Sep 17 00:00:00 2001 From: Jesse Alama Date: Sat, 21 Feb 2009 17:42:39 -0800 Subject: Make ledger-report buffers non-editable. * lisp/ledger.el: Make ledger-report buffers non-editable. Intuitively, a ledger-report buffer is a report -- the result of applying a function to your ledger data. Thus, the buffers created by ledger-reports aren't editable text; to "change" the ledger-report buffer, change the ledger data from which the report is derived. This commit alters ledger-report and ledger-report-redo. --- lisp/ledger.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lisp') diff --git a/lisp/ledger.el b/lisp/ledger.el index 0b04c0aa..6636e744 100644 --- a/lisp/ledger.el +++ b/lisp/ledger.el @@ -858,7 +858,9 @@ used to generate the buffer, navigating the buffer, etc." (set (make-local-variable 'ledger-report-name) report-name) (set (make-local-variable 'ledger-original-window-cfg) wcfg) (ledger-do-report (ledger-report-cmd report-name edit)) - (shrink-window-if-larger-than-buffer)))) + (shrink-window-if-larger-than-buffer) + (set-buffer-modified-p nil) + (setq buffer-read-only t)))) (defun string-empty-p (s) "Check for the empty string." @@ -979,8 +981,10 @@ the default." "Redo the report in the current ledger report buffer." (interactive) (ledger-report-goto) + (setq buffer-read-only nil) (erase-buffer) - (ledger-do-report ledger-report-cmd)) + (ledger-do-report ledger-report-cmd) + (setq buffer-read-only nil)) (defun ledger-report-quit () "Quit the ledger report buffer by burying it." -- cgit v1.2.3