# HG changeset patch # User Chong Yidong # Date 1183918090 0 # Node ID fa467ab99f581310caa40c0074473dd326d208f4 # Parent cc8cd7525cf05008e204cd0dd53da197cff55f3e (longlines-wrap-region): Avoid marking buffer as modified. (longlines-auto-wrap, longlines-window-change-function): Remove unnecessary calls to set-buffer-modified-p. diff -r cc8cd7525cf0 -r fa467ab99f58 lisp/longlines.el --- a/lisp/longlines.el Thu Jul 05 22:12:47 2007 +0000 +++ b/lisp/longlines.el Sun Jul 08 18:08:10 2007 +0000 @@ -223,16 +223,18 @@ "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 @@ (> (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 `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