summaryrefslogtreecommitdiff
path: root/lisp/longlines.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2007-07-08 18:08:10 +0000
committerChong Yidong <cyd@stupidchicken.com>2007-07-08 18:08:10 +0000
commitb95d7932f557aaa15429c9f33a05d42f4f56f4f6 (patch)
tree39ccfdd2a42d8dae01bda7501871ca79f1d064a5 /lisp/longlines.el
parent3e318d972dc501cc609976db863bffb196e6ab0b (diff)
downloademacs-b95d7932f557aaa15429c9f33a05d42f4f56f4f6.tar.gz
(longlines-wrap-region): Avoid marking buffer as modified.
(longlines-auto-wrap, longlines-window-change-function): Remove unnecessary calls to set-buffer-modified-p.
Diffstat (limited to 'lisp/longlines.el')
-rw-r--r--lisp/longlines.el29
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."
"Wrap each successive line, starting with the line before BEG.
Stop when we reach lines after END that don't need wrapping, or the
end of the buffer."
- (setq longlines-wrap-point (point))
- (goto-char beg)
- (forward-line -1)
- ;; Two successful longlines-wrap-line's in a row mean successive
- ;; lines don't need wrapping.
- (while (null (and (longlines-wrap-line)
- (or (eobp)
- (and (>= (point) end)
- (longlines-wrap-line))))))
- (goto-char longlines-wrap-point))
+ (let ((mod (buffer-modified-p)))
+ (setq longlines-wrap-point (point))
+ (goto-char beg)
+ (forward-line -1)
+ ;; Two successful longlines-wrap-line's in a row mean successive
+ ;; lines don't need wrapping.
+ (while (null (and (longlines-wrap-line)
+ (or (eobp)
+ (and (>= (point) end)
+ (longlines-wrap-line))))))
+ (goto-char longlines-wrap-point)
+ (set-buffer-modified-p mod)))
(defun longlines-wrap-line ()
"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."
(> (prefix-numeric-value arg) 0)
(not longlines-auto-wrap)))
(if arg
- (let ((mod (buffer-modified-p)))
+ (progn
(setq longlines-auto-wrap t)
(longlines-wrap-region (point-min) (point-max))
- (set-buffer-modified-p mod)
(message "Auto wrap enabled."))
(setq longlines-auto-wrap nil)
(message "Auto wrap disabled.")))
@@ -410,9 +411,7 @@ This is called by `post-command-hook' after each command."
This is called by `window-configuration-change-hook'."
(when (/= fill-column (- (window-width) window-min-width))
(setq fill-column (- (window-width) window-min-width))
- (let ((mod (buffer-modified-p)))
- (longlines-wrap-region (point-min) (point-max))
- (set-buffer-modified-p mod))))
+ (longlines-wrap-region (point-min) (point-max))))
;; Isearch