bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: appointment display during isearch replaces buffer contents with his


From: Chong Yidong
Subject: Re: appointment display during isearch replaces buffer contents with history-element
Date: Wed, 02 Jan 2008 09:36:06 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

bojohan+news@dd.chalmers.se (Johan Bockgård) writes:

>     $ emacs -Q
>
>     (defun foo ()
>       (save-excursion
>         (other-window 1)))
>
>     (push "foo" extended-command-history)
>
>     (run-with-timer 5 nil 'foo)
>
> M-x
> Wait 5 seconds
> Press <up>
>
> The contents of the *scratch* buffer are replaced with "foo"; that is,
> the key binding is looked up in the minibuffer's keymap but executed
> in *scratch*.
>
> So the problem is when a timer changes the selected window, but not
> the current buffer.

The following patch fixes this problem.  Any objections?

*** emacs/src/process.c.~1.512.2.9.~  2008-01-02 08:51:29.000000000 -0500
--- emacs/src/process.c               2008-01-02 09:37:38.000000000 -0500
***************
*** 4697,4702 ****
--- 4697,4703 ----
    {
      int old_timers_run = timers_run;
        struct buffer *old_buffer = current_buffer;
+         Lisp_Object old_window = selected_window;
            int leave = 0;
  
          if (detect_input_pending_run_timers (do_display))
***************
*** 4710,4716 ****
         an alike.  Make read_key_sequence aware of that.  */
           if (timers_run != old_timers_run
                 && waiting_for_user_input_p == -1
!                      && old_buffer != current_buffer)
                           record_asynch_buffer_change ();
  
          if (leave)
--- 4711,4718 ----
         an alike.  Make read_key_sequence aware of that.  */
           if (timers_run != old_timers_run
                 && waiting_for_user_input_p == -1
!                      && (old_buffer != current_buffer
!                           || !EQ (old_window, selected_window)))
                                record_asynch_buffer_change ();
  
          if (leave)





reply via email to

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