From: Edward Welbourne <eddy@opera.no>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: recover-session doesn't
Date: Fri, 16 Aug 2002 16:26:59 +0200 [thread overview]
Message-ID: <E17fi43-0000sg-00@whorl.intern.opera.no> (raw)
In-Reply-To: <200207310555.g6V5tDO16550@aztec.santafe.edu> (message from Richard Stallman on Tue, 30 Jul 2002 23:55:13 -0600 (MDT))
> 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.
next prev parent reply other threads:[~2002-08-16 14:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-10 17:03 recover-session doesn't Edward Welbourne
2002-07-11 12:01 ` Richard Stallman
2002-07-30 16:30 ` Edward Welbourne
2002-07-31 5:55 ` Richard Stallman
2002-07-31 8:27 ` Edward Welbourne
2002-08-01 5:26 ` Eli Zaretskii
2002-08-01 8:58 ` Edward Welbourne
2002-08-01 16:20 ` Eli Zaretskii
2002-08-02 6:12 ` Richard Stallman
2002-08-02 8:25 ` Edward Welbourne
2002-08-02 9:03 ` Andreas Schwab
2002-08-02 13:52 ` Edward Welbourne
2002-08-02 11:21 ` fabrice bauzac
2002-08-02 13:44 ` Paul D. Smith
2002-08-02 6:12 ` Richard Stallman
2002-08-01 16:51 ` Richard Stallman
2002-08-16 14:26 ` Edward Welbourne [this message]
2002-08-17 4:51 ` Richard Stallman
2002-08-19 8:29 ` Edward Welbourne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E17fi43-0000sg-00@whorl.intern.opera.no \
--to=eddy@opera.no \
--cc=bug-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.