comparison lisp/files.el @ 3714:cee87f8de64b

[xemacs-hg @ 2006-11-30 07:29:34 by michaels] 2006-11-28 Mike Sperber <mike@xemacs.org> * files.el (revert-buffer-internal): Determine the coding system while still in the original buffer, rather than the new one.
author michaels
date Thu, 30 Nov 2006 07:29:36 +0000
parents 305157cf3ebb
children f901409b074b
comparison
equal deleted inserted replaced
3713:8109a63bce88 3714:cee87f8de64b
3510 (defun revert-buffer-internal (&optional file-name) 3510 (defun revert-buffer-internal (&optional file-name)
3511 "Read contents of FILE-NAME into a buffer, and compare to current buffer. 3511 "Read contents of FILE-NAME into a buffer, and compare to current buffer.
3512 Return nil if identical, and the new buffer if different." 3512 Return nil if identical, and the new buffer if different."
3513 3513
3514 (let* ((newbuf (get-buffer-create " *revert*")) 3514 (let* ((newbuf (get-buffer-create " *revert*"))
3515 bmin bmax) 3515 bmin bmax
3516 ;; #### b-f-c-s is _not necessarily_ the coding system that
3517 ;; was used to read in the file. See its docstring.
3518 (coding-system buffer-file-coding-system))
3516 (save-excursion 3519 (save-excursion
3517 (set-buffer newbuf) 3520 (set-buffer newbuf)
3518 (with-obsolete-variable '(before-change-function after-change-function) 3521 (with-obsolete-variable '(before-change-function after-change-function)
3519 (let (buffer-read-only 3522 (let (buffer-read-only
3520 (buffer-undo-list t) 3523 (buffer-undo-list t)
3521 after-change-function 3524 after-change-function
3522 after-change-functions 3525 after-change-functions
3523 before-change-function 3526 before-change-function
3524 before-change-functions 3527 before-change-functions
3525 ;; #### b-f-c-s is _not necessarily_ the coding system that 3528 (coding-system-for-read coding-system)
3526 ;; was used to read in the file. See its docstring. 3529 )
3527 (coding-system-for-read buffer-file-coding-system))
3528 (if revert-buffer-insert-file-contents-function 3530 (if revert-buffer-insert-file-contents-function
3529 (funcall revert-buffer-insert-file-contents-function 3531 (funcall revert-buffer-insert-file-contents-function
3530 file-name nil) 3532 file-name nil)
3531 (if (not (file-exists-p file-name)) 3533 (if (not (file-exists-p file-name))
3532 (error "File %s no longer exists!" file-name)) 3534 (error "File %s no longer exists!" file-name))