diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2007-08-07 16:08:39 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2007-08-07 16:08:39 +0000 |
commit | 275e235e8d5f9c0cb54ff716c0b382c5d5adc5e3 (patch) | |
tree | 0a8fadcf5b3cadd07a4b5642d0ec43a855b3f9fa | |
parent | 559818abde3dbfcb40eb9b45dfe269cc0cd37c6e (diff) | |
download | emacs-275e235e8d5f9c0cb54ff716c0b382c5d5adc5e3.tar.gz |
(longlines-decoded): New variable.
(longlines-mode): Avoid encoding or decoding the buffer twice.
-rw-r--r-- | lisp/longlines.el | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lisp/longlines.el b/lisp/longlines.el index fa73ef7057d..07977910a22 100644 --- a/lisp/longlines.el +++ b/lisp/longlines.el @@ -79,11 +79,13 @@ This is used when `longlines-show-hard-newlines' is on." (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 @@ are indicated with a symbol." ;; 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 @@ are indicated with a symbol." (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) |