all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: emacs-devel <emacs-devel@gnu.org>
Subject: run_window_configuration_change_hook
Date: Mon, 18 Apr 2011 15:15:54 +0200	[thread overview]
Message-ID: <4DAC398A.204@gmx.at> (raw)

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	other threads:[~2011-04-18 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18 13:15 martin rudalics [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DAC398A.204@gmx.at \
    --to=rudalics@gmx.at \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.