Mercurial > emacs
comparison lisp/files.el @ 90488:4094c5298ae1
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 314-319)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 107)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-78
author | Miles Bader <miles@gnu.org> |
---|---|
date | Tue, 20 Jun 2006 07:35:06 +0000 |
parents | 138027c8c982 49d0fb4a69d7 |
children | 138ce2701550 |
comparison
equal
deleted
inserted
replaced
90487:ef80dfaa8269 | 90488:4094c5298ae1 |
---|---|
1512 ;; It is confusing to ask whether to visit | 1512 ;; It is confusing to ask whether to visit |
1513 ;; non-literally if they have the file in | 1513 ;; non-literally if they have the file in |
1514 ;; hexl-mode. | 1514 ;; hexl-mode. |
1515 (not (eq major-mode 'hexl-mode))) | 1515 (not (eq major-mode 'hexl-mode))) |
1516 (if (buffer-modified-p) | 1516 (if (buffer-modified-p) |
1517 (if (y-or-n-p (if rawfile | 1517 (if (y-or-n-p |
1518 "Save file and revisit literally? " | 1518 (format |
1519 "Save file and revisit non-literally? ")) | 1519 (if rawfile |
1520 "The file %s is already visited normally, | |
1521 and you have edited the buffer. Now you have asked to visit it literally, | |
1522 meaning no coding system handling, format conversion, or local variables. | |
1523 Emacs can only visit a file in one way at a time. | |
1524 | |
1525 Do you want to save the file, and visit it literally instead? " | |
1526 "The file %s is already visited literally, | |
1527 meaning no coding system handling, format conversion, or local variables. | |
1528 You have edited the buffer. Now you have asked to visit the file normally, | |
1529 but Emacs can only visit a file in one way at a time. | |
1530 | |
1531 Do you want to save the file, and visit it normally instead? ") | |
1532 (file-name-nondirectory filename))) | |
1520 (progn | 1533 (progn |
1521 (save-buffer) | 1534 (save-buffer) |
1522 (find-file-noselect-1 buf filename nowarn | 1535 (find-file-noselect-1 buf filename nowarn |
1523 rawfile truename number)) | 1536 rawfile truename number)) |
1524 (if (y-or-n-p (if rawfile | 1537 (if (y-or-n-p |
1525 "Discard your edits and revisit file literally? " | 1538 (format |
1526 "Discard your edits and revisit file non-literally? ")) | 1539 (if rawfile |
1540 "\ | |
1541 Do you want to discard your changes, and visit the file literally now? " | |
1542 "\ | |
1543 Do you want to discard your changes, and visit the file normally now? "))) | |
1527 (find-file-noselect-1 buf filename nowarn | 1544 (find-file-noselect-1 buf filename nowarn |
1528 rawfile truename number) | 1545 rawfile truename number) |
1529 (error (if rawfile "File already visited non-literally" | 1546 (error (if rawfile "File already visited non-literally" |
1530 "File already visited literally")))) | 1547 "File already visited literally")))) |
1531 (if (y-or-n-p (if rawfile | 1548 (if (y-or-n-p |
1532 "Revisit file literally? " | 1549 (format |
1533 "Revisit file non-literally? ")) | 1550 (if rawfile |
1551 "The file %s is already visited normally. | |
1552 You have asked to visit it literally, | |
1553 meaning no coding system decoding, format conversion, or local variables. | |
1554 But Emacs can only visit a file in one way at a time. | |
1555 | |
1556 Do you want to revisit the file literally now? " | |
1557 "The file %s is already visited literally, | |
1558 meaning no coding system decoding, format conversion, or local variables. | |
1559 You have asked to visit it normally, | |
1560 but Emacs can only visit a file in one way at a time. | |
1561 | |
1562 Do you want to revisit the file normally now? ") | |
1563 (file-name-nondirectory filename))) | |
1534 (find-file-noselect-1 buf filename nowarn | 1564 (find-file-noselect-1 buf filename nowarn |
1535 rawfile truename number) | 1565 rawfile truename number) |
1536 (error (if rawfile "File already visited non-literally" | 1566 (error (if rawfile "File already visited non-literally" |
1537 "File already visited literally")))))) | 1567 "File already visited literally")))))) |
1538 ;; Return the buffer we are using. | 1568 ;; Return the buffer we are using. |
3629 (unless succeed | 3659 (unless succeed |
3630 (set-visited-file-modtime old-modtime))) | 3660 (set-visited-file-modtime old-modtime))) |
3631 ;; Since we have created an entirely new file, | 3661 ;; Since we have created an entirely new file, |
3632 ;; make sure it gets the right permission bits set. | 3662 ;; make sure it gets the right permission bits set. |
3633 (setq setmodes (or setmodes | 3663 (setq setmodes (or setmodes |
3634 (cons (or (file-modes buffer-file-name) umask) | 3664 (cons (or (file-modes buffer-file-name) |
3665 (logand ?\666 umask)) | |
3635 buffer-file-name))) | 3666 buffer-file-name))) |
3636 ;; We succeeded in writing the temp file, | 3667 ;; We succeeded in writing the temp file, |
3637 ;; so rename it. | 3668 ;; so rename it. |
3638 (rename-file tempname buffer-file-name t)) | 3669 (rename-file tempname buffer-file-name t)) |
3639 ;; If file not writable, see if we can make it writable | 3670 ;; If file not writable, see if we can make it writable |