Mercurial > emacs
comparison lisp/files.el @ 12050:b740095d6a47
(multiple-recover-finish): Renamed to recover-session-finish.
(recover-session): Changed binding.
(recover-session-finish): Doc fix; rewritten using map-y-or-n-p.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Thu, 01 Jun 1995 23:18:04 +0000 |
parents | ea774a7c610c |
children | 5d44c48f3b7b |
comparison
equal
deleted
inserted
replaced
12049:0be90c288c4e | 12050:b740095d6a47 |
---|---|
2097 (or (looking-at "Move to the session you want to recover,") | 2097 (or (looking-at "Move to the session you want to recover,") |
2098 (let ((inhibit-read-only t)) | 2098 (let ((inhibit-read-only t)) |
2099 (insert "Move to the session you want to recover,\n") | 2099 (insert "Move to the session you want to recover,\n") |
2100 (insert "then type C-c C-c to select it.\n\n"))) | 2100 (insert "then type C-c C-c to select it.\n\n"))) |
2101 (use-local-map (nconc (make-sparse-keymap) (current-local-map))) | 2101 (use-local-map (nconc (make-sparse-keymap) (current-local-map))) |
2102 (define-key (current-local-map) "\C-c\C-c" 'multiple-recover-finish)) | 2102 (define-key (current-local-map) "\C-c\C-c" 'recover-session-finish)) |
2103 | 2103 |
2104 (defun multiple-recover-finish () | 2104 (defun recover-session-finish () |
2105 "Choose one saved session to recover auto-save files from. | 2105 "Choose one saved session to recover auto-save files from. |
2106 This command is used in the special Dired buffer created by | 2106 This command is used in the special Dired buffer created by |
2107 M-x multiple-recover." | 2107 \\[recover-session]." |
2108 (interactive) | 2108 (interactive) |
2109 ;; Get the name of the session file to recover from. | 2109 ;; Get the name of the session file to recover from. |
2110 (let ((file (dired-get-filename)) | 2110 (let ((file (dired-get-filename)) |
2111 (buffer (get-buffer-create " *recover*"))) | 2111 (buffer (get-buffer-create " *recover*"))) |
2112 (unwind-protect | 2112 (unwind-protect |
2113 (save-excursion | 2113 (save-excursion |
2114 ;; Read in the auto-save-list file. | 2114 ;; Read in the auto-save-list file. |
2115 (set-buffer buffer) | 2115 (set-buffer buffer) |
2116 (erase-buffer) | 2116 (erase-buffer) |
2117 (insert-file-contents file) | 2117 (insert-file-contents file) |
2118 (while (not (eobp)) | 2118 (map-y-or-n-p "Recover %s? " |
2119 ;; Look at each file entry. | 2119 (lambda (file) (save-excursion (recover-file file))) |
2120 (and (not (eolp)) | 2120 (lambda () |
2121 (let ((edited-file | 2121 (if (eobp) |
2122 (buffer-substring (point) | 2122 nil |
2123 (save-excursion (end-of-line) (point))))) | 2123 (prog1 |
2124 ;; Offer to recover it. | 2124 (buffer-substring-no-properties |
2125 (if (y-or-n-p (format "Recover %s? " edited-file)) | 2125 (point) (progn (end-of-line) (point))) |
2126 (save-excursion | 2126 (while (and (eolp) (not (eobp))) |
2127 (recover-file edited-file))))) | 2127 (forward-line 2))))) |
2128 ;; Skip to the next entry. | 2128 '("file" "files" "recover"))) |
2129 (forward-line 2))) | |
2130 (kill-buffer buffer)))) | 2129 (kill-buffer buffer)))) |
2131 | 2130 |
2132 (defun kill-some-buffers () | 2131 (defun kill-some-buffers () |
2133 "For each buffer, ask whether to kill it." | 2132 "For each buffer, ask whether to kill it." |
2134 (interactive) | 2133 (interactive) |