Mercurial > emacs
changeset 14667:3de266c52c9a
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 25 Feb 1996 20:46:59 +0000 |
parents | 4edbb03c523b |
children | a281f3b85f32 |
files | src/minibuf.c |
diffstat | 1 files changed, 31 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/minibuf.c Sun Feb 25 20:44:09 1996 +0000 +++ b/src/minibuf.c Sun Feb 25 20:46:59 1996 +0000 @@ -279,7 +279,13 @@ 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 @@ 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 @@ && !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; + /* If this was a recursive minibuffer, + tie the minibuffer window back to the outer level minibuffer buffer. */ + minibuf_level--; - old_deactivate_mark = Vdeactivate_mark; - Ferase_buffer (); - Vdeactivate_mark = old_deactivate_mark; + 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); - /* If this was a recursive minibuffer, - 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 */ + /* 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 @@ 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); }