summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-02-25 20:46:59 +0000
committerRichard M. Stallman <rms@gnu.org>1996-02-25 20:46:59 +0000
commit59115a2281bfb5f5065997f2f39fcfa669c5076d (patch)
tree42d858077be05714d98926c4e11fc3ca62b0489b
parente6aa7813abc055f2fd9b615dfcb1dab3e07d368c (diff)
downloademacs-59115a2281bfb5f5065997f2f39fcfa669c5076d.tar.gz
(read_minibuf): Bind inhibit-read-only to t around clearing the minibuffer.
(read_minibuf_unwind): Likewise. Also, clearing the buffer is now the last thing we do.
-rw-r--r--src/minibuf.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index bab116f4ba7..2abb46710e5 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -279,7 +279,13 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos)
Fselect_window (minibuf_window);
XSETFASTINT (XWINDOW (minibuf_window)->hscroll, 0);
- Ferase_buffer ();
+ {
+ int count1 = specpdl_ptr - specpdl;
+ specbind (Qinhibit_read_only, Qt);
+ Ferase_buffer ();
+ unbind_to (count1, Qnil);
+ }
+
minibuf_level++;
if (!NILP (initial))
@@ -416,6 +422,7 @@ read_minibuf_unwind (data)
Lisp_Object data;
{
Lisp_Object old_deactivate_mark;
+ Lisp_Object window;
/* We are exiting the minibuffer one way or the other,
so run the hook. */
@@ -423,24 +430,16 @@ read_minibuf_unwind (data)
&& !NILP (Vrun_hooks))
safe_run_hooks (Qminibuffer_exit_hook);
- /* Erase the minibuffer we were using at this level. */
- Fset_buffer (XWINDOW (minibuf_window)->buffer);
-
- /* Prevent error in erase-buffer. */
- current_buffer->read_only = Qnil;
-
- old_deactivate_mark = Vdeactivate_mark;
- Ferase_buffer ();
- Vdeactivate_mark = old_deactivate_mark;
-
/* If this was a recursive minibuffer,
- tie the minibuffer window back to the outer level minibuffer buffer */
+ tie the minibuffer window back to the outer level minibuffer buffer. */
minibuf_level--;
- /* Make sure minibuffer window is erased, not ignored */
- windows_or_buffers_changed++;
- XSETFASTINT (XWINDOW (minibuf_window)->last_modified, 0);
- /* Restore prompt, etc from outer minibuffer */
+ window = minibuf_window;
+ /* To keep things predictable, in case it matters, let's be in the minibuffer
+ when we reset the relevant variables. */
+ Fset_buffer (XWINDOW (window)->buffer);
+
+ /* Restore prompt, etc, from outer minibuffer level. */
minibuf_prompt = Fcar (minibuf_save_list);
minibuf_save_list = Fcdr (minibuf_save_list);
minibuf_prompt_width = XFASTINT (Fcar (minibuf_save_list));
@@ -457,6 +456,21 @@ read_minibuf_unwind (data)
minibuf_save_list = Fcdr (minibuf_save_list);
minibuf_window = Fcar (minibuf_save_list);
minibuf_save_list = Fcdr (minibuf_save_list);
+
+ /* Erase the minibuffer we were using at this level. */
+ {
+ int count = specpdl_ptr - specpdl;
+ /* Prevent error in erase-buffer. */
+ specbind (Qinhibit_read_only, Qt);
+ old_deactivate_mark = Vdeactivate_mark;
+ Ferase_buffer ();
+ Vdeactivate_mark = old_deactivate_mark;
+ unbind_to (count, Qnil);
+ }
+
+ /* Make sure minibuffer window is erased, not ignored. */
+ windows_or_buffers_changed++;
+ XSETFASTINT (XWINDOW (window)->last_modified, 0);
}