;; The following function is called by `set-window-buffer' _before_ it
;; replaces the buffer of the argument window with the new buffer.
-(defun record-window-buffer (&optional window)
+(defun record-window-buffer (&optional window do-minibuf)
"Record WINDOW's buffer.
-WINDOW must be a live window and defaults to the selected one."
+WINDOW must be a live window and defaults to the selected one.
+
+If WINDOW is a minibuffer, it will only be recorded if DO-MINIBUF
+is non-nil."
(let* ((window (window-normalize-window window t))
(buffer (window-buffer window))
(entry (assq buffer (window-prev-buffers window))))
;; `switch-to-prev-buffer' and `switch-to-next-buffer'.
(set-window-next-buffers window nil)
- (when entry
- ;; Remove all entries for BUFFER from WINDOW's previous buffers.
- (set-window-prev-buffers
- window (assq-delete-all buffer (window-prev-buffers window))))
-
;; Don't record insignificant buffers.
(when (or (not (eq (aref (buffer-name buffer) 0) ?\s))
- (minibufferp buffer))
+ (and do-minibuf (minibufferp buffer)))
+ (when entry
+ ;; Remove all entries for BUFFER from WINDOW's previous buffers.
+ (set-window-prev-buffers
+ window (assq-delete-all buffer (window-prev-buffers window))))
;; Add an entry for buffer to WINDOW's previous buffers.
(with-current-buffer buffer
(let ((start (window-start window))
}
if (live_minibuffer_p (dw->contents))
- call1 (Qrecord_window_buffer, dest_window);
+ call2 (Qrecord_window_buffer, dest_window, Qt);
if (live_minibuffer_p (sw->contents))
- call1 (Qrecord_window_buffer, source_window);
+ call2 (Qrecord_window_buffer, source_window, Qt);
acc = merge_c (dw->prev_buffers, sw->prev_buffers, minibuffer_ent_greater);
zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window);
if (for_deletion && XFRAME (MB_frame) != of)
MB_frame = selected_frame;
+ if (!for_deletion
+ && MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (of))))
+ {
+ Lisp_Object old_frame;
+ XSETFRAME (old_frame, of);
+ Fset_frame_selected_window (old_frame,
+ Fframe_first_window (old_frame), Qnil);
+ }
}
}
}
MB_frame = XWINDOW (XFRAME (selected_frame)->minibuffer_window)->frame;
if (live_minibuffer_p (XWINDOW (minibuf_window)->contents))
- call1 (Qrecord_window_buffer, minibuf_window);
+ call2 (Qrecord_window_buffer, minibuf_window, Qt);
record_unwind_protect_void (minibuffer_unwind);
record_unwind_protect (restore_window_configuration,