emacs-devel
[Top][All Lists]
Advanced

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

Re: mouse-autoselect-window


From: Stephen Berman
Subject: Re: mouse-autoselect-window
Date: Fri, 07 Sep 2007 00:58:59 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

On Thu, 06 Sep 2007 22:46:00 +0200 martin rudalics <address@hidden> wrote:

>>>Is `mouse-autoselect-window-select' called at all?
>>
>>
>> How can I determine that?  The first thing I did after applying your
>> patch was to instrument mouse-autoselect-window-select for edebug, but
>> when I moved the mouse between windows (and frames) after setting
>> mouse-autoselect-window to t, edebug never kicked in.  I also
>> instrumented mouse-autoselect-window-start but still no edebug.  Does
>> this mean those functions are not being called?  If so, how is
>> mouse-autoselect-window taking effect; if not, why isn't edebug
>> working?
>
> This would mean that `handle-select-window' gets it wrong.  Can you look
> there, especially why `mouse-autoselect-window-start' is not called?

The reason is that I had mouse-autoselect-window set to t, and
handle-select-window contains this code:

      (unless (and (numberp mouse-autoselect-window)
                   (not (zerop mouse-autoselect-window))
                   (not (eq mouse-autoselect-window-state 'select))
                   (progn
                     ;; Cancel any delayed autoselection.
                     (mouse-autoselect-window-cancel t)
                     ;; Start delayed autoselection from current mouse position
                     ;; and window.
                     (mouse-autoselect-window-start (mouse-position) window)
                     ;; Executing a command cancels delayed autoselection.
                     (add-hook
                      'pre-command-hook 'mouse-autoselect-window-cancel)))

So (numberp mouse-autoselect-window) => (numberp t) => nil and
mouse-autoselect-window-start is skipped over.  When I set
mouse-autoselect-window to a number, I can use edebug to step through
mouse-autoselect-window-select.  The results I have gotten so far are
puzzling.  Sometimes (mouse-position) evaluates to e.g. (#<frame
*scratch* 0x8656d88> 42 . 9) and then the variable `window' gets
let-bound to #<frame *scratch* 0x8656d88>.  But sometimes
(mouse-position) evaluates to e.g. (#<frame *scratch* 0x8656d88> nil)
and then `window' evaluates to nil.  I haven't been able to see when
or why this happens, but when it does, your code gets skipped over.
But even when `window' has a valid window value, I find that in edebug
(selected-window) evaluated to the same window, so again your code
gets skipped over.  But when I don't use edebug and move the mouse
over another frame, then (selected-window) is still the window in the
frame I moved off of.  I don't understand this discrepancy, and I
don't understand how (selected window) could change.

Steve Berman





reply via email to

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