# HG changeset patch # User Martin Rudalics # Date 1196413246 0 # Node ID 3f909380f612925833314b9089e1d21b1f353ea2 # Parent 8e090ad2134bd7140fbd8ab7b8af50a574f22dde (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. diff -r 8e090ad2134b -r 3f909380f612 lisp/longlines.el --- a/lisp/longlines.el Fri Nov 30 08:46:29 2007 +0000 +++ b/lisp/longlines.el Fri Nov 30 09:00:46 2007 +0000 @@ -207,33 +207,39 @@ "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.