Mercurial > emacs
diff lisp/format.el @ 106785:a32698d5bb0c
(format-annotate-function): Only set
write-region-post-annotation-function after running to-fn so as not to
affect nested write-region calls (bug#5273).
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Sun, 10 Jan 2010 00:22:54 -0500 |
| parents | a0f778f4a995 |
| children | 1d1d5d9bd884 |
line wrap: on
line diff
--- a/lisp/format.el Sat Jan 09 19:39:05 2010 -0500 +++ b/lisp/format.el Sun Jan 10 00:22:54 2010 -0500 @@ -222,9 +222,6 @@ (multibyte enable-multibyte-characters) (coding-system buffer-file-coding-system)) (with-current-buffer copy-buf - (set (make-local-variable - 'write-region-post-annotation-function) - 'kill-buffer) (setq selective-display sel-disp) (set-buffer-multibyte multibyte) (setq buffer-file-coding-system coding-system)) @@ -232,6 +229,15 @@ (set-buffer copy-buf) (format-insert-annotations write-region-annotations-so-far from) (format-encode-run-method to-fn (point-min) (point-max) orig-buf) + (when (buffer-live-p copy-buf) + (with-current-buffer copy-buf + ;; Set write-region-post-annotation-function to + ;; delete the buffer once the write is done, but do + ;; it after running to-fn so it doesn't affect + ;; write-region calls in to-fn. + (set (make-local-variable + 'write-region-post-annotation-function) + 'kill-buffer))) nil) ;; Otherwise just call function, it will return annotations. (funcall to-fn from to orig-buf)))))
