aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2012-06-19 19:19:07 +0200
committerJoakim Verona2012-06-19 19:19:07 +0200
commitabef2047941f87ae4baa34b3a8675de4d0068b7a (patch)
tree63042e6c3037100412816200e03c04affc7fe071 /src
parent58a90697e8f15a2722100ac489df200ad31d3086 (diff)
parent68f12411893785de1cfc2c24ec36059e49af5d55 (diff)
downloademacs-abef2047941f87ae4baa34b3a8675de4d0068b7a.tar.gz
emacs-abef2047941f87ae4baa34b3a8675de4d0068b7a.zip
upstream
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog53
-rw-r--r--src/bytecode.c18
-rw-r--r--src/data.c15
-rw-r--r--src/frame.c36
-rw-r--r--src/term.c22
-rw-r--r--src/xdisp.c62
6 files changed, 142 insertions, 64 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9a239de5b99..16fcbb07522 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,8 +1,37 @@
12012-06-19 Chong Yidong <cyd@gnu.org>
2
3 * frame.c (delete_frame): When selecting a frame on a different
4 text terminal, do not alter the terminal's top-frame.
5
6 * xdisp.c (format_mode_line_unwind_data): Record the target
7 frame's selected window and its terminal's top-frame.
8 (unwind_format_mode_line): Restore them.
9 (x_consider_frame_title, display_mode_line, Fformat_mode_line):
10 Callers changed.
11 (x_consider_frame_title): Do not condition on HAVE_WINDOW_SYSTEM,
12 since tty frames can be explicitly named.
13 (prepare_menu_bars): Likewise.
14
15 * term.c (Ftty_top_frame): New function.
16
172012-06-18 Paul Eggert <eggert@cs.ucla.edu>
18
19 Port byte-code-meter to modern targets.
20 * bytecode.c (METER_CODE) [BYTE_CODE_METER]: Don't assume
21 !CHECK_LISP_OBJECT_TYPE && !USE_LSB_TAG. Problem with
22 CHECK_LISP_OBJECT_TYPE reported by Dmitry Andropov in
23 <http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00282.html>.
24 (METER_1, METER_2): Simplify.
25
262012-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
27
28 * data.c (Fdefalias): Return `symbol' (bug#11686).
29
12012-06-18 Martin Rudalics <rudalics@gmx.at> 302012-06-18 Martin Rudalics <rudalics@gmx.at>
2 31
3 * buffer.c (Fkill_buffer): Don't throw an error when the buffer 32 * buffer.c (Fkill_buffer): Don't throw an error when the buffer
4 gets killed during executing of this function (Bug#11665). Try 33 gets killed during executing of this function (Bug#11665).
5 to always return Qt when the buffer has been actually killed. 34 Try to always return Qt when the buffer has been actually killed.
6 (Vkill_buffer_query_functions): In doc-string say that functions 35 (Vkill_buffer_query_functions): In doc-string say that functions
7 run by this hook should not change the current buffer. 36 run by this hook should not change the current buffer.
8 37
@@ -56,8 +85,8 @@
56 (x_draw_glyph_string): Use them. 85 (x_draw_glyph_string): Use them.
57 * xfaces.c (Qline, Qwave): New Lisp objects. 86 * xfaces.c (Qline, Qwave): New Lisp objects.
58 (check_lface_attrs, merge_face_ref) 87 (check_lface_attrs, merge_face_ref)
59 (Finternal_set_lisp_face_attribute, realize_x_face): Handle 88 (Finternal_set_lisp_face_attribute, realize_x_face):
60 wave-style underline face attributes. 89 Handle wave-style underline face attributes.
61 * xterm.c (x_draw_underwave): New function. 90 * xterm.c (x_draw_underwave): New function.
62 (x_draw_glyph_string): Use it. 91 (x_draw_glyph_string): Use it.
63 92
@@ -130,8 +159,8 @@
130 159
1312012-06-16 Eli Zaretskii <eliz@gnu.org> 1602012-06-16 Eli Zaretskii <eliz@gnu.org>
132 161
133 * xdisp.c (set_cursor_from_row): Don't dereference glyphs_end. If 162 * xdisp.c (set_cursor_from_row): Don't dereference glyphs_end.
134 all the glyphs of the glyph row came from strings, and we have no 163 If all the glyphs of the glyph row came from strings, and we have no
135 cursor positioning clues, put the cursor on the first glyph of the 164 cursor positioning clues, put the cursor on the first glyph of the
136 row. 165 row.
137 (handle_face_prop): Use chunk-relative overlay string index when 166 (handle_face_prop): Use chunk-relative overlay string index when
@@ -164,8 +193,8 @@
164 Simplify under the assumption that USE_2_TAGS_FOR_INTS is defined. 193 Simplify under the assumption that USE_2_TAGS_FOR_INTS is defined.
165 (INTTYPEBITS): New macro, for clarity. 194 (INTTYPEBITS): New macro, for clarity.
166 (INTMASK, MOST_POSITIVE_FIXNUM): Use it. 195 (INTMASK, MOST_POSITIVE_FIXNUM): Use it.
167 (LISP_INT1_TAG, LISP_STRING_TAG, LISP_INT_TAG_P): Simplify 196 (LISP_INT1_TAG, LISP_STRING_TAG, LISP_INT_TAG_P):
168 now that USE_LSB_TAG is always defined. 197 Simplify now that USE_LSB_TAG is always defined.
169 (TYPEMASK, XINT) [USE_LSB_TAG]: Remove unnecessary cast. 198 (TYPEMASK, XINT) [USE_LSB_TAG]: Remove unnecessary cast.
170 (make_number) [!USE_LSB_TAG]: Use INTMASK; that's simpler. 199 (make_number) [!USE_LSB_TAG]: Use INTMASK; that's simpler.
171 200
@@ -183,11 +212,11 @@
183 * lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct 212 * lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct
184 instead of union. 213 instead of union.
185 (XLI, XIL): Define. 214 (XLI, XIL): Define.
186 (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG): Use 215 (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG):
187 them. 216 Use them.
188 * emacs.c (gdb_use_struct): Renamed from gdb_use_union. 217 * emacs.c (gdb_use_struct): Rename from gdb_use_union.
189 * .gdbinit: Check gdb_use_struct instead of gdb_use_union. 218 * .gdbinit: Check gdb_use_struct instead of gdb_use_union.
190 * alloc.c (widen_to_Lisp_Object): Removed. 219 * alloc.c (widen_to_Lisp_Object): Remove.
191 (mark_memory): Use XIL instead of widen_to_Lisp_Object. 220 (mark_memory): Use XIL instead of widen_to_Lisp_Object.
192 * frame.c (delete_frame): Remove outdated comment. 221 * frame.c (delete_frame): Remove outdated comment.
193 * w32fns.c (Fw32_register_hot_key): Use XLI instead of checking 222 * w32fns.c (Fw32_register_hot_key): Use XLI instead of checking
diff --git a/src/bytecode.c b/src/bytecode.c
index 2e6ee3d4445..9c7a3fa30cf 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -58,21 +58,21 @@ by Hallvard:
58#ifdef BYTE_CODE_METER 58#ifdef BYTE_CODE_METER
59 59
60Lisp_Object Qbyte_code_meter; 60Lisp_Object Qbyte_code_meter;
61#define METER_2(code1, code2) \ 61#define METER_2(code1, code2) AREF (AREF (Vbyte_code_meter, code1), code2)
62 XFASTINT (XVECTOR (XVECTOR (Vbyte_code_meter)->contents[(code1)]) \ 62#define METER_1(code) METER_2 (0, code)
63 ->contents[(code2)])
64
65#define METER_1(code) METER_2 (0, (code))
66 63
67#define METER_CODE(last_code, this_code) \ 64#define METER_CODE(last_code, this_code) \
68{ \ 65{ \
69 if (byte_metering_on) \ 66 if (byte_metering_on) \
70 { \ 67 { \
71 if (METER_1 (this_code) < MOST_POSITIVE_FIXNUM) \ 68 if (XFASTINT (METER_1 (this_code)) < MOST_POSITIVE_FIXNUM) \
72 METER_1 (this_code)++; \ 69 XSETFASTINT (METER_1 (this_code), \
70 XFASTINT (METER_1 (this_code)) + 1); \
73 if (last_code \ 71 if (last_code \
74 && METER_2 (last_code, this_code) < MOST_POSITIVE_FIXNUM) \ 72 && (XFASTINT (METER_2 (last_code, this_code)) \
75 METER_2 (last_code, this_code)++; \ 73 < MOST_POSITIVE_FIXNUM)) \
74 XSETFASTINT (METER_2 (last_code, this_code), \
75 XFASTINT (METER_2 (last_code, this_code)) + 1); \
76 } \ 76 } \
77} 77}
78 78
diff --git a/src/data.c b/src/data.c
index 4449977dbe0..2aa27e65d77 100644
--- a/src/data.c
+++ b/src/data.c
@@ -637,8 +637,9 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
637 Fput (symbol, Qautoload, XCDR (function)); 637 Fput (symbol, Qautoload, XCDR (function));
638 638
639 XSYMBOL (symbol)->function = definition; 639 XSYMBOL (symbol)->function = definition;
640 /* Handle automatic advice activation */ 640 /* Handle automatic advice activation. */
641 if (CONSP (XSYMBOL (symbol)->plist) && !NILP (Fget (symbol, Qad_advice_info))) 641 if (CONSP (XSYMBOL (symbol)->plist)
642 && !NILP (Fget (symbol, Qad_advice_info)))
642 { 643 {
643 call2 (Qad_activate_internal, symbol, Qnil); 644 call2 (Qad_activate_internal, symbol, Qnil);
644 definition = XSYMBOL (symbol)->function; 645 definition = XSYMBOL (symbol)->function;
@@ -647,11 +648,12 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
647} 648}
648 649
649DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0, 650DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0,
650 doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION. 651 doc: /* Set SYMBOL's function definition to DEFINITION.
651Associates the function with the current load file, if any. 652Associates the function with the current load file, if any.
652The optional third argument DOCSTRING specifies the documentation string 653The optional third argument DOCSTRING specifies the documentation string
653for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string 654for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string
654determined by DEFINITION. */) 655determined by DEFINITION.
656The return value is undefined. */)
655 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring) 657 (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
656{ 658{
657 CHECK_SYMBOL (symbol); 659 CHECK_SYMBOL (symbol);
@@ -666,7 +668,10 @@ determined by DEFINITION. */)
666 LOADHIST_ATTACH (Fcons (Qdefun, symbol)); 668 LOADHIST_ATTACH (Fcons (Qdefun, symbol));
667 if (!NILP (docstring)) 669 if (!NILP (docstring))
668 Fput (symbol, Qfunction_documentation, docstring); 670 Fput (symbol, Qfunction_documentation, docstring);
669 return definition; 671 /* We used to return `definition', but now that `defun' and `defmacro' expand
672 to a call to `defalias', we return `symbol' for backward compatibility
673 (bug#11686). */
674 return symbol;
670} 675}
671 676
672DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0, 677DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
diff --git a/src/frame.c b/src/frame.c
index 39d26ded5a6..fc52b07923d 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -630,8 +630,8 @@ DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame,
630 doc: /* Create an additional terminal frame, possibly on another terminal. 630 doc: /* Create an additional terminal frame, possibly on another terminal.
631This function takes one argument, an alist specifying frame parameters. 631This function takes one argument, an alist specifying frame parameters.
632 632
633You can create multiple frames on a single text-only terminal, but 633You can create multiple frames on a single text terminal, but only one
634only one of them (the selected terminal frame) is actually displayed. 634of them (the selected terminal frame) is actually displayed.
635 635
636In practice, generally you don't need to specify any parameters, 636In practice, generally you don't need to specify any parameters,
637except when you want to create a new frame on another terminal. 637except when you want to create a new frame on another terminal.
@@ -865,8 +865,8 @@ something to select a different frame, or until the next time
865this function is called. If you are using a window system, the 865this function is called. If you are using a window system, the
866previously selected frame may be restored as the selected frame 866previously selected frame may be restored as the selected frame
867when returning to the command loop, because it still may have 867when returning to the command loop, because it still may have
868the window system's input focus. On a text-only terminal, the 868the window system's input focus. On a text terminal, the next
869next redisplay will display FRAME. 869redisplay will display FRAME.
870 870
871This function returns FRAME, or nil if FRAME has been deleted. */) 871This function returns FRAME, or nil if FRAME has been deleted. */)
872 (Lisp_Object frame, Lisp_Object norecord) 872 (Lisp_Object frame, Lisp_Object norecord)
@@ -1254,7 +1254,17 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1254 FOR_EACH_FRAME (tail, frame1) 1254 FOR_EACH_FRAME (tail, frame1)
1255 { 1255 {
1256 if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1))) 1256 if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1)))
1257 break; 1257 {
1258 /* Do not change a text terminal's top-frame. */
1259 struct frame *f1 = XFRAME (frame1);
1260 if (FRAME_TERMCAP_P (f1) || FRAME_MSDOS_P (f1))
1261 {
1262 Lisp_Object top_frame = FRAME_TTY (f1)->top_frame;
1263 if (!EQ (top_frame, frame))
1264 frame1 = top_frame;
1265 }
1266 break;
1267 }
1258 } 1268 }
1259 } 1269 }
1260#ifdef NS_IMPL_COCOA 1270#ifdef NS_IMPL_COCOA
@@ -1730,8 +1740,8 @@ usually not displayed at all, even in a window system's \"taskbar\".
1730Normally you may not make FRAME invisible if all other frames are invisible, 1740Normally you may not make FRAME invisible if all other frames are invisible,
1731but if the second optional argument FORCE is non-nil, you may do so. 1741but if the second optional argument FORCE is non-nil, you may do so.
1732 1742
1733This function has no effect on text-only terminal frames. Such frames 1743This function has no effect on text terminal frames. Such frames are
1734are always considered visible, whether or not they are currently being 1744always considered visible, whether or not they are currently being
1735displayed in the terminal. */) 1745displayed in the terminal. */)
1736 (Lisp_Object frame, Lisp_Object force) 1746 (Lisp_Object frame, Lisp_Object force)
1737{ 1747{
@@ -1743,12 +1753,6 @@ displayed in the terminal. */)
1743 if (NILP (force) && !other_visible_frames (XFRAME (frame))) 1753 if (NILP (force) && !other_visible_frames (XFRAME (frame)))
1744 error ("Attempt to make invisible the sole visible or iconified frame"); 1754 error ("Attempt to make invisible the sole visible or iconified frame");
1745 1755
1746#if 0 /* This isn't logically necessary, and it can do GC. */
1747 /* Don't let the frame remain selected. */
1748 if (EQ (frame, selected_frame))
1749 do_switch_frame (next_frame (frame, Qt), 0, 0, Qnil)
1750#endif
1751
1752 /* Don't allow minibuf_window to remain on a deleted frame. */ 1756 /* Don't allow minibuf_window to remain on a deleted frame. */
1753 if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window)) 1757 if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window))
1754 { 1758 {
@@ -1816,7 +1820,7 @@ Return nil if FRAME was made invisible, via `make-frame-invisible'.
1816On graphical displays, invisible frames are not updated and are 1820On graphical displays, invisible frames are not updated and are
1817usually not displayed at all, even in a window system's \"taskbar\". 1821usually not displayed at all, even in a window system's \"taskbar\".
1818 1822
1819If FRAME is a text-only terminal frame, this always returns t. 1823If FRAME is a text terminal frame, this always returns t.
1820Such frames are always considered visible, whether or not they are 1824Such frames are always considered visible, whether or not they are
1821currently being displayed on the terminal. */) 1825currently being displayed on the terminal. */)
1822 (Lisp_Object frame) 1826 (Lisp_Object frame)
@@ -1872,7 +1876,7 @@ doesn't support multiple overlapping frames, this function selects FRAME. */)
1872 f = XFRAME (frame); 1876 f = XFRAME (frame);
1873 1877
1874 if (FRAME_TERMCAP_P (f)) 1878 if (FRAME_TERMCAP_P (f))
1875 /* On a text-only terminal select FRAME. */ 1879 /* On a text terminal select FRAME. */
1876 Fselect_frame (frame, Qnil); 1880 Fselect_frame (frame, Qnil);
1877 else 1881 else
1878 /* Do like the documentation says. */ 1882 /* Do like the documentation says. */
@@ -2493,7 +2497,7 @@ not the menu bar).
2493In a graphical version with no toolkit, it includes both the tool bar 2497In a graphical version with no toolkit, it includes both the tool bar
2494and menu bar. 2498and menu bar.
2495 2499
2496For a text-only terminal, it includes the menu bar. In this case, the 2500For a text terminal, it includes the menu bar. In this case, the
2497result is really in characters rather than pixels (i.e., is identical 2501result is really in characters rather than pixels (i.e., is identical
2498to `frame-height'). */) 2502to `frame-height'). */)
2499 (Lisp_Object frame) 2503 (Lisp_Object frame)
diff --git a/src/term.c b/src/term.c
index 3a41552c02e..5f807181199 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2132,7 +2132,7 @@ DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
2132 2132
2133TERMINAL can be a terminal object, a frame, or nil (meaning the 2133TERMINAL can be a terminal object, a frame, or nil (meaning the
2134selected frame's terminal). This function always returns nil if 2134selected frame's terminal). This function always returns nil if
2135TERMINAL does not refer to a text-only terminal. */) 2135TERMINAL does not refer to a text terminal. */)
2136 (Lisp_Object terminal) 2136 (Lisp_Object terminal)
2137{ 2137{
2138 struct terminal *t = get_tty_terminal (terminal, 0); 2138 struct terminal *t = get_tty_terminal (terminal, 0);
@@ -2149,7 +2149,7 @@ DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
2149 2149
2150TERMINAL can be a terminal object, a frame, or nil (meaning the 2150TERMINAL can be a terminal object, a frame, or nil (meaning the
2151selected frame's terminal). This function always returns 0 if 2151selected frame's terminal). This function always returns 0 if
2152TERMINAL does not refer to a text-only terminal. */) 2152TERMINAL does not refer to a text terminal. */)
2153 (Lisp_Object terminal) 2153 (Lisp_Object terminal)
2154{ 2154{
2155 struct terminal *t = get_tty_terminal (terminal, 0); 2155 struct terminal *t = get_tty_terminal (terminal, 0);
@@ -2371,7 +2371,7 @@ no effect if used on a non-tty terminal.
2371 2371
2372TERMINAL can be a terminal object, a frame or nil (meaning the 2372TERMINAL can be a terminal object, a frame or nil (meaning the
2373selected frame's terminal). This function always returns nil if 2373selected frame's terminal). This function always returns nil if
2374TERMINAL does not refer to a text-only terminal. */) 2374TERMINAL does not refer to a text terminal. */)
2375 (Lisp_Object terminal) 2375 (Lisp_Object terminal)
2376{ 2376{
2377 struct terminal *t = get_terminal (terminal, 1); 2377 struct terminal *t = get_terminal (terminal, 1);
@@ -2381,6 +2381,21 @@ TERMINAL does not refer to a text-only terminal. */)
2381 return Qnil; 2381 return Qnil;
2382} 2382}
2383 2383
2384DEFUN ("tty-top-frame", Ftty_top_frame, Stty_top_frame, 0, 1, 0,
2385 doc: /* Return the topmost terminal frame on TERMINAL.
2386TERMINAL can be a terminal object, a frame or nil (meaning the
2387selected frame's terminal). This function returns nil if TERMINAL
2388does not refer to a text terminal. Otherwise, it returns the
2389top-most frame on the text terminal. */)
2390 (Lisp_Object terminal)
2391{
2392 struct terminal *t = get_terminal (terminal, 1);
2393
2394 if (t->type == output_termcap)
2395 return t->display_info.tty->top_frame;
2396 return Qnil;
2397}
2398
2384 2399
2385 2400
2386DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0, 2401DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
@@ -3638,6 +3653,7 @@ bigger, or it may make it blink, or it may do nothing at all. */);
3638 defsubr (&Stty_no_underline); 3653 defsubr (&Stty_no_underline);
3639 defsubr (&Stty_type); 3654 defsubr (&Stty_type);
3640 defsubr (&Scontrolling_tty_p); 3655 defsubr (&Scontrolling_tty_p);
3656 defsubr (&Stty_top_frame);
3641 defsubr (&Ssuspend_tty); 3657 defsubr (&Ssuspend_tty);
3642 defsubr (&Sresume_tty); 3658 defsubr (&Sresume_tty);
3643#ifdef HAVE_GPM 3659#ifdef HAVE_GPM
diff --git a/src/xdisp.c b/src/xdisp.c
index 1353b4e1184..87e079f8ab1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8410,9 +8410,9 @@ move_it_in_display_line_to (struct it *it,
8410 /* On graphical terminals, newlines may 8410 /* On graphical terminals, newlines may
8411 "overflow" into the fringe if 8411 "overflow" into the fringe if
8412 overflow-newline-into-fringe is non-nil. 8412 overflow-newline-into-fringe is non-nil.
8413 On text-only terminals, newlines may 8413 On text terminals, newlines may overflow
8414 overflow into the last glyph on the 8414 into the last glyph on the display
8415 display line.*/ 8415 line.*/
8416 if (!FRAME_WINDOW_P (it->f) 8416 if (!FRAME_WINDOW_P (it->f)
8417 || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) 8417 || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
8418 { 8418 {
@@ -10875,7 +10875,8 @@ static Lisp_Object mode_line_string_face_prop;
10875static Lisp_Object Vmode_line_unwind_vector; 10875static Lisp_Object Vmode_line_unwind_vector;
10876 10876
10877static Lisp_Object 10877static Lisp_Object
10878format_mode_line_unwind_data (struct buffer *obuf, 10878format_mode_line_unwind_data (struct frame *target_frame,
10879 struct buffer *obuf,
10879 Lisp_Object owin, 10880 Lisp_Object owin,
10880 int save_proptrans) 10881 int save_proptrans)
10881{ 10882{
@@ -10887,7 +10888,7 @@ format_mode_line_unwind_data (struct buffer *obuf,
10887 Vmode_line_unwind_vector = Qnil; 10888 Vmode_line_unwind_vector = Qnil;
10888 10889
10889 if (NILP (vector)) 10890 if (NILP (vector))
10890 vector = Fmake_vector (make_number (8), Qnil); 10891 vector = Fmake_vector (make_number (10), Qnil);
10891 10892
10892 ASET (vector, 0, make_number (mode_line_target)); 10893 ASET (vector, 0, make_number (mode_line_target));
10893 ASET (vector, 1, make_number (MODE_LINE_NOPROP_LEN (0))); 10894 ASET (vector, 1, make_number (MODE_LINE_NOPROP_LEN (0)));
@@ -10902,6 +10903,15 @@ format_mode_line_unwind_data (struct buffer *obuf,
10902 tmp = Qnil; 10903 tmp = Qnil;
10903 ASET (vector, 6, tmp); 10904 ASET (vector, 6, tmp);
10904 ASET (vector, 7, owin); 10905 ASET (vector, 7, owin);
10906 if (target_frame)
10907 {
10908 /* Similarly to `with-selected-window', if the operation selects
10909 a window on another frame, we must restore that frame's
10910 selected window, and (for a tty) the top-frame. */
10911 ASET (vector, 8, target_frame->selected_window);
10912 if (FRAME_TERMCAP_P (target_frame))
10913 ASET (vector, 9, FRAME_TTY (target_frame)->top_frame);
10914 }
10905 10915
10906 return vector; 10916 return vector;
10907} 10917}
@@ -10909,6 +10919,10 @@ format_mode_line_unwind_data (struct buffer *obuf,
10909static Lisp_Object 10919static Lisp_Object
10910unwind_format_mode_line (Lisp_Object vector) 10920unwind_format_mode_line (Lisp_Object vector)
10911{ 10921{
10922 Lisp_Object old_window = AREF (vector, 7);
10923 Lisp_Object target_frame_window = AREF (vector, 8);
10924 Lisp_Object old_top_frame = AREF (vector, 9);
10925
10912 mode_line_target = XINT (AREF (vector, 0)); 10926 mode_line_target = XINT (AREF (vector, 0));
10913 mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1)); 10927 mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1));
10914 mode_line_string_list = AREF (vector, 2); 10928 mode_line_string_list = AREF (vector, 2);
@@ -10917,9 +10931,26 @@ unwind_format_mode_line (Lisp_Object vector)
10917 mode_line_string_face = AREF (vector, 4); 10931 mode_line_string_face = AREF (vector, 4);
10918 mode_line_string_face_prop = AREF (vector, 5); 10932 mode_line_string_face_prop = AREF (vector, 5);
10919 10933
10920 if (!NILP (AREF (vector, 7))) 10934 /* Select window before buffer, since it may change the buffer. */
10921 /* Select window before buffer, since it may change the buffer. */ 10935 if (!NILP (old_window))
10922 Fselect_window (AREF (vector, 7), Qt); 10936 {
10937 /* If the operation that we are unwinding had selected a window
10938 on a different frame, reset its frame-selected-window. For a
10939 text terminal, reset its top-frame if necessary. */
10940 if (!NILP (target_frame_window))
10941 {
10942 Lisp_Object frame
10943 = WINDOW_FRAME (XWINDOW (target_frame_window));
10944
10945 if (!EQ (frame, WINDOW_FRAME (XWINDOW (old_window))))
10946 Fselect_window (target_frame_window, Qt);
10947
10948 if (!NILP (old_top_frame) && !EQ (old_top_frame, frame))
10949 Fselect_frame (old_top_frame, Qt);
10950 }
10951
10952 Fselect_window (old_window, Qt);
10953 }
10923 10954
10924 if (!NILP (AREF (vector, 6))) 10955 if (!NILP (AREF (vector, 6)))
10925 { 10956 {
@@ -10990,8 +11021,6 @@ store_mode_line_noprop (const char *string, int field_width, int precision)
10990 Frame Titles 11021 Frame Titles
10991 ***********************************************************************/ 11022 ***********************************************************************/
10992 11023
10993#ifdef HAVE_WINDOW_SYSTEM
10994
10995/* Set the title of FRAME, if it has changed. The title format is 11024/* Set the title of FRAME, if it has changed. The title format is
10996 Vicon_title_format if FRAME is iconified, otherwise it is 11025 Vicon_title_format if FRAME is iconified, otherwise it is
10997 frame_title_format. */ 11026 frame_title_format. */
@@ -11035,7 +11064,7 @@ x_consider_frame_title (Lisp_Object frame)
11035 mode_line_noprop_buf; then display the title. */ 11064 mode_line_noprop_buf; then display the title. */
11036 record_unwind_protect (unwind_format_mode_line, 11065 record_unwind_protect (unwind_format_mode_line,
11037 format_mode_line_unwind_data 11066 format_mode_line_unwind_data
11038 (current_buffer, selected_window, 0)); 11067 (f, current_buffer, selected_window, 0));
11039 11068
11040 Fselect_window (f->selected_window, Qt); 11069 Fselect_window (f->selected_window, Qt);
11041 set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer)); 11070 set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer));
@@ -11062,10 +11091,6 @@ x_consider_frame_title (Lisp_Object frame)
11062 } 11091 }
11063} 11092}
11064 11093
11065#endif /* not HAVE_WINDOW_SYSTEM */
11066
11067
11068
11069 11094
11070/*********************************************************************** 11095/***********************************************************************
11071 Menu Bars 11096 Menu Bars
@@ -11092,7 +11117,6 @@ prepare_menu_bars (void)
11092 /* Update all frame titles based on their buffer names, etc. We do 11117 /* Update all frame titles based on their buffer names, etc. We do
11093 this before the menu bars so that the buffer-menu will show the 11118 this before the menu bars so that the buffer-menu will show the
11094 up-to-date frame titles. */ 11119 up-to-date frame titles. */
11095#ifdef HAVE_WINDOW_SYSTEM
11096 if (windows_or_buffers_changed || update_mode_lines) 11120 if (windows_or_buffers_changed || update_mode_lines)
11097 { 11121 {
11098 Lisp_Object tail, frame; 11122 Lisp_Object tail, frame;
@@ -11105,7 +11129,6 @@ prepare_menu_bars (void)
11105 x_consider_frame_title (frame); 11129 x_consider_frame_title (frame);
11106 } 11130 }
11107 } 11131 }
11108#endif /* HAVE_WINDOW_SYSTEM */
11109 11132
11110 /* Update the menu bar item lists, if appropriate. This has to be 11133 /* Update the menu bar item lists, if appropriate. This has to be
11111 done before any actual redisplay or generation of display lines. */ 11134 done before any actual redisplay or generation of display lines. */
@@ -20230,7 +20253,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
20230 it.paragraph_embedding = L2R; 20253 it.paragraph_embedding = L2R;
20231 20254
20232 record_unwind_protect (unwind_format_mode_line, 20255 record_unwind_protect (unwind_format_mode_line,
20233 format_mode_line_unwind_data (NULL, Qnil, 0)); 20256 format_mode_line_unwind_data (NULL, NULL, Qnil, 0));
20234 20257
20235 mode_line_target = MODE_LINE_DISPLAY; 20258 mode_line_target = MODE_LINE_DISPLAY;
20236 20259
@@ -20931,7 +20954,8 @@ are the selected window and the WINDOW's buffer). */)
20931 and set that to nil so that we don't alter the outer value. */ 20954 and set that to nil so that we don't alter the outer value. */
20932 record_unwind_protect (unwind_format_mode_line, 20955 record_unwind_protect (unwind_format_mode_line,
20933 format_mode_line_unwind_data 20956 format_mode_line_unwind_data
20934 (old_buffer, selected_window, 1)); 20957 (XFRAME (WINDOW_FRAME (XWINDOW (window))),
20958 old_buffer, selected_window, 1));
20935 mode_line_proptrans_alist = Qnil; 20959 mode_line_proptrans_alist = Qnil;
20936 20960
20937 Fselect_window (window, Qt); 20961 Fselect_window (window, Qt);