comparison src/xdisp.c @ 93067:b14afcccfab6

(format_mode_line_unwind_data): Add window argument. (unwind_format_mode_line): Restore selected window. (x_consider_frame_title, Fformat_mode_line): Set selected window.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 19 Mar 2008 15:02:00 +0000
parents d999f30304bc
children 16142d1d9f33
comparison
equal deleted inserted replaced
93066:f35f15ba549f 93067:b14afcccfab6
9090 /* Unwind data for mode line strings */ 9090 /* Unwind data for mode line strings */
9091 9091
9092 static Lisp_Object Vmode_line_unwind_vector; 9092 static Lisp_Object Vmode_line_unwind_vector;
9093 9093
9094 static Lisp_Object 9094 static Lisp_Object
9095 format_mode_line_unwind_data (obuf, save_proptrans) 9095 format_mode_line_unwind_data (struct buffer *obuf,
9096 struct buffer *obuf; 9096 Lisp_Object owin,
9097 int save_proptrans)
9097 { 9098 {
9098 Lisp_Object vector, tmp; 9099 Lisp_Object vector, tmp;
9099 9100
9100 /* Reduce consing by keeping one vector in 9101 /* Reduce consing by keeping one vector in
9101 Vwith_echo_area_save_vector. */ 9102 Vwith_echo_area_save_vector. */
9102 vector = Vmode_line_unwind_vector; 9103 vector = Vmode_line_unwind_vector;
9103 Vmode_line_unwind_vector = Qnil; 9104 Vmode_line_unwind_vector = Qnil;
9104 9105
9105 if (NILP (vector)) 9106 if (NILP (vector))
9106 vector = Fmake_vector (make_number (7), Qnil); 9107 vector = Fmake_vector (make_number (8), Qnil);
9107 9108
9108 ASET (vector, 0, make_number (mode_line_target)); 9109 ASET (vector, 0, make_number (mode_line_target));
9109 ASET (vector, 1, make_number (MODE_LINE_NOPROP_LEN (0))); 9110 ASET (vector, 1, make_number (MODE_LINE_NOPROP_LEN (0)));
9110 ASET (vector, 2, mode_line_string_list); 9111 ASET (vector, 2, mode_line_string_list);
9111 ASET (vector, 3, save_proptrans ? mode_line_proptrans_alist : Qt); 9112 ASET (vector, 3, save_proptrans ? mode_line_proptrans_alist : Qt);
9115 if (obuf) 9116 if (obuf)
9116 XSETBUFFER (tmp, obuf); 9117 XSETBUFFER (tmp, obuf);
9117 else 9118 else
9118 tmp = Qnil; 9119 tmp = Qnil;
9119 ASET (vector, 6, tmp); 9120 ASET (vector, 6, tmp);
9121 ASET (vector, 7, owin);
9120 9122
9121 return vector; 9123 return vector;
9122 } 9124 }
9123 9125
9124 static Lisp_Object 9126 static Lisp_Object
9130 mode_line_string_list = AREF (vector, 2); 9132 mode_line_string_list = AREF (vector, 2);
9131 if (! EQ (AREF (vector, 3), Qt)) 9133 if (! EQ (AREF (vector, 3), Qt))
9132 mode_line_proptrans_alist = AREF (vector, 3); 9134 mode_line_proptrans_alist = AREF (vector, 3);
9133 mode_line_string_face = AREF (vector, 4); 9135 mode_line_string_face = AREF (vector, 4);
9134 mode_line_string_face_prop = AREF (vector, 5); 9136 mode_line_string_face_prop = AREF (vector, 5);
9137
9138 if (!NILP (AREF (vector, 7)))
9139 /* Select window before buffer, since it may change the buffer. */
9140 Fselect_window (AREF (vector, 7), Qt);
9135 9141
9136 if (!NILP (AREF (vector, 6))) 9142 if (!NILP (AREF (vector, 6)))
9137 { 9143 {
9138 set_buffer_internal_1 (XBUFFER (AREF (vector, 6))); 9144 set_buffer_internal_1 (XBUFFER (AREF (vector, 6)));
9139 ASET (vector, 6, Qnil); 9145 ASET (vector, 6, Qnil);
9250 9256
9251 /* Switch to the buffer of selected window of the frame. Set up 9257 /* Switch to the buffer of selected window of the frame. Set up
9252 mode_line_target so that display_mode_element will output into 9258 mode_line_target so that display_mode_element will output into
9253 mode_line_noprop_buf; then display the title. */ 9259 mode_line_noprop_buf; then display the title. */
9254 record_unwind_protect (unwind_format_mode_line, 9260 record_unwind_protect (unwind_format_mode_line,
9255 format_mode_line_unwind_data (current_buffer, 0)); 9261 format_mode_line_unwind_data
9256 9262 (current_buffer, selected_window, 0));
9263
9264 Fselect_window (f->selected_window, Qt);
9257 set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer)); 9265 set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer));
9258 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; 9266 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;
9259 9267
9260 mode_line_target = MODE_LINE_TITLE; 9268 mode_line_target = MODE_LINE_TITLE;
9261 title_start = MODE_LINE_NOPROP_LEN (0); 9269 title_start = MODE_LINE_NOPROP_LEN (0);
16922 if (! mode_line_inverse_video) 16930 if (! mode_line_inverse_video)
16923 /* Force the mode-line to be displayed in the default face. */ 16931 /* Force the mode-line to be displayed in the default face. */
16924 it.base_face_id = it.face_id = DEFAULT_FACE_ID; 16932 it.base_face_id = it.face_id = DEFAULT_FACE_ID;
16925 16933
16926 record_unwind_protect (unwind_format_mode_line, 16934 record_unwind_protect (unwind_format_mode_line,
16927 format_mode_line_unwind_data (NULL, 0)); 16935 format_mode_line_unwind_data (NULL, Qnil, 0));
16928 16936
16929 mode_line_target = MODE_LINE_DISPLAY; 16937 mode_line_target = MODE_LINE_DISPLAY;
16930 16938
16931 /* Temporarily make frame's keyboard the current kboard so that 16939 /* Temporarily make frame's keyboard the current kboard so that
16932 kboard-local variables in the mode_line_format will get the right 16940 kboard-local variables in the mode_line_format will get the right
17624 old_buffer = current_buffer; 17632 old_buffer = current_buffer;
17625 17633
17626 /* Save things including mode_line_proptrans_alist, 17634 /* Save things including mode_line_proptrans_alist,
17627 and set that to nil so that we don't alter the outer value. */ 17635 and set that to nil so that we don't alter the outer value. */
17628 record_unwind_protect (unwind_format_mode_line, 17636 record_unwind_protect (unwind_format_mode_line,
17629 format_mode_line_unwind_data (old_buffer, 1)); 17637 format_mode_line_unwind_data
17638 (old_buffer, selected_window, 1));
17630 mode_line_proptrans_alist = Qnil; 17639 mode_line_proptrans_alist = Qnil;
17631 17640
17641 Fselect_window (window, Qt);
17632 if (old_buffer) 17642 if (old_buffer)
17633 set_buffer_internal_1 (XBUFFER (buffer)); 17643 set_buffer_internal_1 (XBUFFER (buffer));
17634 17644
17635 init_iterator (&it, w, -1, -1, NULL, face_id); 17645 init_iterator (&it, w, -1, -1, NULL, face_id);
17636 17646