aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2002-09-11 02:03:24 +0000
committerRichard M. Stallman <[email protected]>2002-09-11 02:03:24 +0000
commit5794dd61a086e3e7b008bcac26db1181ec66cb1b (patch)
tree4069494ddd882a75027aaa856d81a8cf80b52227
parent37d66095580c7ead78a88b6d1ac46edfdb94d5c4 (diff)
(Fdo_auto_save): Catch error making directory.
Only call push_message if we need to. At the same time, make an unwind-protect to pop it. Rename local message_p to old_message_p. (do_auto_save_make_dir, do_auto_save_eh): New functions. (do_auto_save_unwind): Don't call pop_message.
-rw-r--r--src/fileio.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/fileio.c b/src/fileio.c
index f515442be3..e48776b18a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5566,7 +5566,6 @@ do_auto_save_unwind (stream) /* used as unwind-protect function */
if (!NILP (stream))
fclose ((FILE *) (XFASTINT (XCAR (stream)) << 16
| XFASTINT (XCDR (stream))));
- pop_message ();
return Qnil;
}
@@ -5578,6 +5577,20 @@ do_auto_save_unwind_1 (value) /* used as unwind-protect function */
return Qnil;
}
+static Lisp_Object
+do_auto_save_make_dir (dir)
+ Lisp_Object dir;
+{
+ return call2 (Qmake_directory, dir, Qt);
+}
+
+static Lisp_Object
+do_auto_save_eh (ignore)
+ Lisp_Object ignore;
+{
+ return Qnil;
+}
+
DEFUN ("do-auto-save", Fdo_auto_save, Sdo_auto_save, 0, 2, "",
doc: /* Auto-save all buffers that need it.
This is all buffers that have auto-saving enabled
@@ -5601,7 +5614,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
Lisp_Object lispstream;
int count = SPECPDL_INDEX ();
int orig_minibuffer_auto_raise = minibuffer_auto_raise;
- int message_p = 0;
+ int old_message_p = 0;
if (max_specpdl_size < specpdl_size + 40)
max_specpdl_size = specpdl_size + 40;
@@ -5609,8 +5622,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
if (minibuf_level)
no_message = Qt;
- if (NILP (no_message));
- message_p = push_message ();
+ if (NILP (no_message))
+ {
+ old_message_p = push_message ();
+ record_unwind_protect (pop_message_unwind, Qnil);
+ }
/* Ordinarily don't quit within this function,
but don't make it impossible to quit (in case we get hung in I/O). */
@@ -5637,7 +5653,9 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
Lisp_Object dir;
dir = Ffile_name_directory (listfile);
if (NILP (Ffile_directory_p (dir)))
- call2 (Qmake_directory, dir, Qt);
+ internal_condition_case_1 (do_auto_save_make_dir,
+ dir, Fcons (Fcons (Qfile_error, Qnil), Qnil),
+ do_auto_save_eh);
}
stream = fopen (SDATA (listfile), "w");
@@ -5765,17 +5783,22 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
if (auto_saved && NILP (no_message))
{
- if (message_p)
+ if (old_message_p)
{
+ /* If we are going to restore an old message,
+ give time to read ours. */
sit_for (1, 0, 0, 0, 0);
restore_message ();
}
else
+ /* If we displayed a message and then restored a state
+ with no message, leave a "done" message on the screen. */
message1 ("Auto-saving...done");
}
Vquit_flag = oquit;
+ /* This restores the message-stack status. */
unbind_to (count, Qnil);
return Qnil;
}