[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12766: read-from-minibuffer does not preserve current-buffer
From: |
martin rudalics |
Subject: |
bug#12766: read-from-minibuffer does not preserve current-buffer |
Date: |
Tue, 30 Oct 2012 19:49:23 +0100 |
>>> % src/emacs -Q --eval "(setq initial-frame-alist '((minibuffer . nil)))"
>>> M-: (with-temp-buffer (list (read-string "toto: ") (current-buffer))) RET
>> Two changes I made could be involved:
>> (1) `select-window' now always makes the window's buffer current.
>> (2) read_minibuf now calls set_window_buffer instead of
>> Fset_window_buffer.
>
> I think (1) is more likely to be the problem.
Verified (sloppily).
> Could you check
> read_minibuf to see which unwind is supposed to reset the
> current buffer?
IIUC read_minibuf doesn't care about restoring the current buffer.
> Maybe that code worked by accident (.e.g relying on the fact that
> select-window didn't set current-buffer in that corner case) and the
> right fix is simply to explicitly save&restore current buffer.
FWIW the problem already happens when choose_minibuf_frame calls
Fset_frame_selected_window. The patch below seems to fix it.
martin, completely lost in the labyrinth of read_minibuf
*** src/minibuf.c 2012-10-11 16:23:37 +0000
--- src/minibuf.c 2012-10-30 18:25:26 +0000
***************
*** 472,477 ****
--- 472,479 ----
/* Choose the minibuffer window and frame, and take action on them. */
+ record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+
choose_minibuf_frame ();
record_unwind_protect (choose_minibuf_frame_1, Qnil);