aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2007-07-08 18:05:53 +0000
committerChong Yidong2007-07-08 18:05:53 +0000
commit7aa8eec2fbf6c79f2e1ec2dcbbdacea311389538 (patch)
tree5d169373babec8a22dbd6670c45dbaf1b7fa31a1
parenta3721ebddc75adcdadd66f887bce710617587dfe (diff)
downloademacs-7aa8eec2fbf6c79f2e1ec2dcbbdacea311389538.tar.gz
emacs-7aa8eec2fbf6c79f2e1ec2dcbbdacea311389538.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.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."
223 "Wrap each successive line, starting with the line before BEG. 223 "Wrap each successive line, starting with the line before BEG.
224Stop when we reach lines after END that don't need wrapping, or the 224Stop when we reach lines after END that don't need wrapping, or the
225end of the buffer." 225end 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."
410This is called by `window-configuration-change-hook'." 411This 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