]> git.eshelyaron.com Git - emacs.git/commitdiff
(longlines-show-hard-newlines): Remove handling of
authorMartin Rudalics <rudalics@gmx.at>
Fri, 30 Nov 2007 09:01:17 +0000 (09:01 +0000)
committerMartin Rudalics <rudalics@gmx.at>
Fri, 30 Nov 2007 09:01:17 +0000 (09:01 +0000)
buffer-undo-list and buffer-modified status.
(longlines-show-region, longlines-unshow-hard-newlines): Handle
buffer-undo-list, buffer-modified status, inhibit-read-only, and
inhibit-modification-hooks here to avoid that a buffer appears
modified when toggling visibility of hard newlines.

lisp/ChangeLog
lisp/longlines.el

index 90c6b988e0488161f683a9a65a9f2b52b80941a4..b0de7fabde212a7a810d5650be1ed4196949f006 100644 (file)
@@ -1,3 +1,12 @@
+2007-11-30  Martin Rudalics  <rudalics@gmx.at>
+
+       * longlines.el (longlines-show-hard-newlines): Remove handling of
+       buffer-undo-list and buffer-modified status.
+       (longlines-show-region, longlines-unshow-hard-newlines): Handle
+       buffer-undo-list, buffer-modified status, inhibit-read-only, and
+       inhibit-modification-hooks here to avoid that a buffer appears
+       modified when toggling visibility of hard newlines.
+
 2007-11-30  Glenn Morris  <rgm@gnu.org>
 
        * nxml/rng-maint.el (rng-do-some-validation): Fix declaration.
index f043a48c7378cd8dbb9ad2c242b35183f6365cac..57b5742751f42ebd74ea7d62e9a0b3be23a7cc34 100644 (file)
@@ -207,33 +207,39 @@ major mode changes."
   "Make hard newlines visible by adding a face.
 With optional argument ARG, make the hard newlines invisible again."
   (interactive "P")
-  (let ((buffer-undo-list t)
-        (mod (buffer-modified-p)))
     (if arg
         (longlines-unshow-hard-newlines)
       (setq longlines-showing t)
-      (longlines-show-region (point-min) (point-max)))
-    (set-buffer-modified-p mod)))
+      (longlines-show-region (point-min) (point-max))))
 
 (defun longlines-show-region (beg end)
   "Make hard newlines between BEG and END visible."
   (let* ((pmin (min beg end))
          (pmax (max beg end))
          (pos (text-property-not-all pmin pmax 'hard nil))
-         (inhibit-read-only t))
+        (mod (buffer-modified-p))
+        (buffer-undo-list t)
+        (inhibit-read-only t)
+        (inhibit-modification-hooks t))
     (while pos
       (put-text-property pos (1+ pos) 'display
-                         (copy-sequence longlines-show-effect))
-      (setq pos (text-property-not-all (1+ pos) pmax 'hard nil)))))
+                        (copy-sequence longlines-show-effect))
+      (setq pos (text-property-not-all (1+ pos) pmax 'hard nil)))
+    (restore-buffer-modified-p mod)))
 
 (defun longlines-unshow-hard-newlines ()
   "Make hard newlines invisible again."
   (interactive)
   (setq longlines-showing nil)
-  (let ((pos (text-property-not-all (point-min) (point-max) 'hard nil)))
+  (let ((pos (text-property-not-all (point-min) (point-max) 'hard nil))
+       (mod (buffer-modified-p))
+       (buffer-undo-list t)
+       (inhibit-read-only t)
+       (inhibit-modification-hooks t))
     (while pos
       (remove-text-properties pos (1+ pos) '(display))
-      (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil)))))
+      (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil)))
+    (restore-buffer-modified-p mod)))
 
 ;; Wrapping the paragraphs.