Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
9aee5392
Commit
9aee5392
authored
Apr 30, 1995
by
Richard M. Stallman
Browse files
(multiple-recover, multiple-recover-finish): New commands.
parent
2725719a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
lisp/files.el
lisp/files.el
+44
-0
No files found.
lisp/files.el
View file @
9aee5392
...
...
@@ -2041,6 +2041,50 @@ beginning and `after-revert-hook' at the end."
(
after-find-file
nil
nil
t
))
(
t
(
error
"Recover-file cancelled."
)))))
(
defun
multiple-recover
()
"Recover auto save files from a previous Emacs session.
This command first displays a Dired buffer showing you the
previous sessions that you could recover from.
To choose one, move point to the proper line and then type C-c C-c.
Then you'll be asked about a number of files to recover."
(
interactive
)
(
dired
"~/.save*"
)
(
goto-char
(
point-min
))
(
or
(
looking-at
"Move to the session you want to recover,"
)
(
let
((
inhibit-read-only
t
))
(
insert
"Move to the session you want to recover,\n"
)
(
insert
"then type C-c C-c to select it.\n\n"
)))
(
use-local-map
(
nconc
(
make-sparse-keymap
)
(
current-local-map
)))
(
define-key
(
current-local-map
)
"\C-c\C-c"
'multiple-recover-finish
))
(
defun
multiple-recover-finish
()
"Choose one saved session to recover auto-save files from.
This command is used in the special Dired buffer created by
M-x multiple-recover."
(
interactive
)
;; Get the name of the session file to recover from.
(
let
((
file
(
dired-get-filename
))
(
buffer
(
get-buffer-create
" *recover*"
)))
(
unwind-protect
(
save-excursion
;; Read in the auto-save-list file.
(
set-buffer
buffer
)
(
erase-buffer
)
(
insert-file-contents
file
)
(
while
(
not
(
eobp
))
;; Look at each file entry.
(
and
(
not
(
eolp
))
(
let
((
edited-file
(
buffer-substring
(
point
)
(
save-excursion
(
end-of-line
)
(
point
)))))
;; Offer to recover it.
(
if
(
y-or-n-p
(
format
"Recover %s? "
edited-file
))
(
save-excursion
(
recover-file
edited-file
)))))
;; Skip to the next entry.
(
forward-line
2
)))
(
kill-buffer
buffer
))))
(
defun
kill-some-buffers
()
"For each buffer, ask whether to kill it."
(
interactive
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment