comparison lisp/files.el @ 83554:b8d9a391daf3

Merged from emacs@sv.gnu.org Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-599 Merge from erc--main--0 * emacs@sv.gnu.org/emacs--devo--0--patch-600 Merge from erc--main--0 * emacs@sv.gnu.org/emacs--devo--0--patch-601 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-602 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-603 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-604 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-605 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-606 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-607 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-608 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-609 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-610 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-611 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-612 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-613 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-614 Make byte compiler correctly write circular constants * emacs@sv.gnu.org/emacs--devo--0--patch-615 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-616 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-617 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-618 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-192 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-193 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-194 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-195 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-196 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-594
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 29 Jan 2007 22:21:19 +0000
parents 32073cbc5eb6 d11aab871a28
children 07774e5c3ff5
comparison
equal deleted inserted replaced
83553:32073cbc5eb6 83554:b8d9a391daf3
1 ;;; files.el --- file input and output commands for Emacs 1 ;;; files.el --- file input and output commands for Emacs
2 2
3 ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996, 3 ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996,
4 ;; 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 4 ;; 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
5 ;; 2006 Free Software Foundation, Inc. 5 ;; 2006, 2007 Free Software Foundation, Inc.
6 6
7 ;; Maintainer: FSF 7 ;; Maintainer: FSF
8 8
9 ;; This file is part of GNU Emacs. 9 ;; This file is part of GNU Emacs.
10 10
1221 "Find alternate file: " file-dir nil nil file-name) 1221 "Find alternate file: " file-dir nil nil file-name)
1222 t))) 1222 t)))
1223 (unless (run-hook-with-args-until-failure 'kill-buffer-query-functions) 1223 (unless (run-hook-with-args-until-failure 'kill-buffer-query-functions)
1224 (error "Aborted")) 1224 (error "Aborted"))
1225 (when (and (buffer-modified-p) (buffer-file-name)) 1225 (when (and (buffer-modified-p) (buffer-file-name))
1226 (if (yes-or-no-p (format "Buffer %s is modified; save it first? " 1226 (if (yes-or-no-p (format "Buffer %s is modified; kill anyway? "
1227 (buffer-name))) 1227 (buffer-name)))
1228 (save-buffer) 1228 (unless (yes-or-no-p "Kill and replace the buffer without saving it? ")
1229 (unless (yes-or-no-p "Kill and replace the buffer without saving it? ") 1229 (error "Aborted"))
1230 (error "Aborted")))) 1230 (save-buffer)))
1231 (let ((obuf (current-buffer)) 1231 (let ((obuf (current-buffer))
1232 (ofile buffer-file-name) 1232 (ofile buffer-file-name)
1233 (onum buffer-file-number) 1233 (onum buffer-file-number)
1234 (odir dired-directory) 1234 (odir dired-directory)
1235 (otrue buffer-file-truename) 1235 (otrue buffer-file-truename)
2504 (if (< (line-number-at-pos) (window-body-height)) 2504 (if (< (line-number-at-pos) (window-body-height))
2505 "" 2505 ""
2506 ", or C-v to scroll"))) 2506 ", or C-v to scroll")))
2507 (goto-char (point-min)) 2507 (goto-char (point-min))
2508 (let ((cursor-in-echo-area t) 2508 (let ((cursor-in-echo-area t)
2509 (executing-kbd-macro executing-kbd-macro)
2509 (exit-chars 2510 (exit-chars
2510 (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g))) 2511 (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g)))
2511 done) 2512 done)
2512 (while (not done) 2513 (while (not done)
2513 (message prompt) 2514 (message prompt)
2514 (setq char (read-event)) 2515 (setq char (read-event))
2515 (if (numberp char) 2516 (if (numberp char)
2516 (if (eq char ?\C-v) 2517 (cond ((eq char ?\C-v)
2517 (condition-case nil 2518 (condition-case nil
2518 (scroll-up) 2519 (scroll-up)
2519 (error (goto-char (point-min)))) 2520 (error (goto-char (point-min)))))
2520 (setq done (memq (downcase char) exit-chars)))))) 2521 ;; read-event returns -1 if we are in a kbd
2522 ;; macro and there are no more events in the
2523 ;; macro. In that case, attempt to get an
2524 ;; event interactively.
2525 ((and executing-kbd-macro (= char -1))
2526 (setq executing-kbd-macro nil))
2527 (t (setq done (memq (downcase char) exit-chars)))))))
2521 (setq char (downcase char)) 2528 (setq char (downcase char))
2522 (when (and offer-save (= char ?!) unsafe-vars) 2529 (when (and offer-save (= char ?!) unsafe-vars)
2523 (dolist (elt unsafe-vars) 2530 (dolist (elt unsafe-vars)
2524 (add-to-list 'safe-local-variable-values elt)) 2531 (add-to-list 'safe-local-variable-values elt))
2525 ;; When this is called from desktop-restore-file-buffer, 2532 ;; When this is called from desktop-restore-file-buffer,