[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: recover-session doesn't
From: |
Edward Welbourne |
Subject: |
Re: recover-session doesn't |
Date: |
Fri, 16 Aug 2002 16:26:59 +0200 |
> Could you try stepping through the command recover-session-finish
> and see why it did not ask you about the files?
OK, finally did that (got caught out by C-M-delete not being
backwards-delete-sexp ... or, at least, not getting through to emacs
even if it is, because M is spelt Alt) and all is clear. The problem
is that
* I nearly always have nearly all files saved (extensive use of M-x
compile, plus neurotic tendencies in any case)
* I was expecting recover-session to recover my session state, not
just the files I had edited without saving - i.e. I expected it to
visit the files I was visiting (and ideally restore the buffer
names I'd given them, though that's perhaps asking a bit much).
So scratch the bug report and substitute a feature request;
[at your option, only when given a prefix argument] I'd like
recover-session to visit the files for which auto-file is missing,
as well as (as at present) doing recover-file on the ones whose
auto-file is present.
then it would deserve the name recover-session, as opposed to
recover-edited-files-from-session, which would better describe its
present effect. The desired feature [without support for the prefix
aspect] may be implemented by the following: <patch>
diff -c /home/eddy/.sys/elisp/files.orig.el /home/eddy/.sys/elisp/files.el
*** /home/eddy/.sys/elisp/files.orig.el Fri Aug 2 15:49:36 2002
--- /home/eddy/.sys/elisp/files.el Fri Aug 16 16:15:32 2002
***************
*** 3415,3420 ****
--- 3415,3421 ----
;; Get the name of the session file to recover from.
(let ((file (dired-get-filename))
files
+ visits
(buffer (get-buffer-create " *recover*")))
(dired-unmark 1)
(dired-do-flagged-delete t)
***************
*** 3424,3432 ****
(set-buffer buffer)
(erase-buffer)
(insert-file-contents file)
! ;; Loop thru the text of that file
! ;; and get out the names of the files to recover.
(while (not (eobp))
(let (thisfile autofile)
(if (eolp)
;; This is a pair of lines for a non-file-visiting buffer.
--- 3425,3437 ----
(set-buffer buffer)
(erase-buffer)
(insert-file-contents file)
! ;; The file contains a pair of line for each auto-saved buffer.
! ;; Loop thru the text of that file and get out the names of
! ;; the files to recover.
(while (not (eobp))
+ ;; The first line of the pair contains the visited file name
+ ;; or is empty if the buffer was not visiting a file.
+ ;; The second line is the auto-save file name.
(let (thisfile autofile)
(if (eolp)
;; This is a pair of lines for a non-file-visiting buffer.
***************
*** 3458,3471 ****
(buffer-substring-no-properties
(point) (progn (end-of-line) (point))))
(forward-line 1)))
! ;; Ignore a file if its auto-save file does not exist now.
(if (file-exists-p autofile)
! (setq files (cons thisfile files)))))
(setq files (nreverse files))
- ;; The file contains a pair of line for each auto-saved buffer.
- ;; The first line of the pair contains the visited file name
- ;; or is empty if the buffer was not visiting a file.
- ;; The second line is the auto-save file name.
(if files
(map-y-or-n-p "Recover %s? "
(lambda (file)
--- 3463,3474 ----
(buffer-substring-no-properties
(point) (progn (end-of-line) (point))))
(forward-line 1)))
! ;; If its auto-save file exists now, recover it; else reload.
(if (file-exists-p autofile)
! (setq files (cons thisfile files))
! (setq visits (cons thisfile visits)))))
! (setq visits (nreverse visits))
(setq files (nreverse files))
(if files
(map-y-or-n-p "Recover %s? "
(lambda (file)
***************
*** 3475,3481 ****
"Failed to recover `%s'" file)))
files
'("file" "files" "recover"))
! (message "No files can be recovered from this session now")))
(kill-buffer buffer))))
(defun kill-some-buffers (&optional list)
--- 3478,3493 ----
"Failed to recover `%s'" file)))
files
'("file" "files" "recover"))
! (message "No files can be recovered from this session now"))
! (if visits
! (map-y-or-n-p "Reload %s? "
! (lambda (file)
! (condition-case nil
! (save-excursion (find-file file))
! (error
! "Failed to reload `%s'" file)))
! visits
! '("file" "files" "reload"))))
(kill-buffer buffer))))
(defun kill-some-buffers (&optional list)
</patch> Note that I've repositioned some comment lines - explaining
the file format seemed more sensible at the start of parsing rather
than just after the end.
I note that byte-compiling files.el also produces some grumbles:
<quote src="*Compile-Log*">
Compiling file /home/eddy/.sys/elisp/files.el at Fri Aug 16 16:09:23 2002
While compiling read-directory-name:
** read-file-name called with 6 arguments, but accepts only 1-5
While compiling make-auto-save-file-name:
** make-temp-file called with 3 arguments, but accepts only 1-2
While compiling save-buffers-kill-emacs:
** list-processes called with 1 argument, but accepts only 0
While compiling the end of the data:
** The following functions are not known to be defined:
msdos-long-file-names, defvaralias, locate-file-internal,
test-completion, w32-long-file-name, dos-8+3-filename,
file-system-info, vms-read-directory, process-query-on-exit-flag
</quote>
Eddy.
- Re: recover-session doesn't, (continued)
Re: recover-session doesn't, Richard Stallman, 2002/08/02
Re: recover-session doesn't, Richard Stallman, 2002/08/01
Re: recover-session doesn't,
Edward Welbourne <=