Mercurial > emacs
changeset 82317:c668fe19825b
(longlines-decoded): New variable.
(longlines-mode): Avoid encoding or decoding the buffer twice.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Tue, 07 Aug 2007 16:10:20 +0000 |
parents | 968a6f972283 |
children | 7bec7031afab |
files | lisp/longlines.el |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/longlines.el Tue Aug 07 16:10:11 2007 +0000 +++ b/lisp/longlines.el Tue Aug 07 16:10:20 2007 +0000 @@ -79,11 +79,13 @@ (defvar longlines-wrap-end nil) (defvar longlines-wrap-point nil) (defvar longlines-showing nil) +(defvar longlines-decoded nil) (make-variable-buffer-local 'longlines-wrap-beg) (make-variable-buffer-local 'longlines-wrap-end) (make-variable-buffer-local 'longlines-wrap-point) (make-variable-buffer-local 'longlines-showing) +(make-variable-buffer-local 'longlines-decoded) ;; Mode @@ -128,7 +130,9 @@ ;; longlines-wrap-lines that we'll never encounter from here (save-restriction (widen) - (longlines-decode-buffer) + (unless longlines-decoded + (longlines-decode-buffer) + (setq longlines-decoded t)) (longlines-wrap-region (point-min) (point-max))) (set-buffer-modified-p mod)) (when (and longlines-show-hard-newlines @@ -161,9 +165,11 @@ (let ((buffer-undo-list t) (after-change-functions nil) (inhibit-read-only t)) - (save-restriction - (widen) - (longlines-encode-region (point-min) (point-max)))) + (if longlines-decoded + (save-restriction + (widen) + (longlines-encode-region (point-min) (point-max)) + (setq longlines-decoded nil)))) (remove-hook 'change-major-mode-hook 'longlines-mode-off t) (remove-hook 'after-change-functions 'longlines-after-change-function t) (remove-hook 'post-command-hook 'longlines-post-command-function t)