diff options
| author | Martin Rudalics | 2007-11-30 09:01:17 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2007-11-30 09:01:17 +0000 |
| commit | fc0eafe10aa572dd4755e5f670c7e0e220f1272e (patch) | |
| tree | 9f4275f1cea0b8dd87b108efa4bd9f508bef4d45 | |
| parent | 1a7170471356a5d4b6f4b0ab543894f47d2e9b9e (diff) | |
| download | emacs-fc0eafe10aa572dd4755e5f670c7e0e220f1272e.tar.gz emacs-fc0eafe10aa572dd4755e5f670c7e0e220f1272e.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/longlines.el | 24 |
2 files changed, 24 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 90c6b988e04..b0de7fabde2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2007-11-30 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * longlines.el (longlines-show-hard-newlines): Remove handling of | ||
| 4 | buffer-undo-list and buffer-modified status. | ||
| 5 | (longlines-show-region, longlines-unshow-hard-newlines): Handle | ||
| 6 | buffer-undo-list, buffer-modified status, inhibit-read-only, and | ||
| 7 | inhibit-modification-hooks here to avoid that a buffer appears | ||
| 8 | modified when toggling visibility of hard newlines. | ||
| 9 | |||
| 1 | 2007-11-30 Glenn Morris <rgm@gnu.org> | 10 | 2007-11-30 Glenn Morris <rgm@gnu.org> |
| 2 | 11 | ||
| 3 | * nxml/rng-maint.el (rng-do-some-validation): Fix declaration. | 12 | * nxml/rng-maint.el (rng-do-some-validation): Fix declaration. |
diff --git a/lisp/longlines.el b/lisp/longlines.el index f043a48c737..57b5742751f 100644 --- a/lisp/longlines.el +++ b/lisp/longlines.el | |||
| @@ -207,33 +207,39 @@ major mode changes." | |||
| 207 | "Make hard newlines visible by adding a face. | 207 | "Make hard newlines visible by adding a face. |
| 208 | With optional argument ARG, make the hard newlines invisible again." | 208 | With optional argument ARG, make the hard newlines invisible again." |
| 209 | (interactive "P") | 209 | (interactive "P") |
| 210 | (let ((buffer-undo-list t) | ||
| 211 | (mod (buffer-modified-p))) | ||
| 212 | (if arg | 210 | (if arg |
| 213 | (longlines-unshow-hard-newlines) | 211 | (longlines-unshow-hard-newlines) |
| 214 | (setq longlines-showing t) | 212 | (setq longlines-showing t) |
| 215 | (longlines-show-region (point-min) (point-max))) | 213 | (longlines-show-region (point-min) (point-max)))) |
| 216 | (set-buffer-modified-p mod))) | ||
| 217 | 214 | ||
| 218 | (defun longlines-show-region (beg end) | 215 | (defun longlines-show-region (beg end) |
| 219 | "Make hard newlines between BEG and END visible." | 216 | "Make hard newlines between BEG and END visible." |
| 220 | (let* ((pmin (min beg end)) | 217 | (let* ((pmin (min beg end)) |
| 221 | (pmax (max beg end)) | 218 | (pmax (max beg end)) |
| 222 | (pos (text-property-not-all pmin pmax 'hard nil)) | 219 | (pos (text-property-not-all pmin pmax 'hard nil)) |
| 223 | (inhibit-read-only t)) | 220 | (mod (buffer-modified-p)) |
| 221 | (buffer-undo-list t) | ||
| 222 | (inhibit-read-only t) | ||
| 223 | (inhibit-modification-hooks t)) | ||
| 224 | (while pos | 224 | (while pos |
| 225 | (put-text-property pos (1+ pos) 'display | 225 | (put-text-property pos (1+ pos) 'display |
| 226 | (copy-sequence longlines-show-effect)) | 226 | (copy-sequence longlines-show-effect)) |
| 227 | (setq pos (text-property-not-all (1+ pos) pmax 'hard nil))))) | 227 | (setq pos (text-property-not-all (1+ pos) pmax 'hard nil))) |
| 228 | (restore-buffer-modified-p mod))) | ||
| 228 | 229 | ||
| 229 | (defun longlines-unshow-hard-newlines () | 230 | (defun longlines-unshow-hard-newlines () |
| 230 | "Make hard newlines invisible again." | 231 | "Make hard newlines invisible again." |
| 231 | (interactive) | 232 | (interactive) |
| 232 | (setq longlines-showing nil) | 233 | (setq longlines-showing nil) |
| 233 | (let ((pos (text-property-not-all (point-min) (point-max) 'hard nil))) | 234 | (let ((pos (text-property-not-all (point-min) (point-max) 'hard nil)) |
| 235 | (mod (buffer-modified-p)) | ||
| 236 | (buffer-undo-list t) | ||
| 237 | (inhibit-read-only t) | ||
| 238 | (inhibit-modification-hooks t)) | ||
| 234 | (while pos | 239 | (while pos |
| 235 | (remove-text-properties pos (1+ pos) '(display)) | 240 | (remove-text-properties pos (1+ pos) '(display)) |
| 236 | (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil))))) | 241 | (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil))) |
| 242 | (restore-buffer-modified-p mod))) | ||
| 237 | 243 | ||
| 238 | ;; Wrapping the paragraphs. | 244 | ;; Wrapping the paragraphs. |
| 239 | 245 | ||