diff options
| author | Stefan Monnier | 2020-12-23 18:31:28 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2020-12-23 18:31:52 -0500 |
| commit | ccb3efffc5a41353abb6ae223a7dcff1ea20e5fb (patch) | |
| tree | e51b63f5fc84b0a31270e0ccf1506083aebbec5a | |
| parent | b68d52c81b53ebe993620e1b80a1c923987b089b (diff) | |
| download | emacs-ccb3efffc5a41353abb6ae223a7dcff1ea20e5fb.tar.gz emacs-ccb3efffc5a41353abb6ae223a7dcff1ea20e5fb.zip | |
* src/dispnew.c (sit_for): Fix bug#45292
When reading, prefer staying in the selected-window over preserving
the current-buffer.
| -rw-r--r-- | src/dispnew.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 89dd32ad0fb..e0a64761904 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -6057,6 +6057,8 @@ sit_for (Lisp_Object timeout, bool reading, int display_option) | |||
| 6057 | intmax_t sec; | 6057 | intmax_t sec; |
| 6058 | int nsec; | 6058 | int nsec; |
| 6059 | bool do_display = display_option > 0; | 6059 | bool do_display = display_option > 0; |
| 6060 | bool curbuf_eq_winbuf | ||
| 6061 | = (current_buffer == XBUFFER (XWINDOW (selected_window)->contents)); | ||
| 6060 | 6062 | ||
| 6061 | swallow_events (do_display); | 6063 | swallow_events (do_display); |
| 6062 | 6064 | ||
| @@ -6111,6 +6113,13 @@ sit_for (Lisp_Object timeout, bool reading, int display_option) | |||
| 6111 | wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display, | 6113 | wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display, |
| 6112 | Qnil, NULL, 0); | 6114 | Qnil, NULL, 0); |
| 6113 | 6115 | ||
| 6116 | if (reading && curbuf_eq_winbuf) | ||
| 6117 | /* Timers and process filters/sentinels may have changed the selected | ||
| 6118 | window (e.g. in response to a connection from emacsclient), in which | ||
| 6119 | case we should follow it (unless we weren't in the selected-window's | ||
| 6120 | buffer to start with). */ | ||
| 6121 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents)); | ||
| 6122 | |||
| 6114 | return detect_input_pending () ? Qnil : Qt; | 6123 | return detect_input_pending () ? Qnil : Qt; |
| 6115 | } | 6124 | } |
| 6116 | 6125 | ||