diff options
| author | Andrea Corallo | 2021-04-19 18:46:50 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2021-04-19 18:46:50 +0200 |
| commit | b5c76530fab4b99e76249bfb9a105b30bef4ce67 (patch) | |
| tree | 319d7a65b6f818cebed9833534a423fbcb79a9b5 /src/window.c | |
| parent | e54066f3d459f67a1ee4e44552bf0356d010e03f (diff) | |
| parent | 0a4dc70830f5e8286b47120cabc750cca07a75c1 (diff) | |
| download | emacs-b5c76530fab4b99e76249bfb9a105b30bef4ce67.tar.gz emacs-b5c76530fab4b99e76249bfb9a105b30bef4ce67.zip | |
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 71 |
1 files changed, 44 insertions, 27 deletions
diff --git a/src/window.c b/src/window.c index 661b1ae112c..399b24b1e9e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -215,20 +215,6 @@ wset_combination (struct window *w, bool horflag, Lisp_Object val) | |||
| 215 | w->horizontal = horflag; | 215 | w->horizontal = horflag; |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | static void | ||
| 219 | wset_update_mode_line (struct window *w) | ||
| 220 | { | ||
| 221 | /* If this window is the selected window on its frame, set the | ||
| 222 | global variable update_mode_lines, so that gui_consider_frame_title | ||
| 223 | will consider this frame's title for redisplay. */ | ||
| 224 | Lisp_Object fselected_window = XFRAME (WINDOW_FRAME (w))->selected_window; | ||
| 225 | |||
| 226 | if (WINDOWP (fselected_window) && XWINDOW (fselected_window) == w) | ||
| 227 | update_mode_lines = 42; | ||
| 228 | else | ||
| 229 | w->update_mode_line = true; | ||
| 230 | } | ||
| 231 | |||
| 232 | /* True if leaf window W doesn't reflect the actual state | 218 | /* True if leaf window W doesn't reflect the actual state |
| 233 | of displayed buffer due to its text or overlays change. */ | 219 | of displayed buffer due to its text or overlays change. */ |
| 234 | 220 | ||
| @@ -518,10 +504,18 @@ select_window (Lisp_Object window, Lisp_Object norecord, | |||
| 518 | { | 504 | { |
| 519 | struct window *w; | 505 | struct window *w; |
| 520 | struct frame *sf; | 506 | struct frame *sf; |
| 507 | Lisp_Object frame; | ||
| 508 | struct frame *f; | ||
| 521 | 509 | ||
| 522 | CHECK_LIVE_WINDOW (window); | 510 | CHECK_LIVE_WINDOW (window); |
| 523 | 511 | ||
| 524 | w = XWINDOW (window); | 512 | w = XWINDOW (window); |
| 513 | frame = WINDOW_FRAME (w); | ||
| 514 | f = XFRAME (frame); | ||
| 515 | |||
| 516 | if (FRAME_TOOLTIP_P (f)) | ||
| 517 | /* Do not select a tooltip window (Bug#47207). */ | ||
| 518 | error ("Cannot select a tooltip window"); | ||
| 525 | 519 | ||
| 526 | /* Make the selected window's buffer current. */ | 520 | /* Make the selected window's buffer current. */ |
| 527 | Fset_buffer (w->contents); | 521 | Fset_buffer (w->contents); |
| @@ -542,14 +536,14 @@ select_window (Lisp_Object window, Lisp_Object norecord, | |||
| 542 | redisplay_other_windows (); | 536 | redisplay_other_windows (); |
| 543 | 537 | ||
| 544 | sf = SELECTED_FRAME (); | 538 | sf = SELECTED_FRAME (); |
| 545 | if (XFRAME (WINDOW_FRAME (w)) != sf) | 539 | if (f != sf) |
| 546 | { | 540 | { |
| 547 | fset_selected_window (XFRAME (WINDOW_FRAME (w)), window); | 541 | fset_selected_window (f, window); |
| 548 | /* Use this rather than Fhandle_switch_frame | 542 | /* Use this rather than Fhandle_switch_frame |
| 549 | so that FRAME_FOCUS_FRAME is moved appropriately as we | 543 | so that FRAME_FOCUS_FRAME is moved appropriately as we |
| 550 | move around in the state where a minibuffer in a separate | 544 | move around in the state where a minibuffer in a separate |
| 551 | frame is active. */ | 545 | frame is active. */ |
| 552 | Fselect_frame (WINDOW_FRAME (w), norecord); | 546 | Fselect_frame (frame, norecord); |
| 553 | /* Fselect_frame called us back so we've done all the work already. */ | 547 | /* Fselect_frame called us back so we've done all the work already. */ |
| 554 | eassert (EQ (window, selected_window)); | 548 | eassert (EQ (window, selected_window)); |
| 555 | return window; | 549 | return window; |
| @@ -2556,8 +2550,13 @@ window_list (void) | |||
| 2556 | if (!CONSP (Vwindow_list)) | 2550 | if (!CONSP (Vwindow_list)) |
| 2557 | { | 2551 | { |
| 2558 | Lisp_Object tail, frame; | 2552 | Lisp_Object tail, frame; |
| 2553 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 2559 | 2554 | ||
| 2560 | Vwindow_list = Qnil; | 2555 | Vwindow_list = Qnil; |
| 2556 | /* Don't allow quitting in Fnconc. Otherwise we might end up | ||
| 2557 | with a too short Vwindow_list and Fkill_buffer not being able | ||
| 2558 | to replace a buffer in all windows showing it (Bug#47244). */ | ||
| 2559 | specbind (Qinhibit_quit, Qt); | ||
| 2561 | FOR_EACH_FRAME (tail, frame) | 2560 | FOR_EACH_FRAME (tail, frame) |
| 2562 | { | 2561 | { |
| 2563 | Lisp_Object arglist = Qnil; | 2562 | Lisp_Object arglist = Qnil; |
| @@ -2569,6 +2568,8 @@ window_list (void) | |||
| 2569 | arglist = Fnreverse (arglist); | 2568 | arglist = Fnreverse (arglist); |
| 2570 | Vwindow_list = nconc2 (Vwindow_list, arglist); | 2569 | Vwindow_list = nconc2 (Vwindow_list, arglist); |
| 2571 | } | 2570 | } |
| 2571 | |||
| 2572 | unbind_to (count, Qnil); | ||
| 2572 | } | 2573 | } |
| 2573 | 2574 | ||
| 2574 | return Vwindow_list; | 2575 | return Vwindow_list; |
| @@ -2603,7 +2604,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, | |||
| 2603 | candidate_p = false; | 2604 | candidate_p = false; |
| 2604 | else if (MINI_WINDOW_P (w) | 2605 | else if (MINI_WINDOW_P (w) |
| 2605 | && (EQ (minibuf, Qlambda) | 2606 | && (EQ (minibuf, Qlambda) |
| 2606 | || (WINDOWP (minibuf) && !EQ (minibuf, window)))) | 2607 | || (WINDOW_LIVE_P (minibuf) && !EQ (minibuf, window)))) |
| 2607 | { | 2608 | { |
| 2608 | /* If MINIBUF is `lambda' don't consider any mini-windows. | 2609 | /* If MINIBUF is `lambda' don't consider any mini-windows. |
| 2609 | If it is a window, consider only that one. */ | 2610 | If it is a window, consider only that one. */ |
| @@ -2666,12 +2667,12 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object | |||
| 2666 | Lisp_Object miniwin = XFRAME (w->frame)->minibuffer_window; | 2667 | Lisp_Object miniwin = XFRAME (w->frame)->minibuffer_window; |
| 2667 | 2668 | ||
| 2668 | XSETWINDOW (*window, w); | 2669 | XSETWINDOW (*window, w); |
| 2669 | /* MINIBUF nil may or may not include minibuffers. Decide if it | 2670 | /* MINIBUF nil may or may not include minibuffer windows. Decide if |
| 2670 | does. */ | 2671 | it does. But first make sure that this frame's minibuffer window |
| 2671 | if (NILP (*minibuf)) | 2672 | is live (Bug#47207). */ |
| 2672 | *minibuf = this_minibuffer_depth (XWINDOW (miniwin)->contents) | 2673 | if (WINDOW_LIVE_P (miniwin) && NILP (*minibuf)) |
| 2673 | ? miniwin | 2674 | *minibuf = (this_minibuffer_depth (XWINDOW (miniwin)->contents) |
| 2674 | : Qlambda; | 2675 | ? miniwin : Qlambda); |
| 2675 | else if (!EQ (*minibuf, Qt)) | 2676 | else if (!EQ (*minibuf, Qt)) |
| 2676 | *minibuf = Qlambda; | 2677 | *minibuf = Qlambda; |
| 2677 | 2678 | ||
| @@ -2682,9 +2683,10 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object | |||
| 2682 | /* ALL_FRAMES nil doesn't specify which frames to include. */ | 2683 | /* ALL_FRAMES nil doesn't specify which frames to include. */ |
| 2683 | if (NILP (*all_frames)) | 2684 | if (NILP (*all_frames)) |
| 2684 | *all_frames | 2685 | *all_frames |
| 2685 | = (!EQ (*minibuf, Qlambda) | 2686 | /* Once more make sure that this frame's minibuffer window is live |
| 2686 | ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame)) | 2687 | before including it (Bug#47207). */ |
| 2687 | : Qnil); | 2688 | = ((WINDOW_LIVE_P (miniwin) && !EQ (*minibuf, Qlambda)) |
| 2689 | ? miniwin : Qnil); | ||
| 2688 | else if (EQ (*all_frames, Qvisible)) | 2690 | else if (EQ (*all_frames, Qvisible)) |
| 2689 | ; | 2691 | ; |
| 2690 | else if (EQ (*all_frames, make_fixnum (0))) | 2692 | else if (EQ (*all_frames, make_fixnum (0))) |
| @@ -2705,6 +2707,8 @@ static Lisp_Object | |||
| 2705 | next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, | 2707 | next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, |
| 2706 | bool next_p) | 2708 | bool next_p) |
| 2707 | { | 2709 | { |
| 2710 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 2711 | |||
| 2708 | decode_next_window_args (&window, &minibuf, &all_frames); | 2712 | decode_next_window_args (&window, &minibuf, &all_frames); |
| 2709 | 2713 | ||
| 2710 | /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just | 2714 | /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just |
| @@ -2713,6 +2717,9 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, | |||
| 2713 | && !EQ (all_frames, XWINDOW (window)->frame)) | 2717 | && !EQ (all_frames, XWINDOW (window)->frame)) |
| 2714 | return Fframe_first_window (all_frames); | 2718 | return Fframe_first_window (all_frames); |
| 2715 | 2719 | ||
| 2720 | /* Don't allow quitting in Fmemq. */ | ||
| 2721 | specbind (Qinhibit_quit, Qt); | ||
| 2722 | |||
| 2716 | if (next_p) | 2723 | if (next_p) |
| 2717 | { | 2724 | { |
| 2718 | Lisp_Object list; | 2725 | Lisp_Object list; |
| @@ -2762,6 +2769,8 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, | |||
| 2762 | window = candidate; | 2769 | window = candidate; |
| 2763 | } | 2770 | } |
| 2764 | 2771 | ||
| 2772 | unbind_to (count, Qnil); | ||
| 2773 | |||
| 2765 | return window; | 2774 | return window; |
| 2766 | } | 2775 | } |
| 2767 | 2776 | ||
| @@ -2852,10 +2861,14 @@ static Lisp_Object | |||
| 2852 | window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) | 2861 | window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) |
| 2853 | { | 2862 | { |
| 2854 | Lisp_Object tail, list, rest; | 2863 | Lisp_Object tail, list, rest; |
| 2864 | ptrdiff_t count = SPECPDL_INDEX (); | ||
| 2855 | 2865 | ||
| 2856 | decode_next_window_args (&window, &minibuf, &all_frames); | 2866 | decode_next_window_args (&window, &minibuf, &all_frames); |
| 2857 | list = Qnil; | 2867 | list = Qnil; |
| 2858 | 2868 | ||
| 2869 | /* Don't allow quitting in Fmemq and Fnconc. */ | ||
| 2870 | specbind (Qinhibit_quit, Qt); | ||
| 2871 | |||
| 2859 | for (tail = window_list (); CONSP (tail); tail = XCDR (tail)) | 2872 | for (tail = window_list (); CONSP (tail); tail = XCDR (tail)) |
| 2860 | if (candidate_window_p (XCAR (tail), window, minibuf, all_frames)) | 2873 | if (candidate_window_p (XCAR (tail), window, minibuf, all_frames)) |
| 2861 | list = Fcons (XCAR (tail), list); | 2874 | list = Fcons (XCAR (tail), list); |
| @@ -2870,6 +2883,9 @@ window_list_1 (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) | |||
| 2870 | XSETCDR (tail, Qnil); | 2883 | XSETCDR (tail, Qnil); |
| 2871 | list = nconc2 (rest, list); | 2884 | list = nconc2 (rest, list); |
| 2872 | } | 2885 | } |
| 2886 | |||
| 2887 | unbind_to (count, Qnil); | ||
| 2888 | |||
| 2873 | return list; | 2889 | return list; |
| 2874 | } | 2890 | } |
| 2875 | 2891 | ||
| @@ -8225,6 +8241,7 @@ syms_of_window (void) | |||
| 8225 | DEFSYM (Qmode_line_format, "mode-line-format"); | 8241 | DEFSYM (Qmode_line_format, "mode-line-format"); |
| 8226 | DEFSYM (Qheader_line_format, "header-line-format"); | 8242 | DEFSYM (Qheader_line_format, "header-line-format"); |
| 8227 | DEFSYM (Qtab_line_format, "tab-line-format"); | 8243 | DEFSYM (Qtab_line_format, "tab-line-format"); |
| 8244 | DEFSYM (Qno_other_window, "no-other-window"); | ||
| 8228 | 8245 | ||
| 8229 | DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function, | 8246 | DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function, |
| 8230 | doc: /* Non-nil means call as function to display a help buffer. | 8247 | doc: /* Non-nil means call as function to display a help buffer. |