diff options
| author | Chong Yidong | 2007-07-08 18:08:10 +0000 |
|---|---|---|
| committer | Chong Yidong | 2007-07-08 18:08:10 +0000 |
| commit | b95d7932f557aaa15429c9f33a05d42f4f56f4f6 (patch) | |
| tree | 39ccfdd2a42d8dae01bda7501871ca79f1d064a5 | |
| parent | 3e318d972dc501cc609976db863bffb196e6ab0b (diff) | |
| download | emacs-b95d7932f557aaa15429c9f33a05d42f4f56f4f6.tar.gz emacs-b95d7932f557aaa15429c9f33a05d42f4f56f4f6.zip | |
(longlines-wrap-region): Avoid marking buffer as modified.
(longlines-auto-wrap, longlines-window-change-function): Remove
unnecessary calls to set-buffer-modified-p.
| -rw-r--r-- | lisp/longlines.el | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/lisp/longlines.el b/lisp/longlines.el index 149f69c9f26..b75adb4f0d9 100644 --- a/lisp/longlines.el +++ b/lisp/longlines.el | |||
| @@ -223,16 +223,18 @@ With optional argument ARG, make the hard newlines invisible again." | |||
| 223 | "Wrap each successive line, starting with the line before BEG. | 223 | "Wrap each successive line, starting with the line before BEG. |
| 224 | Stop when we reach lines after END that don't need wrapping, or the | 224 | Stop when we reach lines after END that don't need wrapping, or the |
| 225 | end of the buffer." | 225 | end of the buffer." |
| 226 | (setq longlines-wrap-point (point)) | 226 | (let ((mod (buffer-modified-p))) |
| 227 | (goto-char beg) | 227 | (setq longlines-wrap-point (point)) |
| 228 | (forward-line -1) | 228 | (goto-char beg) |
| 229 | ;; Two successful longlines-wrap-line's in a row mean successive | 229 | (forward-line -1) |
| 230 | ;; lines don't need wrapping. | 230 | ;; Two successful longlines-wrap-line's in a row mean successive |
| 231 | (while (null (and (longlines-wrap-line) | 231 | ;; lines don't need wrapping. |
| 232 | (or (eobp) | 232 | (while (null (and (longlines-wrap-line) |
| 233 | (and (>= (point) end) | 233 | (or (eobp) |
| 234 | (longlines-wrap-line)))))) | 234 | (and (>= (point) end) |
| 235 | (goto-char longlines-wrap-point)) | 235 | (longlines-wrap-line)))))) |
| 236 | (goto-char longlines-wrap-point) | ||
| 237 | (set-buffer-modified-p mod))) | ||
| 236 | 238 | ||
| 237 | (defun longlines-wrap-line () | 239 | (defun longlines-wrap-line () |
| 238 | "If the current line needs to be wrapped, wrap it and return nil. | 240 | "If the current line needs to be wrapped, wrap it and return nil. |
| @@ -372,10 +374,9 @@ If automatic line wrapping is turned on, wrap the entire buffer." | |||
| 372 | (> (prefix-numeric-value arg) 0) | 374 | (> (prefix-numeric-value arg) 0) |
| 373 | (not longlines-auto-wrap))) | 375 | (not longlines-auto-wrap))) |
| 374 | (if arg | 376 | (if arg |
| 375 | (let ((mod (buffer-modified-p))) | 377 | (progn |
| 376 | (setq longlines-auto-wrap t) | 378 | (setq longlines-auto-wrap t) |
| 377 | (longlines-wrap-region (point-min) (point-max)) | 379 | (longlines-wrap-region (point-min) (point-max)) |
| 378 | (set-buffer-modified-p mod) | ||
| 379 | (message "Auto wrap enabled.")) | 380 | (message "Auto wrap enabled.")) |
| 380 | (setq longlines-auto-wrap nil) | 381 | (setq longlines-auto-wrap nil) |
| 381 | (message "Auto wrap disabled."))) | 382 | (message "Auto wrap disabled."))) |
| @@ -410,9 +411,7 @@ This is called by `post-command-hook' after each command." | |||
| 410 | This is called by `window-configuration-change-hook'." | 411 | This is called by `window-configuration-change-hook'." |
| 411 | (when (/= fill-column (- (window-width) window-min-width)) | 412 | (when (/= fill-column (- (window-width) window-min-width)) |
| 412 | (setq fill-column (- (window-width) window-min-width)) | 413 | (setq fill-column (- (window-width) window-min-width)) |
| 413 | (let ((mod (buffer-modified-p))) | 414 | (longlines-wrap-region (point-min) (point-max)))) |
| 414 | (longlines-wrap-region (point-min) (point-max)) | ||
| 415 | (set-buffer-modified-p mod)))) | ||
| 416 | 415 | ||
| 417 | ;; Isearch | 416 | ;; Isearch |
| 418 | 417 | ||