emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

run_window_configuration_change_hook


From: martin rudalics
Subject: run_window_configuration_change_hook
Date: Mon, 18 Apr 2011 15:15:54 +0200
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]