all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* run_window_configuration_change_hook
@ 2011-04-18 13:15 martin rudalics
  2011-04-18 13:21 ` run_window_configuration_change_hook martin rudalics
  2011-04-19 12:43 ` run_window_configuration_change_hook martin rudalics
  0 siblings, 2 replies; 4+ messages in thread
From: martin rudalics @ 2011-04-18 13:15 UTC (permalink / raw)
  To: emacs-devel

With current trunk and emacs -Q evaluate the following code:

(let* ((old-window (selected-window))
        (new-frame (make-frame))
        (new-window (frame-root-window new-frame)))
   (set-window-buffer new-window (other-buffer))
   (select-window old-window)
   (let ((current-buffer (window-buffer new-window)))
     (split-window new-window)
     (cons current-buffer (current-buffer))))

 From the return value I can deduce that `split-window' changes the
current buffer.  This would be incorrect.  IIUC the behavior is due to
the fact that run_window_configuration_change_hook

   if (SELECTED_FRAME () != f)
     {
       record_unwind_protect (select_frame_norecord, Fselected_frame ());
       select_frame_norecord (frame);
     }

   /* Use the right buffer.  Matters when running the local hooks.  */
   if (current_buffer != XBUFFER (Fwindow_buffer (Qnil)))
     {
       record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
       Fset_buffer (Fwindow_buffer (Qnil));
     }

   ...

   unbind_to (count, Qnil);

first restores the current buffer and afterwards the selected frame
which can make another buffer current.  Inverting the order of the two
clauses resolves the problem for me.

martin



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-19 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-18 13:15 run_window_configuration_change_hook martin rudalics
2011-04-18 13:21 ` run_window_configuration_change_hook martin rudalics
2011-04-19 12:43 ` run_window_configuration_change_hook martin rudalics
2011-04-19 13:45   ` run_window_configuration_change_hook Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.