comparison lisp/longlines.el @ 66465:9a896c723ab2

* longlines.el (longlines-mode): Bind after-change-functions to nil during initial decoding and final encoding.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 27 Oct 2005 01:36:31 +0000
parents ce840b1d13ad
children e10f2e7919f0
comparison
equal deleted inserted replaced
66464:7e8b1219a7db 66465:9a896c723ab2
4 4
5 ;; Authors: Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> 5 ;; Authors: Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
6 ;; Alex Schroeder <alex@gnu.org> 6 ;; Alex Schroeder <alex@gnu.org>
7 ;; Chong Yidong <cyd@stupidchicken.com> 7 ;; Chong Yidong <cyd@stupidchicken.com>
8 ;; Maintainer: Chong Yidong <cyd@stupidchicken.com> 8 ;; Maintainer: Chong Yidong <cyd@stupidchicken.com>
9 ;; Keywords: convenience 9 ;; Keywords: convenience, wp
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
117 (- (window-width) window-min-width)) 117 (- (window-width) window-min-width))
118 (add-hook 'window-configuration-change-hook 118 (add-hook 'window-configuration-change-hook
119 'longlines-window-change-function nil t)) 119 'longlines-window-change-function nil t))
120 (let ((buffer-undo-list t) 120 (let ((buffer-undo-list t)
121 (inhibit-read-only t) 121 (inhibit-read-only t)
122 (after-change-functions nil)
122 (mod (buffer-modified-p))) 123 (mod (buffer-modified-p)))
123 ;; Turning off undo is OK since (spaces + newlines) is 124 ;; Turning off undo is OK since (spaces + newlines) is
124 ;; conserved, except for a corner case in 125 ;; conserved, except for a corner case in
125 ;; longlines-wrap-lines that we'll never encounter from here 126 ;; longlines-wrap-lines that we'll never encounter from here
126 (save-restriction 127 (save-restriction
140 ;; Turn off longlines mode 141 ;; Turn off longlines mode
141 (setq buffer-file-format (delete 'longlines buffer-file-format)) 142 (setq buffer-file-format (delete 'longlines buffer-file-format))
142 (if longlines-showing 143 (if longlines-showing
143 (longlines-unshow-hard-newlines)) 144 (longlines-unshow-hard-newlines))
144 (let ((buffer-undo-list t) 145 (let ((buffer-undo-list t)
146 (after-change-functions nil)
145 (inhibit-read-only t)) 147 (inhibit-read-only t))
146 (save-restriction 148 (save-restriction
147 (widen) 149 (widen)
148 (longlines-encode-region (point-min) (point-max)))) 150 (longlines-encode-region (point-min) (point-max))))
149 (remove-hook 'change-major-mode-hook 'longlines-mode-off t) 151 (remove-hook 'change-major-mode-hook 'longlines-mode-off t)