comparison lisp/files.el @ 83548:c71725faff1a

Merged from emacs@sv.gnu.org. Last-minute emacsclient rewrites be damned! Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-490 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-491 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-492 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-493 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-494 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-495 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-496 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-497 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-498 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-499 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-500 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-501 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-502 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-503 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-504 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-505 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-506 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-507 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-508 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-509 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-510 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-511 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-512 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-513 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-514 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-515 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-516 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-517 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-518 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-519 Update from CVS: etc/TUTORIAL.cn: Updated. * emacs@sv.gnu.org/emacs--devo--0--patch-520 Merge from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-521 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-522 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-523 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-524 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-525 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-526 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-527 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-528 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-529 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-530 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-531 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-532 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-533 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-534 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-535 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-161 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-162 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-163 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-164 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-165 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-166 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-167 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-168 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-169 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-170 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-588
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 03 Dec 2006 15:03:30 +0000
parents 2d56e13fd23d 7e0bda309a90
children 17e0dd217877
comparison
equal deleted inserted replaced
83547:0912b745fc75 83548:c71725faff1a
1531 ;; non-literally if they have the file in 1531 ;; non-literally if they have the file in
1532 ;; hexl-mode. 1532 ;; hexl-mode.
1533 (not (eq major-mode 'hexl-mode))) 1533 (not (eq major-mode 'hexl-mode)))
1534 (if (buffer-modified-p) 1534 (if (buffer-modified-p)
1535 (if (y-or-n-p 1535 (if (y-or-n-p
1536 (format 1536 (format
1537 (if rawfile 1537 (if rawfile
1538 "The file %s is already visited normally, 1538 "The file %s is already visited normally,
1539 and you have edited the buffer. Now you have asked to visit it literally, 1539 and you have edited the buffer. Now you have asked to visit it literally,
1540 meaning no coding system handling, format conversion, or local variables. 1540 meaning no coding system handling, format conversion, or local variables.
1541 Emacs can only visit a file in one way at a time. 1541 Emacs can only visit a file in one way at a time.
1551 (progn 1551 (progn
1552 (save-buffer) 1552 (save-buffer)
1553 (find-file-noselect-1 buf filename nowarn 1553 (find-file-noselect-1 buf filename nowarn
1554 rawfile truename number)) 1554 rawfile truename number))
1555 (if (y-or-n-p 1555 (if (y-or-n-p
1556 (format 1556 (format
1557 (if rawfile 1557 (if rawfile
1558 "\ 1558 "\
1559 Do you want to discard your changes, and visit the file literally now? " 1559 Do you want to discard your changes, and visit the file literally now? "
1560 "\ 1560 "\
1561 Do you want to discard your changes, and visit the file normally now? "))) 1561 Do you want to discard your changes, and visit the file normally now? ")))
1562 (find-file-noselect-1 buf filename nowarn 1562 (find-file-noselect-1 buf filename nowarn
1563 rawfile truename number) 1563 rawfile truename number)
1564 (error (if rawfile "File already visited non-literally" 1564 (error (if rawfile "File already visited non-literally"
1565 "File already visited literally")))) 1565 "File already visited literally"))))
1566 (if (y-or-n-p 1566 (if (y-or-n-p
1567 (format 1567 (format
1568 (if rawfile 1568 (if rawfile
1569 "The file %s is already visited normally. 1569 "The file %s is already visited normally.
1570 You have asked to visit it literally, 1570 You have asked to visit it literally,
1571 meaning no coding system decoding, format conversion, or local variables. 1571 meaning no coding system decoding, format conversion, or local variables.
1572 But Emacs can only visit a file in one way at a time. 1572 But Emacs can only visit a file in one way at a time.
2819 (if (string= new-name "") 2819 (if (string= new-name "")
2820 (error "Empty file name")))) 2820 (error "Empty file name"))))
2821 (let ((buffer (and filename (find-buffer-visiting filename)))) 2821 (let ((buffer (and filename (find-buffer-visiting filename))))
2822 (and buffer (not (eq buffer (current-buffer))) 2822 (and buffer (not (eq buffer (current-buffer)))
2823 (not no-query) 2823 (not no-query)
2824 (not (y-or-n-p (message "A buffer is visiting %s; proceed? " 2824 (not (y-or-n-p (format "A buffer is visiting %s; proceed? "
2825 filename))) 2825 filename)))
2826 (error "Aborted"))) 2826 (error "Aborted")))
2827 (or (equal filename buffer-file-name) 2827 (or (equal filename buffer-file-name)
2828 (progn 2828 (progn
2829 (and filename (lock-buffer filename)) 2829 (and filename (lock-buffer filename))
2830 (unlock-buffer))) 2830 (unlock-buffer)))
4080 ((not (file-exists-p file-name)) 4080 ((not (file-exists-p file-name))
4081 (error (if buffer-file-number 4081 (error (if buffer-file-number
4082 "File %s no longer exists!" 4082 "File %s no longer exists!"
4083 "Cannot revert nonexistent file %s") 4083 "Cannot revert nonexistent file %s")
4084 file-name)) 4084 file-name))
4085 ((not (file-readable-p file-name))
4086 (error (if buffer-file-number
4087 "File %s no longer readable!"
4088 "Cannot revert unreadable file %s")
4089 file-name))
4085 (t 4090 (t
4086 ;; Bind buffer-file-name to nil 4091 ;; Bind buffer-file-name to nil
4087 ;; so that we don't try to lock the file. 4092 ;; so that we don't try to lock the file.
4088 (let ((buffer-file-name nil)) 4093 (let ((buffer-file-name nil))
4089 (or auto-save-p 4094 (or auto-save-p
4093 ;; Auto-saved file should be read by Emacs' 4098 ;; Auto-saved file should be read by Emacs'
4094 ;; internal coding. 4099 ;; internal coding.
4095 (if auto-save-p 'auto-save-coding 4100 (if auto-save-p 'auto-save-coding
4096 (or coding-system-for-read 4101 (or coding-system-for-read
4097 buffer-file-coding-system-explicit)))) 4102 buffer-file-coding-system-explicit))))
4103 (if (and (not enable-multibyte-characters)
4104 coding-system-for-read
4105 (not (memq (coding-system-base
4106 coding-system-for-read)
4107 '(no-conversion raw-text))))
4108 ;; As a coding system suitable for multibyte
4109 ;; buffer is specified, make the current
4110 ;; buffer multibyte.
4111 (set-buffer-multibyte t))
4112
4098 ;; This force after-insert-file-set-coding 4113 ;; This force after-insert-file-set-coding
4099 ;; (called from insert-file-contents) to set 4114 ;; (called from insert-file-contents) to set
4100 ;; buffer-file-coding-system to a proper value. 4115 ;; buffer-file-coding-system to a proper value.
4101 (kill-local-variable 'buffer-file-coding-system) 4116 (kill-local-variable 'buffer-file-coding-system)
4102 4117