Commit 7aa8eec2 authored by Chong Yidong's avatar Chong Yidong
Browse files

(longlines-wrap-region): Avoid marking buffer as modified.

(longlines-auto-wrap, longlines-window-change-function): Remove
unnecessary calls to set-buffer-modified-p.
parent a3721ebd
...@@ -223,6 +223,7 @@ With optional argument ARG, make the hard newlines invisible again." ...@@ -223,6 +223,7 @@ With optional argument ARG, make the hard newlines invisible again."
"Wrap each successive line, starting with the line before BEG. "Wrap each successive line, starting with the line before BEG.
Stop when we reach lines after END that don't need wrapping, or the Stop when we reach lines after END that don't need wrapping, or the
end of the buffer." end of the buffer."
(let ((mod (buffer-modified-p)))
(setq longlines-wrap-point (point)) (setq longlines-wrap-point (point))
(goto-char beg) (goto-char beg)
(forward-line -1) (forward-line -1)
...@@ -232,7 +233,8 @@ end of the buffer." ...@@ -232,7 +233,8 @@ end of the buffer."
(or (eobp) (or (eobp)
(and (>= (point) end) (and (>= (point) end)
(longlines-wrap-line)))))) (longlines-wrap-line))))))
(goto-char longlines-wrap-point)) (goto-char longlines-wrap-point)
(set-buffer-modified-p mod)))
(defun longlines-wrap-line () (defun longlines-wrap-line ()
"If the current line needs to be wrapped, wrap it and return nil. "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,10 +374,9 @@ If automatic line wrapping is turned on, wrap the entire buffer."
(> (prefix-numeric-value arg) 0) (> (prefix-numeric-value arg) 0)
(not longlines-auto-wrap))) (not longlines-auto-wrap)))
(if arg (if arg
(let ((mod (buffer-modified-p))) (progn
(setq longlines-auto-wrap t) (setq longlines-auto-wrap t)
(longlines-wrap-region (point-min) (point-max)) (longlines-wrap-region (point-min) (point-max))
(set-buffer-modified-p mod)
(message "Auto wrap enabled.")) (message "Auto wrap enabled."))
(setq longlines-auto-wrap nil) (setq longlines-auto-wrap nil)
(message "Auto wrap disabled."))) (message "Auto wrap disabled.")))
...@@ -410,9 +411,7 @@ This is called by `post-command-hook' after each command." ...@@ -410,9 +411,7 @@ This is called by `post-command-hook' after each command."
This is called by `window-configuration-change-hook'." This is called by `window-configuration-change-hook'."
(when (/= fill-column (- (window-width) window-min-width)) (when (/= fill-column (- (window-width) window-min-width))
(setq 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))))
(longlines-wrap-region (point-min) (point-max))
(set-buffer-modified-p mod))))
;; Isearch ;; Isearch
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment