diff options
| author | Joakim Verona | 2013-04-09 00:21:04 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-04-09 00:21:04 +0200 |
| commit | e25d341cec1ebaee2b96d627d99d4d7b92dee6b0 (patch) | |
| tree | a837c08c8ff2a6054964bd73469f6386368300e7 /src | |
| parent | 9639da1e26683b6a54d255bb07a24dd6e0fae354 (diff) | |
| parent | 6fcdab68b3e73354fb17f4c8c4f8199d6f63cf30 (diff) | |
| download | emacs-e25d341cec1ebaee2b96d627d99d4d7b92dee6b0.tar.gz emacs-e25d341cec1ebaee2b96d627d99d4d7b92dee6b0.zip | |
xdisp fix
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 267 | ||||
| -rw-r--r-- | src/ChangeLog.10 | 2 | ||||
| -rw-r--r-- | src/Makefile.in | 6 | ||||
| -rw-r--r-- | src/alloc.c | 9 | ||||
| -rw-r--r-- | src/buffer.c | 26 | ||||
| -rw-r--r-- | src/ccl.c | 4 | ||||
| -rw-r--r-- | src/character.c | 6 | ||||
| -rw-r--r-- | src/charset.c | 2 | ||||
| -rw-r--r-- | src/coding.c | 208 | ||||
| -rw-r--r-- | src/data.c | 4 | ||||
| -rw-r--r-- | src/dired.c | 5 | ||||
| -rw-r--r-- | src/dispextern.h | 31 | ||||
| -rw-r--r-- | src/dispnew.c | 117 | ||||
| -rw-r--r-- | src/doc.c | 2 | ||||
| -rw-r--r-- | src/doprnt.c | 2 | ||||
| -rw-r--r-- | src/editfns.c | 12 | ||||
| -rw-r--r-- | src/fileio.c | 37 | ||||
| -rw-r--r-- | src/fns.c | 17 | ||||
| -rw-r--r-- | src/font.c | 10 | ||||
| -rw-r--r-- | src/fontset.c | 9 | ||||
| -rw-r--r-- | src/fontset.h | 3 | ||||
| -rw-r--r-- | src/frame.c | 84 | ||||
| -rw-r--r-- | src/frame.h | 8 | ||||
| -rw-r--r-- | src/fringe.c | 12 | ||||
| -rw-r--r-- | src/gtkutil.c | 2 | ||||
| -rw-r--r-- | src/image.c | 11 | ||||
| -rw-r--r-- | src/indent.c | 29 | ||||
| -rw-r--r-- | src/insdel.c | 17 | ||||
| -rw-r--r-- | src/keyboard.c | 35 | ||||
| -rw-r--r-- | src/keymap.c | 8 | ||||
| -rw-r--r-- | src/lisp.h | 122 | ||||
| -rw-r--r-- | src/lread.c | 12 | ||||
| -rw-r--r-- | src/makefile.w32-in | 2 | ||||
| -rw-r--r-- | src/menu.c | 3 | ||||
| -rw-r--r-- | src/minibuf.c | 6 | ||||
| -rw-r--r-- | src/msdos.c | 13 | ||||
| -rw-r--r-- | src/nsfns.m | 147 | ||||
| -rw-r--r-- | src/nsmenu.m | 55 | ||||
| -rw-r--r-- | src/nsselect.m | 15 | ||||
| -rw-r--r-- | src/nsterm.h | 6 | ||||
| -rw-r--r-- | src/nsterm.m | 132 | ||||
| -rw-r--r-- | src/print.c | 4 | ||||
| -rw-r--r-- | src/process.c | 2 | ||||
| -rw-r--r-- | src/search.c | 6 | ||||
| -rw-r--r-- | src/textprop.c | 3 | ||||
| -rw-r--r-- | src/w32fns.c | 84 | ||||
| -rw-r--r-- | src/w32font.c | 2 | ||||
| -rw-r--r-- | src/w32menu.c | 6 | ||||
| -rw-r--r-- | src/w32term.c | 2 | ||||
| -rw-r--r-- | src/w32term.h | 2 | ||||
| -rw-r--r-- | src/window.c | 488 | ||||
| -rw-r--r-- | src/window.h | 58 | ||||
| -rw-r--r-- | src/xdisp.c | 223 | ||||
| -rw-r--r-- | src/xfaces.c | 24 | ||||
| -rw-r--r-- | src/xfns.c | 79 | ||||
| -rw-r--r-- | src/xgselect.c | 3 | ||||
| -rw-r--r-- | src/xmenu.c | 11 | ||||
| -rw-r--r-- | src/xselect.c | 8 | ||||
| -rw-r--r-- | src/xsmfns.c | 2 | ||||
| -rw-r--r-- | src/xterm.h | 6 |
60 files changed, 1383 insertions, 1128 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6698cfe0fcf..cb6930f9acc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,268 @@ | |||
| 1 | 2013-04-07 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * fileio.c (ACL_NOT_WELL_SUPPORTED): Define macro for WINDOWSNT. | ||
| 4 | |||
| 5 | 2013-04-07 Romain Francoise <romain@orebokech.com> | ||
| 6 | |||
| 7 | Ignore additional platform-specific ACL errors (Bug#13702). | ||
| 8 | * fileio.c (ACL_NOT_WELL_SUPPORTED): New macro copied from gnulib. | ||
| 9 | (Fcopy_file, Fset_file_acl) [HAVE_POSIX_ACL]: Use it. | ||
| 10 | |||
| 11 | 2013-03-31 Jan Djärv <jan.h.d@swipnet.se> | ||
| 12 | |||
| 13 | * nsterm.m (ns_mouse_position): Use NS_FRAME_P instead of checking | ||
| 14 | f->output_data.ns. | ||
| 15 | |||
| 16 | 2013-04-07 Paul Eggert <eggert@cs.ucla.edu> | ||
| 17 | |||
| 18 | Fix --enable-profiling bug introduced by 2013-02-25 change (Bug#13783). | ||
| 19 | This bug was introduced by my 2013-02-25 change that simplified | ||
| 20 | data_start configuration. Without this change, on GNU/Linux | ||
| 21 | an Emacs configured with --enable-profiling fails immediately | ||
| 22 | due to a profiler signal. | ||
| 23 | * Makefile.in: Compile with $(PROFILING_CFLAGS), but do not link | ||
| 24 | with these flags. On platforms where special flags are needed | ||
| 25 | when linking temacs, the flags are now in LD_SWITCH_SYSTEM_TEMACS. | ||
| 26 | (ALL_CFLAGS): Remove $(PROFILING_CFLAGS). | ||
| 27 | (.c.o, .m.o): Compile with $(PROFILING_CFLAGS). | ||
| 28 | |||
| 29 | 2013-04-07 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 30 | |||
| 31 | Get rid of some platform-specific functions examining window | ||
| 32 | system and its capabilities. This is a partial rework of the | ||
| 33 | 2013-04-05 change. | ||
| 34 | * lisp.h (have_menus_p): Remove prototype. This function is | ||
| 35 | replaced with platform-independent window_system_available. | ||
| 36 | (check_window_system): Move to... | ||
| 37 | * frame.h (decode_window_system_frame, window_system_available): | ||
| 38 | ...here, add new prototypes. | ||
| 39 | * frame.c (window_system_available, decode_window_system_frame): | ||
| 40 | New functions. | ||
| 41 | (check_window_system): Platform-independent now. | ||
| 42 | * xterm.h (x_in_use): Remove declaration. | ||
| 43 | (check_x_frame): | ||
| 44 | * w32term.h (check_x_frame): | ||
| 45 | * nsterm.h (check_x_frame): Remove prototypes. This function | ||
| 46 | is replaced with platform-independent decode_window_system_frame. | ||
| 47 | * msdos.c (have_menus_p): Remove. | ||
| 48 | * nsfns.m (check_window_system, have_menus_p, check_ns_frame): | ||
| 49 | Remove platform-specific functions. Use check_window_system, | ||
| 50 | decode_window_system_frame and check_ns_display_info where | ||
| 51 | appropriate. Minor style and comment tweaks. | ||
| 52 | * w32fns.c (w32_in_use, check_window_system, have_menus_p) | ||
| 53 | (check_x_frame): Likewise. | ||
| 54 | * xfns.c (x_in_use, check_window_system, have_menus_p, check_x_frame): | ||
| 55 | Likewise. | ||
| 56 | * fileio.c, fns.c, font.c, fontset.c, image.c, menu.c, nsmenu.m: | ||
| 57 | * nsselect.m, nsterm.m, w32font.c, w32menu.c, xfaces.c, xgselect.c: | ||
| 58 | * xmenu.c, xselect.c: All related users changed. | ||
| 59 | |||
| 60 | 2013-04-03 Kenichi Handa <handa@gnu.org> | ||
| 61 | |||
| 62 | The following changes is to optimize the code for reading UTF-8 | ||
| 63 | files. | ||
| 64 | |||
| 65 | * coding.c (check_ascii): Renamed from detect_ascii. Return value | ||
| 66 | changed. Check EOL format. Do not call adjust_coding_eol_type | ||
| 67 | here. | ||
| 68 | (check_utf_8): New function. | ||
| 69 | (adjust_coding_eol_type): Do nothing if already adjusted. | ||
| 70 | (detect_coding): Compare the return value of check_ascii with | ||
| 71 | coding->src_bytes. Call adjust_coding_eol_type if necessary. | ||
| 72 | (decode_coding_gap): Optimize for valid UTF-8. | ||
| 73 | |||
| 74 | 2013-03-21 Kenichi Handa <handa@gnu.org> | ||
| 75 | |||
| 76 | * coding.c (syms_of_coding): Cancel previous change. | ||
| 77 | |||
| 78 | * insdel.c (insert_from_gap): Fix previous change. | ||
| 79 | |||
| 80 | 2013-04-05 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 81 | |||
| 82 | Consistently use platform-specific function to detect window system. | ||
| 83 | * lisp.h (check_window_system): New prototype. This function is | ||
| 84 | going to replace check_x, check_w32 and check_ns. | ||
| 85 | (have_menus_p): Mention msdos.c in comment. | ||
| 86 | * fontset.c (check_window_system_func): Remove. Adjust all users. | ||
| 87 | * fontset.h (check_window_system_func): Remove prototype. | ||
| 88 | * nsterm.h (check_ns): | ||
| 89 | * xterm.h (check_x): | ||
| 90 | * w32term.h (check_w32): Likewise. | ||
| 91 | * menu.c (Fx_popup_menu): Use check_window_system. | ||
| 92 | * msdos.c (check_window_system): Define for MS-DOS. | ||
| 93 | * nsfns.m (check_window_system): Define for NS. Adjust all users. | ||
| 94 | * w32fns.c (check_window_system): Likewise for MS-Windows. | ||
| 95 | * xfns.c (check_window_system): Likewise for X. | ||
| 96 | * font.c, frame.c, nsmenu.m, nsselect.m, nsterm.m, w32menu.c: | ||
| 97 | * xfaces.c, xmenu.c: Use check_window_system where appropriate. | ||
| 98 | |||
| 99 | 2013-04-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 100 | |||
| 101 | Prefer < to > in range checks such as 0 <= i && i < N. | ||
| 102 | This makes it easier to visualize quantities on a number line. | ||
| 103 | This patch doesn't apply to all such range checks, | ||
| 104 | only to the range checks affected by the 2013-03-24 change. | ||
| 105 | This patch reverts most of the 2013-03-24 change. | ||
| 106 | * alloc.c (xpalloc, Fgarbage_collect): | ||
| 107 | * ccl.c (ccl_driver, resolve_symbol_ccl_program): | ||
| 108 | * character.c (string_escape_byte8): | ||
| 109 | * charset.c (read_hex): | ||
| 110 | * data.c (cons_to_unsigned): | ||
| 111 | * dispnew.c (update_frame_1): | ||
| 112 | * doc.c (Fsubstitute_command_keys): | ||
| 113 | * doprnt.c (doprnt): | ||
| 114 | * editfns.c (hi_time, decode_time_components): | ||
| 115 | * fileio.c (file_offset): | ||
| 116 | * fns.c (larger_vector, make_hash_table, Fmake_hash_table): | ||
| 117 | * font.c (font_intern_prop): | ||
| 118 | * frame.c (x_set_alpha): | ||
| 119 | * gtkutil.c (get_utf8_string): | ||
| 120 | * indent.c (check_display_width): | ||
| 121 | * keymap.c (Fkey_description): | ||
| 122 | * lisp.h (FIXNUM_OVERFLOW_P, vcopy): | ||
| 123 | * lread.c (read1): | ||
| 124 | * minibuf.c (read_minibuf_noninteractive): | ||
| 125 | * process.c (wait_reading_process_output): | ||
| 126 | * search.c (Freplace_match): | ||
| 127 | * window.c (get_phys_cursor_glyph): | ||
| 128 | * xdisp.c (redisplay_internal): | ||
| 129 | * xsmfns.c (smc_save_yourself_CB): | ||
| 130 | Prefer < to > for range checks. | ||
| 131 | * dispnew.c (sit_for): Don't mishandle NaNs. | ||
| 132 | This fixes a bug introduced in the 2013-03-24 change. | ||
| 133 | * editfns.c (decode_time_components): Don't hoist comparison. | ||
| 134 | This fixes another bug introduced in the 2013-03-24 change. | ||
| 135 | |||
| 136 | 2013-03-31 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 137 | |||
| 138 | * frame.h (struct frame): Drop scroll_bottom_vpos | ||
| 139 | member becaue all real users are dead long ago. | ||
| 140 | (FRAME_SCROLL_BOTTOM_VPOS): Remove. | ||
| 141 | * xdisp.c (redisplay_internal): Adjust user. | ||
| 142 | |||
| 143 | 2013-03-30 Darren Ho <darren.hoo@gmail.com> (tiny change) | ||
| 144 | |||
| 145 | * nsmenu.m (showAtX:Y:for:): setLevel to | ||
| 146 | NSPopUpMenuWindowLevel (Bug#13998). | ||
| 147 | |||
| 148 | 2013-03-30 Jan Djärv <jan.h.d@swipnet.se> | ||
| 149 | |||
| 150 | * nsterm.h (ns_get_pending_menu_title, ns_check_menu_open) | ||
| 151 | (ns_check_pending_open_menu): Declare. | ||
| 152 | |||
| 153 | * nsmenu.m (ns_update_menubar): Correct NSTRACE. | ||
| 154 | (x_activate_menubar): Update the menu with title that matches | ||
| 155 | ns_get_pending_menu_title, and call | ||
| 156 | ns_check_pending_openmenu (Bug#12698). | ||
| 157 | (menuWillOpen:): New method. | ||
| 158 | (menuNeedsUpdate:): Add check for ! COCOA || OSX < 10.5 (Bug#12698). | ||
| 159 | |||
| 160 | * nsterm.m (menu_will_open_state, menu_mouse_point) | ||
| 161 | (menu_pending_title): New varaibles. | ||
| 162 | (ns_get_pending_menu_title, ns_check_menu_open) | ||
| 163 | (ns_check_pending_open_menu): New functions. | ||
| 164 | |||
| 165 | 2013-03-29 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 166 | |||
| 167 | * indent.c (current_column_bol_cache): Remove leftover which is not | ||
| 168 | used in Fmove_to_column any more. | ||
| 169 | (current_column, scan_for_column): Adjust users. | ||
| 170 | * keyboard.c (last_point_position_buffer, last_point_position_window): | ||
| 171 | Remove leftovers which are not used for recording undo any more. | ||
| 172 | (command_loop_1, syms_of_keyboard): Adjust users. | ||
| 173 | * xdisp.c (last_max_ascent): Remove leftover which is not used in | ||
| 174 | redisplay_window any more. | ||
| 175 | (move_it_to): Adjust user. | ||
| 176 | |||
| 177 | 2013-03-29 Juanma Barranquero <lekktu@gmail.com> | ||
| 178 | |||
| 179 | * makefile.w32-in ($(BLD)/filelock.$(O), $(BLD)/filelock.$(O)): | ||
| 180 | Update dependencies. | ||
| 181 | |||
| 182 | 2013-03-28 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 183 | |||
| 184 | * lisp.h (save_type, XSAVE_POINTER, set_save_pointer, XSAVE_INTEGER) | ||
| 185 | (set_save_integer, XSAVE_OBJECT, XSAVE_VALUE): Move to avoid | ||
| 186 | forward references. | ||
| 187 | |||
| 188 | 2013-03-28 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 189 | |||
| 190 | * window.h (struct window): Replace hchild, vchild and buffer slots | ||
| 191 | with the only contents slot. This is possible because each valid | ||
| 192 | window may have either the child window (in vertical or horizontal | ||
| 193 | combination) or buffer to display (for the leaf window). Using that, | ||
| 194 | a lof of operations to traverse and/or change window hierarchies may | ||
| 195 | be simplified. New member horizontal is used to distinguish between | ||
| 196 | horizontal and vertical combinations of internal windows. | ||
| 197 | (WINDOW_LEAF_P, WINDOW_HORIZONTAL_COMBINATION_P) | ||
| 198 | (WINDOW_VERTICAL_COMBINATION_P): New macros. | ||
| 199 | (WINDOW_VALID_P, WINDOW_LIVE_P): Adjust to match struct window changes. | ||
| 200 | * window.c (wset_hchild, wset_vchild): Remove. Adjust all users. | ||
| 201 | Use contents slot, not buffer, where appropriate. | ||
| 202 | (wset_combination): New function. | ||
| 203 | (wset_buffer): Add eassert. | ||
| 204 | (Fframe_first_window): Simplify the loop reaching first window. | ||
| 205 | (Fwindow_buffer): Use WINDOW_LEAF_P. | ||
| 206 | (Fwindow_top_child): Use WINDOW_VERTICAL_COMBINATION_P. | ||
| 207 | (Fwindow_left_child): Use WINDOW_HORIZONTAL_COMBINATION_P. | ||
| 208 | (unshow_buffer): Convert initial debugging check to eassert. | ||
| 209 | (replace_window, recombine_windows, Fdelete_other_windows_internal) | ||
| 210 | (make_parent_window, window_resize_check, window_resize_apply) | ||
| 211 | (resize_frame_windows, Fsplit_window_internal, Fdelete_window_internal) | ||
| 212 | (Fset_window_configuration, delete_all_child_windows, save_window_save): | ||
| 213 | Adjust to match struct window changes. | ||
| 214 | (window_loop): Check for broken markers in CHECK_ALL_WINDOWS. | ||
| 215 | (mark_window_cursors_off, count_windows, get_leaf_windows) | ||
| 216 | (foreach_window_1): Simplify the loop. | ||
| 217 | * alloc.c (mark_object): Do not check for the leaf window because | ||
| 218 | internal windows has no glyph matrices anyway. | ||
| 219 | * dispnew.c (clear_window_matrices, showing_window_margins_p) | ||
| 220 | (allocate_matrices_for_window_redisplay, fake_current_matrices) | ||
| 221 | (allocate_matrices_for_frame_redisplay, free_window_matrices) | ||
| 222 | (build_frame_matrix_from_window_tree, mirror_make_current) | ||
| 223 | (frame_row_to_window, mirror_line_dance, check_window_matrix_pointers) | ||
| 224 | (update_window_tree, set_window_update_flags): Simplify the loop. | ||
| 225 | (sync_window_with_frame_matrix_rows): Enforce live window. | ||
| 226 | Use contents slot, not buffer, where appropriate. | ||
| 227 | * frame.c (set_menu_bar_lines_1): Use WINDOW_VERTICAL_COMBINATION_P | ||
| 228 | and WINDOW_HORIZONTAL_COMBINATION_P. | ||
| 229 | (make_frame_visible_1): Simplify the loop. | ||
| 230 | Use contents slot, not buffer, where appropriate. | ||
| 231 | * xdisp.c (hscroll_window_tree, mark_window_display_accurate) | ||
| 232 | (redisplay_windows, redisplay_mode_lines, update_cursor_in_window_tree) | ||
| 233 | (expose_window_tree): Likewise. | ||
| 234 | Use contents slot, not buffer, where appropriate. | ||
| 235 | * textprop.c (get_char_property_and_overlay): Add CHECK_LIVE_WINDOW | ||
| 236 | to avoid deleted windows. Use contents slot instead of buffer. | ||
| 237 | * buffer.c, dispextern.h, editfns.c, fileio.c, font.c, fringe.c: | ||
| 238 | * indent.c, insdel.c, keyboard.c, keymap.c, minibuf.c, msdos.c: | ||
| 239 | * nsfns.m, nsmenu.m, nsterm.m, print.c, w32fns.c, w32menu.c, xfaces.c: | ||
| 240 | * xfns.c, xmenu.c: Use contents slot, not buffer, where appropriate. | ||
| 241 | |||
| 242 | 2013-03-28 Eli Zaretskii <eliz@gnu.org> | ||
| 243 | |||
| 244 | * w32fns.c (w32_wnd_proc) [ENABLE_CHECKING]: Add code to help | ||
| 245 | identify the reasons for assertion violations in bug#14062 and | ||
| 246 | similar ones. | ||
| 247 | (Fx_show_tip): Fix compilation error under | ||
| 248 | "--enable-check-lisp-object-type". (Bug#14073) | ||
| 249 | |||
| 250 | * image.c (g_error_free) [WINDOWSNT]: Add DEF_IMGLIB_FN. | ||
| 251 | Reported by <rzl24ozi@gmail.com>. | ||
| 252 | |||
| 253 | 2013-03-28 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 254 | |||
| 255 | * xdisp.c (with_echo_area_buffer_unwind_data): Save window | ||
| 256 | start marker... | ||
| 257 | (unwind_with_echo_area_buffer): ...to restore it here. This | ||
| 258 | is needed to ensure that... | ||
| 259 | (redisplay_window): ...both window markers are valid here, | ||
| 260 | which is verified by eassert. | ||
| 261 | * editfns.c (save_excursion_save): Do not assume that | ||
| 262 | selected_window always displays the buffer. | ||
| 263 | * buffer.c (Fbuffer_swap_text): Adjust window start markers. | ||
| 264 | Fix comment. | ||
| 265 | |||
| 1 | 2013-03-27 Stefan Monnier <monnier@iro.umontreal.ca> | 266 | 2013-03-27 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 267 | ||
| 3 | * casetab.c (init_casetab_once): Don't abuse the ascii eqv table for | 268 | * casetab.c (init_casetab_once): Don't abuse the ascii eqv table for |
| @@ -298,7 +563,7 @@ | |||
| 298 | 563 | ||
| 299 | * coding.c (decode_coding_gap): Fix typo caught by static checking. | 564 | * coding.c (decode_coding_gap): Fix typo caught by static checking. |
| 300 | 565 | ||
| 301 | 2013-03-15 handa <handa@gnu.org> | 566 | 2013-03-15 Kenichi Handa <handa@gnu.org> |
| 302 | 567 | ||
| 303 | * insdel.c (insert_from_gap): New arg text_at_gap_tail. | 568 | * insdel.c (insert_from_gap): New arg text_at_gap_tail. |
| 304 | (adjust_after_replace): Make it back to static. Delete the third | 569 | (adjust_after_replace): Make it back to static. Delete the third |
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10 index 508a2a9dd4c..57c1cbf1299 100644 --- a/src/ChangeLog.10 +++ b/src/ChangeLog.10 | |||
| @@ -1865,7 +1865,7 @@ | |||
| 1865 | 1865 | ||
| 1866 | 2006-10-07 Ralf Angeli <angeli@caeruleus.net> | 1866 | 2006-10-07 Ralf Angeli <angeli@caeruleus.net> |
| 1867 | 1867 | ||
| 1868 | * w32fns.c (w32_createwindow): Honour left and top positions if | 1868 | * w32fns.c (w32_createwindow): Honor left and top positions if |
| 1869 | supplied explicitly. | 1869 | supplied explicitly. |
| 1870 | 1870 | ||
| 1871 | 2006-10-06 Kim F. Storm <storm@cua.dk> | 1871 | 2006-10-06 Kim F. Storm <storm@cua.dk> |
diff --git a/src/Makefile.in b/src/Makefile.in index 93d65867fa7..ac09d41858d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -327,7 +327,7 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ | |||
| 327 | $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ | 327 | $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ |
| 328 | $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) $(GIR_CFLAGS) \ | 328 | $(WEBKIT_CFLAGS) $(CLUTTER_CFLAGS) $(GIR_CFLAGS) \ |
| 329 | $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ | 329 | $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ |
| 330 | $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ | 330 | $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ |
| 331 | $(LIBGNUTLS_CFLAGS) \ | 331 | $(LIBGNUTLS_CFLAGS) \ |
| 332 | $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) | 332 | $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) |
| 333 | ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) | 333 | ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) |
| @@ -335,10 +335,10 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) | |||
| 335 | .SUFFIXES: .m | 335 | .SUFFIXES: .m |
| 336 | .c.o: | 336 | .c.o: |
| 337 | @$(MKDEPDIR) | 337 | @$(MKDEPDIR) |
| 338 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< | 338 | $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< |
| 339 | .m.o: | 339 | .m.o: |
| 340 | @$(MKDEPDIR) | 340 | @$(MKDEPDIR) |
| 341 | $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< | 341 | $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< |
| 342 | 342 | ||
| 343 | ## lastfile must follow all files whose initialized data areas should | 343 | ## lastfile must follow all files whose initialized data areas should |
| 344 | ## be dumped as pure by dump-emacs. | 344 | ## be dumped as pure by dump-emacs. |
diff --git a/src/alloc.c b/src/alloc.c index ea833c62b94..7a56c78e2ba 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -779,7 +779,7 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, | |||
| 779 | ptrdiff_t nitems_incr_max = n_max - n; | 779 | ptrdiff_t nitems_incr_max = n_max - n; |
| 780 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); | 780 | ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); |
| 781 | 781 | ||
| 782 | eassert (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1); | 782 | eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max); |
| 783 | if (! pa) | 783 | if (! pa) |
| 784 | *nitems = 0; | 784 | *nitems = 0; |
| 785 | if (nitems_incr_max < incr) | 785 | if (nitems_incr_max < incr) |
| @@ -5376,7 +5376,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5376 | double tot = total_bytes_of_live_objects (); | 5376 | double tot = total_bytes_of_live_objects (); |
| 5377 | 5377 | ||
| 5378 | tot *= XFLOAT_DATA (Vgc_cons_percentage); | 5378 | tot *= XFLOAT_DATA (Vgc_cons_percentage); |
| 5379 | if (tot > 0) | 5379 | if (0 < tot) |
| 5380 | { | 5380 | { |
| 5381 | if (tot < TYPE_MAXIMUM (EMACS_INT)) | 5381 | if (tot < TYPE_MAXIMUM (EMACS_INT)) |
| 5382 | gc_relative_threshold = tot; | 5382 | gc_relative_threshold = tot; |
| @@ -5810,14 +5810,13 @@ mark_object (Lisp_Object arg) | |||
| 5810 | case PVEC_WINDOW: | 5810 | case PVEC_WINDOW: |
| 5811 | { | 5811 | { |
| 5812 | struct window *w = (struct window *) ptr; | 5812 | struct window *w = (struct window *) ptr; |
| 5813 | bool leaf = NILP (w->hchild) && NILP (w->vchild); | ||
| 5814 | 5813 | ||
| 5815 | mark_vectorlike (ptr); | 5814 | mark_vectorlike (ptr); |
| 5816 | 5815 | ||
| 5817 | /* Mark glyphs for leaf windows. Marking window | 5816 | /* Mark glyph matrices, if any. Marking window |
| 5818 | matrices is sufficient because frame matrices | 5817 | matrices is sufficient because frame matrices |
| 5819 | use the same glyph memory. */ | 5818 | use the same glyph memory. */ |
| 5820 | if (leaf && w->current_matrix) | 5819 | if (w->current_matrix) |
| 5821 | { | 5820 | { |
| 5822 | mark_glyph_matrix (w->current_matrix); | 5821 | mark_glyph_matrix (w->current_matrix); |
| 5823 | mark_glyph_matrix (w->desired_matrix); | 5822 | mark_glyph_matrix (w->desired_matrix); |
diff --git a/src/buffer.c b/src/buffer.c index aa3fcf8c234..8728b418812 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1769,7 +1769,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1769 | since anything can happen within do_yes_or_no_p. */ | 1769 | since anything can happen within do_yes_or_no_p. */ |
| 1770 | 1770 | ||
| 1771 | /* Don't kill the minibuffer now current. */ | 1771 | /* Don't kill the minibuffer now current. */ |
| 1772 | if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) | 1772 | if (EQ (buffer, XWINDOW (minibuf_window)->contents)) |
| 1773 | return Qnil; | 1773 | return Qnil; |
| 1774 | 1774 | ||
| 1775 | /* When we kill an ordinary buffer which shares it's buffer text | 1775 | /* When we kill an ordinary buffer which shares it's buffer text |
| @@ -1820,7 +1820,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1820 | /* If the buffer now current is shown in the minibuffer and our buffer | 1820 | /* If the buffer now current is shown in the minibuffer and our buffer |
| 1821 | is the sole other buffer give up. */ | 1821 | is the sole other buffer give up. */ |
| 1822 | XSETBUFFER (tem, current_buffer); | 1822 | XSETBUFFER (tem, current_buffer); |
| 1823 | if (EQ (tem, XWINDOW (minibuf_window)->buffer) | 1823 | if (EQ (tem, XWINDOW (minibuf_window)->contents) |
| 1824 | && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) | 1824 | && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) |
| 1825 | return Qnil; | 1825 | return Qnil; |
| 1826 | 1826 | ||
| @@ -2394,8 +2394,9 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2394 | BUF_MARKERS(buf) should either be for `buf' or dead. */ | 2394 | BUF_MARKERS(buf) should either be for `buf' or dead. */ |
| 2395 | eassert (!m->buffer); | 2395 | eassert (!m->buffer); |
| 2396 | } | 2396 | } |
| 2397 | { /* Some of the C code expects that w->buffer == w->pointm->buffer. | 2397 | { /* Some of the C code expects that both window markers of a |
| 2398 | So since we just swapped the markers between the two buffers, we need | 2398 | live window points to that window's buffer. So since we |
| 2399 | just swapped the markers between the two buffers, we need | ||
| 2399 | to undo the effect of this swap for window markers. */ | 2400 | to undo the effect of this swap for window markers. */ |
| 2400 | Lisp_Object w = Fselected_window (), ws = Qnil; | 2401 | Lisp_Object w = Fselected_window (), ws = Qnil; |
| 2401 | Lisp_Object buf1, buf2; | 2402 | Lisp_Object buf1, buf2; |
| @@ -2405,12 +2406,19 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2405 | { | 2406 | { |
| 2406 | ws = Fcons (w, ws); | 2407 | ws = Fcons (w, ws); |
| 2407 | if (MARKERP (XWINDOW (w)->pointm) | 2408 | if (MARKERP (XWINDOW (w)->pointm) |
| 2408 | && (EQ (XWINDOW (w)->buffer, buf1) | 2409 | && (EQ (XWINDOW (w)->contents, buf1) |
| 2409 | || EQ (XWINDOW (w)->buffer, buf2))) | 2410 | || EQ (XWINDOW (w)->contents, buf2))) |
| 2410 | Fset_marker (XWINDOW (w)->pointm, | 2411 | Fset_marker (XWINDOW (w)->pointm, |
| 2411 | make_number | 2412 | make_number |
| 2412 | (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), | 2413 | (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), |
| 2413 | XWINDOW (w)->buffer); | 2414 | XWINDOW (w)->contents); |
| 2415 | if (MARKERP (XWINDOW (w)->start) | ||
| 2416 | && (EQ (XWINDOW (w)->contents, buf1) | ||
| 2417 | || EQ (XWINDOW (w)->contents, buf2))) | ||
| 2418 | Fset_marker (XWINDOW (w)->start, | ||
| 2419 | make_number | ||
| 2420 | (XBUFFER (XWINDOW (w)->contents)->last_window_start), | ||
| 2421 | XWINDOW (w)->contents); | ||
| 2414 | w = Fnext_window (w, Qt, Qt); | 2422 | w = Fnext_window (w, Qt, Qt); |
| 2415 | } | 2423 | } |
| 2416 | } | 2424 | } |
| @@ -3893,7 +3901,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) | |||
| 3893 | if (buffer_window_count (buf) > 0) | 3901 | if (buffer_window_count (buf) > 0) |
| 3894 | { | 3902 | { |
| 3895 | /* ... it's visible in other window than selected, */ | 3903 | /* ... it's visible in other window than selected, */ |
| 3896 | if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) | 3904 | if (buf != XBUFFER (XWINDOW (selected_window)->contents)) |
| 3897 | windows_or_buffers_changed = 1; | 3905 | windows_or_buffers_changed = 1; |
| 3898 | /* ... or if we modify an overlay at the end of the buffer | 3906 | /* ... or if we modify an overlay at the end of the buffer |
| 3899 | and so we cannot be sure that window end is still valid. */ | 3907 | and so we cannot be sure that window end is still valid. */ |
| @@ -1668,7 +1668,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1668 | } | 1668 | } |
| 1669 | map = XCDR (map); | 1669 | map = XCDR (map); |
| 1670 | if (! (VECTORP (map) | 1670 | if (! (VECTORP (map) |
| 1671 | && ASIZE (map) > 0 | 1671 | && 0 < ASIZE (map) |
| 1672 | && INTEGERP (AREF (map, 0)) | 1672 | && INTEGERP (AREF (map, 0)) |
| 1673 | && XINT (AREF (map, 0)) <= op | 1673 | && XINT (AREF (map, 0)) <= op |
| 1674 | && op - XINT (AREF (map, 0)) + 1 < ASIZE (map))) | 1674 | && op - XINT (AREF (map, 0)) + 1 < ASIZE (map))) |
| @@ -1867,7 +1867,7 @@ resolve_symbol_ccl_program (Lisp_Object ccl) | |||
| 1867 | return Qnil; | 1867 | return Qnil; |
| 1868 | } | 1868 | } |
| 1869 | 1869 | ||
| 1870 | if (! (XINT (AREF (result, CCL_HEADER_BUF_MAG)) >= 0 | 1870 | if (! (0 <= XINT (AREF (result, CCL_HEADER_BUF_MAG)) |
| 1871 | && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)), | 1871 | && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)), |
| 1872 | ASIZE (ccl)))) | 1872 | ASIZE (ccl)))) |
| 1873 | return Qnil; | 1873 | return Qnil; |
diff --git a/src/character.c b/src/character.c index 5a06c7f4d6c..b2caaa290af 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -833,8 +833,8 @@ string_escape_byte8 (Lisp_Object string) | |||
| 833 | 833 | ||
| 834 | if (multibyte) | 834 | if (multibyte) |
| 835 | { | 835 | { |
| 836 | if (byte8_count > (MOST_POSITIVE_FIXNUM - nchars) / 3 | 836 | if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count |
| 837 | || byte8_count > (STRING_BYTES_BOUND - nbytes) / 2) | 837 | || (STRING_BYTES_BOUND - nbytes) / 2 < byte8_count) |
| 838 | string_overflow (); | 838 | string_overflow (); |
| 839 | 839 | ||
| 840 | /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */ | 840 | /* Convert 2-byte sequence of byte8 chars to 4-byte octal. */ |
| @@ -843,7 +843,7 @@ string_escape_byte8 (Lisp_Object string) | |||
| 843 | } | 843 | } |
| 844 | else | 844 | else |
| 845 | { | 845 | { |
| 846 | if (byte8_count > (STRING_BYTES_BOUND - nbytes) / 3) | 846 | if ((STRING_BYTES_BOUND - nbytes) / 3 < byte8_count) |
| 847 | string_overflow (); | 847 | string_overflow (); |
| 848 | 848 | ||
| 849 | /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */ | 849 | /* Convert 1-byte sequence of byte8 chars to 4-byte octal. */ |
diff --git a/src/charset.c b/src/charset.c index 3d43d81877f..fdb8eebde8b 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -447,7 +447,7 @@ read_hex (FILE *fp, bool *eof, bool *overflow) | |||
| 447 | n = 0; | 447 | n = 0; |
| 448 | while (c_isxdigit (c = getc (fp))) | 448 | while (c_isxdigit (c = getc (fp))) |
| 449 | { | 449 | { |
| 450 | if (n > UINT_MAX >> 4) | 450 | if (UINT_MAX >> 4 < n) |
| 451 | *overflow = 1; | 451 | *overflow = 1; |
| 452 | n = ((n << 4) | 452 | n = ((n << 4) |
| 453 | | (c - ('0' <= c && c <= '9' ? '0' | 453 | | (c - ('0' <= c && c <= '9' ? '0' |
diff --git a/src/coding.c b/src/coding.c index cb81375a043..f9799035b3c 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -6072,17 +6072,18 @@ complement_process_encoding_system (Lisp_Object coding_system) | |||
| 6072 | #define EOL_SEEN_CRLF 4 | 6072 | #define EOL_SEEN_CRLF 4 |
| 6073 | 6073 | ||
| 6074 | 6074 | ||
| 6075 | static Lisp_Object adjust_coding_eol_type (struct coding_system *coding, int eol_seen); | 6075 | static Lisp_Object adjust_coding_eol_type (struct coding_system *coding, |
| 6076 | int eol_seen); | ||
| 6076 | 6077 | ||
| 6077 | 6078 | ||
| 6078 | /* Return true iff all the source bytes are ASCII. | 6079 | /* Return the number of ASCII characters at the head of the source. |
| 6079 | By side effects, set coding->head_ascii and coding->eol_seen. The | 6080 | By side effects, set coding->head_ascii and coding->eol_seen. The |
| 6080 | value of coding->eol_seen is "logical or" of EOL_SEEN_LF, | 6081 | value of coding->eol_seen is "logical or" of EOL_SEEN_LF, |
| 6081 | EOL_SEEN_CR, and EOL_SEEN_CRLF, but the value is reliable only when | 6082 | EOL_SEEN_CR, and EOL_SEEN_CRLF, but the value is reliable only when |
| 6082 | all the source bytes are ASCII. */ | 6083 | all the source bytes are ASCII. */ |
| 6083 | 6084 | ||
| 6084 | static bool | 6085 | static int |
| 6085 | detect_ascii (struct coding_system *coding) | 6086 | check_ascii (struct coding_system *coding) |
| 6086 | { | 6087 | { |
| 6087 | const unsigned char *src, *end; | 6088 | const unsigned char *src, *end; |
| 6088 | Lisp_Object eol_type = CODING_ID_EOL_TYPE (coding->id); | 6089 | Lisp_Object eol_type = CODING_ID_EOL_TYPE (coding->id); |
| @@ -6096,21 +6097,20 @@ detect_ascii (struct coding_system *coding) | |||
| 6096 | src = coding->source; | 6097 | src = coding->source; |
| 6097 | end = src + coding->src_bytes; | 6098 | end = src + coding->src_bytes; |
| 6098 | 6099 | ||
| 6099 | if (inhibit_eol_conversion) | 6100 | if (inhibit_eol_conversion |
| 6101 | || eol_seen != EOL_SEEN_NONE) | ||
| 6100 | { | 6102 | { |
| 6101 | /* We don't have to check EOL format. */ | 6103 | /* We don't have to check EOL format. */ |
| 6102 | while (src < end && !( *src & 0x80)) src++; | 6104 | while (src < end && !( *src & 0x80)) src++; |
| 6103 | eol_seen = EOL_SEEN_LF; | 6105 | if (inhibit_eol_conversion) |
| 6104 | adjust_coding_eol_type (coding, eol_seen); | 6106 | { |
| 6105 | } | 6107 | eol_seen = EOL_SEEN_LF; |
| 6106 | else if (eol_seen != EOL_SEEN_NONE) | 6108 | adjust_coding_eol_type (coding, eol_seen); |
| 6107 | { | 6109 | } |
| 6108 | /* We don't have to check EOL format either. */ | ||
| 6109 | while (src < end && !(*src & 0x80)) src++; | ||
| 6110 | } | 6110 | } |
| 6111 | else | 6111 | else |
| 6112 | { | 6112 | { |
| 6113 | end--; /* We look ahead one byte. */ | 6113 | end--; /* We look ahead one byte for "CR LF". */ |
| 6114 | while (src < end) | 6114 | while (src < end) |
| 6115 | { | 6115 | { |
| 6116 | int c = *src; | 6116 | int c = *src; |
| @@ -6118,6 +6118,69 @@ detect_ascii (struct coding_system *coding) | |||
| 6118 | if (c & 0x80) | 6118 | if (c & 0x80) |
| 6119 | break; | 6119 | break; |
| 6120 | src++; | 6120 | src++; |
| 6121 | if (c == '\r') | ||
| 6122 | { | ||
| 6123 | if (*src == '\n') | ||
| 6124 | { | ||
| 6125 | eol_seen |= EOL_SEEN_CRLF; | ||
| 6126 | src++; | ||
| 6127 | } | ||
| 6128 | else | ||
| 6129 | eol_seen |= EOL_SEEN_CR; | ||
| 6130 | } | ||
| 6131 | else if (c == '\n') | ||
| 6132 | eol_seen |= EOL_SEEN_LF; | ||
| 6133 | } | ||
| 6134 | if (src == end) | ||
| 6135 | { | ||
| 6136 | int c = *src; | ||
| 6137 | |||
| 6138 | /* All bytes but the last one C are ASCII. */ | ||
| 6139 | if (! (c & 0x80)) | ||
| 6140 | { | ||
| 6141 | if (c == '\r') | ||
| 6142 | eol_seen |= EOL_SEEN_CR; | ||
| 6143 | else if (c == '\n') | ||
| 6144 | eol_seen |= EOL_SEEN_LF; | ||
| 6145 | src++; | ||
| 6146 | } | ||
| 6147 | } | ||
| 6148 | } | ||
| 6149 | coding->head_ascii = src - coding->source; | ||
| 6150 | coding->eol_seen = eol_seen; | ||
| 6151 | return (coding->head_ascii); | ||
| 6152 | } | ||
| 6153 | |||
| 6154 | |||
| 6155 | /* Return the number of characters at the source if all the bytes are | ||
| 6156 | valid UTF-8 (of Unicode range). Otherwise, return -1. By side | ||
| 6157 | effects, update coding->eol_seen. The value of coding->eol_seen is | ||
| 6158 | "logical or" of EOL_SEEN_LF, EOL_SEEN_CR, and EOL_SEEN_CRLF, but | ||
| 6159 | the value is reliable only when all the source bytes are valid | ||
| 6160 | UTF-8. */ | ||
| 6161 | |||
| 6162 | static int | ||
| 6163 | check_utf_8 (struct coding_system *coding) | ||
| 6164 | { | ||
| 6165 | const unsigned char *src, *end; | ||
| 6166 | int eol_seen = coding->eol_seen; | ||
| 6167 | int nchars = coding->head_ascii; | ||
| 6168 | |||
| 6169 | if (coding->head_ascii < 0) | ||
| 6170 | check_ascii (coding); | ||
| 6171 | else | ||
| 6172 | coding_set_source (coding); | ||
| 6173 | src = coding->source + coding->head_ascii; | ||
| 6174 | /* We look ahead one byte for CR LF. */ | ||
| 6175 | end = coding->source + coding->src_bytes - 1; | ||
| 6176 | |||
| 6177 | while (src < end) | ||
| 6178 | { | ||
| 6179 | int c = *src; | ||
| 6180 | |||
| 6181 | if (UTF_8_1_OCTET_P (*src)) | ||
| 6182 | { | ||
| 6183 | src++; | ||
| 6121 | if (c < 0x20) | 6184 | if (c < 0x20) |
| 6122 | { | 6185 | { |
| 6123 | if (c == '\r') | 6186 | if (c == '\r') |
| @@ -6126,6 +6189,7 @@ detect_ascii (struct coding_system *coding) | |||
| 6126 | { | 6189 | { |
| 6127 | eol_seen |= EOL_SEEN_CRLF; | 6190 | eol_seen |= EOL_SEEN_CRLF; |
| 6128 | src++; | 6191 | src++; |
| 6192 | nchars++; | ||
| 6129 | } | 6193 | } |
| 6130 | else | 6194 | else |
| 6131 | eol_seen |= EOL_SEEN_CR; | 6195 | eol_seen |= EOL_SEEN_CR; |
| @@ -6134,27 +6198,58 @@ detect_ascii (struct coding_system *coding) | |||
| 6134 | eol_seen |= EOL_SEEN_LF; | 6198 | eol_seen |= EOL_SEEN_LF; |
| 6135 | } | 6199 | } |
| 6136 | } | 6200 | } |
| 6137 | if (src > end) | 6201 | else if (UTF_8_2_OCTET_LEADING_P (c)) |
| 6138 | /* The last two bytes are CR LF, which means that we have | ||
| 6139 | scanned all bytes. */ | ||
| 6140 | end++; | ||
| 6141 | else if (src == end) | ||
| 6142 | { | 6202 | { |
| 6143 | end++; | 6203 | if (c < 0xC2 /* overlong sequence */ |
| 6144 | if (! (*src & 0x80)) | 6204 | || src + 1 >= end |
| 6145 | { | 6205 | || ! UTF_8_EXTRA_OCTET_P (src[1])) |
| 6146 | if (*src == '\r') | 6206 | return -1; |
| 6147 | eol_seen |= EOL_SEEN_CR; | 6207 | src += 2; |
| 6148 | else if (*src == '\n') | ||
| 6149 | eol_seen |= EOL_SEEN_LF; | ||
| 6150 | src++; | ||
| 6151 | } | ||
| 6152 | } | 6208 | } |
| 6153 | adjust_coding_eol_type (coding, eol_seen); | 6209 | else if (UTF_8_3_OCTET_LEADING_P (c)) |
| 6210 | { | ||
| 6211 | if (src + 2 >= end | ||
| 6212 | || ! (UTF_8_EXTRA_OCTET_P (src[1]) | ||
| 6213 | && UTF_8_EXTRA_OCTET_P (src[2]))) | ||
| 6214 | return -1; | ||
| 6215 | c = (((c & 0xF) << 12) | ||
| 6216 | | ((src[1] & 0x3F) << 6) | (src[2] & 0x3F)); | ||
| 6217 | if (c < 0x800 /* overlong sequence */ | ||
| 6218 | || (c >= 0xd800 && c < 0xe000)) /* surrogates (invalid) */ | ||
| 6219 | return -1; | ||
| 6220 | src += 3; | ||
| 6221 | } | ||
| 6222 | else if (UTF_8_4_OCTET_LEADING_P (c)) | ||
| 6223 | { | ||
| 6224 | if (src + 3 >= end | ||
| 6225 | || ! (UTF_8_EXTRA_OCTET_P (src[1]) | ||
| 6226 | && UTF_8_EXTRA_OCTET_P (src[2]) | ||
| 6227 | && UTF_8_EXTRA_OCTET_P (src[3]))) | ||
| 6228 | return -1; | ||
| 6229 | c = (((c & 0x7) << 18) | ((src[1] & 0x3F) << 12) | ||
| 6230 | | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); | ||
| 6231 | if (c < 0x10000 /* overlong sequence */ | ||
| 6232 | || c >= 0x110000) /* non-Unicode character */ | ||
| 6233 | return -1; | ||
| 6234 | src += 4; | ||
| 6235 | } | ||
| 6236 | else | ||
| 6237 | return -1; | ||
| 6238 | nchars++; | ||
| 6239 | } | ||
| 6240 | |||
| 6241 | if (src == end) | ||
| 6242 | { | ||
| 6243 | if (! UTF_8_1_OCTET_P (*src)) | ||
| 6244 | return -1; | ||
| 6245 | nchars++; | ||
| 6246 | if (*src == '\r') | ||
| 6247 | eol_seen |= EOL_SEEN_CR; | ||
| 6248 | else if (*src == '\n') | ||
| 6249 | eol_seen |= EOL_SEEN_LF; | ||
| 6154 | } | 6250 | } |
| 6155 | coding->head_ascii = src - coding->source; | ||
| 6156 | coding->eol_seen = eol_seen; | 6251 | coding->eol_seen = eol_seen; |
| 6157 | return (src == end); | 6252 | return nchars; |
| 6158 | } | 6253 | } |
| 6159 | 6254 | ||
| 6160 | 6255 | ||
| @@ -6269,6 +6364,9 @@ adjust_coding_eol_type (struct coding_system *coding, int eol_seen) | |||
| 6269 | Lisp_Object eol_type; | 6364 | Lisp_Object eol_type; |
| 6270 | 6365 | ||
| 6271 | eol_type = CODING_ID_EOL_TYPE (coding->id); | 6366 | eol_type = CODING_ID_EOL_TYPE (coding->id); |
| 6367 | if (! VECTORP (eol_type)) | ||
| 6368 | /* Already adjusted. */ | ||
| 6369 | return eol_type; | ||
| 6272 | if (eol_seen & EOL_SEEN_LF) | 6370 | if (eol_seen & EOL_SEEN_LF) |
| 6273 | { | 6371 | { |
| 6274 | coding->id = CODING_SYSTEM_ID (AREF (eol_type, 0)); | 6372 | coding->id = CODING_SYSTEM_ID (AREF (eol_type, 0)); |
| @@ -6360,7 +6458,8 @@ detect_coding (struct coding_system *coding) | |||
| 6360 | { | 6458 | { |
| 6361 | coding->eol_seen |= EOL_SEEN_CRLF; | 6459 | coding->eol_seen |= EOL_SEEN_CRLF; |
| 6362 | src++; | 6460 | src++; |
| 6363 | coding->head_ascii++; | 6461 | if (! eight_bit_found) |
| 6462 | coding->head_ascii++; | ||
| 6364 | } | 6463 | } |
| 6365 | else | 6464 | else |
| 6366 | coding->eol_seen |= EOL_SEEN_CR; | 6465 | coding->eol_seen |= EOL_SEEN_CR; |
| @@ -6461,9 +6560,14 @@ detect_coding (struct coding_system *coding) | |||
| 6461 | coding_systems | 6560 | coding_systems |
| 6462 | = AREF (CODING_ID_ATTRS (coding->id), coding_attr_utf_bom); | 6561 | = AREF (CODING_ID_ATTRS (coding->id), coding_attr_utf_bom); |
| 6463 | detect_info.found = detect_info.rejected = 0; | 6562 | detect_info.found = detect_info.rejected = 0; |
| 6464 | if (detect_ascii (coding)) | 6563 | if (check_ascii (coding) == coding->src_bytes) |
| 6465 | { | 6564 | { |
| 6565 | int head_ascii = coding->head_ascii; | ||
| 6566 | |||
| 6567 | if (coding->eol_seen != EOL_SEEN_NONE) | ||
| 6568 | adjust_coding_eol_type (coding, coding->eol_seen); | ||
| 6466 | setup_coding_system (XCDR (coding_systems), coding); | 6569 | setup_coding_system (XCDR (coding_systems), coding); |
| 6570 | coding->head_ascii = head_ascii; | ||
| 6467 | } | 6571 | } |
| 6468 | else | 6572 | else |
| 6469 | { | 6573 | { |
| @@ -7620,15 +7724,27 @@ decode_coding_gap (struct coding_system *coding, | |||
| 7620 | if (CODING_REQUIRE_DETECTION (coding)) | 7724 | if (CODING_REQUIRE_DETECTION (coding)) |
| 7621 | detect_coding (coding); | 7725 | detect_coding (coding); |
| 7622 | attrs = CODING_ID_ATTRS (coding->id); | 7726 | attrs = CODING_ID_ATTRS (coding->id); |
| 7623 | if (! disable_ascii_optimization) | 7727 | if (! disable_ascii_optimization |
| 7624 | { | 7728 | && ! coding->src_multibyte |
| 7625 | if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs)) | 7729 | && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)) |
| 7626 | && NILP (CODING_ATTR_POST_READ (attrs)) | 7730 | && NILP (CODING_ATTR_POST_READ (attrs)) |
| 7627 | && NILP (get_translation_table (attrs, 0, NULL)) | 7731 | && NILP (get_translation_table (attrs, 0, NULL))) |
| 7628 | && (coding->head_ascii >= 0 /* We've already called detect_coding */ | 7732 | { |
| 7629 | ? coding->head_ascii == bytes | 7733 | chars = coding->head_ascii; |
| 7630 | : detect_ascii (coding))) | 7734 | if (chars < 0) |
| 7735 | chars = check_ascii (coding); | ||
| 7736 | if (chars != bytes) | ||
| 7737 | { | ||
| 7738 | if (EQ (CODING_ATTR_TYPE (attrs), Qutf_8)) | ||
| 7739 | chars = check_utf_8 (coding); | ||
| 7740 | else | ||
| 7741 | chars = -1; | ||
| 7742 | } | ||
| 7743 | if (chars >= 0) | ||
| 7631 | { | 7744 | { |
| 7745 | if (coding->eol_seen != EOL_SEEN_NONE) | ||
| 7746 | adjust_coding_eol_type (coding, coding->eol_seen); | ||
| 7747 | |||
| 7632 | if (coding->eol_seen == EOL_SEEN_CR) | 7748 | if (coding->eol_seen == EOL_SEEN_CR) |
| 7633 | { | 7749 | { |
| 7634 | unsigned char *src_end = GAP_END_ADDR; | 7750 | unsigned char *src_end = GAP_END_ADDR; |
| @@ -7645,6 +7761,7 @@ decode_coding_gap (struct coding_system *coding, | |||
| 7645 | unsigned char *src = GAP_END_ADDR; | 7761 | unsigned char *src = GAP_END_ADDR; |
| 7646 | unsigned char *src_beg = src - coding->src_bytes; | 7762 | unsigned char *src_beg = src - coding->src_bytes; |
| 7647 | unsigned char *dst = src; | 7763 | unsigned char *dst = src; |
| 7764 | ptrdiff_t diff; | ||
| 7648 | 7765 | ||
| 7649 | while (src_beg < src) | 7766 | while (src_beg < src) |
| 7650 | { | 7767 | { |
| @@ -7652,10 +7769,13 @@ decode_coding_gap (struct coding_system *coding, | |||
| 7652 | if (*src == '\n') | 7769 | if (*src == '\n') |
| 7653 | src--; | 7770 | src--; |
| 7654 | } | 7771 | } |
| 7655 | bytes -= dst - src; | 7772 | diff = dst - src; |
| 7773 | bytes -= diff; | ||
| 7774 | chars -= diff; | ||
| 7656 | } | 7775 | } |
| 7657 | coding->produced_char = coding->produced = bytes; | 7776 | coding->produced = bytes; |
| 7658 | insert_from_gap (bytes, bytes, 1); | 7777 | coding->produced_char = chars; |
| 7778 | insert_from_gap (chars, bytes, 1); | ||
| 7659 | return; | 7779 | return; |
| 7660 | } | 7780 | } |
| 7661 | } | 7781 | } |
| @@ -10877,7 +10997,7 @@ decode text as usual. */); | |||
| 10877 | DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, | 10997 | DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, |
| 10878 | doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. | 10998 | doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. |
| 10879 | Internal use only. Removed after the experimental optimizer gets stable. */); | 10999 | Internal use only. Removed after the experimental optimizer gets stable. */); |
| 10880 | disable_ascii_optimization = 1; | 11000 | disable_ascii_optimization = 0; |
| 10881 | 11001 | ||
| 10882 | DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input, | 11002 | DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input, |
| 10883 | doc: /* Char table for translating self-inserting characters. | 11003 | doc: /* Char table for translating self-inserting characters. |
diff --git a/src/data.c b/src/data.c index b20d1b4c8af..6622088b648 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2337,13 +2337,13 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max) | |||
| 2337 | uintmax_t val IF_LINT (= 0); | 2337 | uintmax_t val IF_LINT (= 0); |
| 2338 | if (INTEGERP (c)) | 2338 | if (INTEGERP (c)) |
| 2339 | { | 2339 | { |
| 2340 | valid = XINT (c) >= 0; | 2340 | valid = 0 <= XINT (c); |
| 2341 | val = XINT (c); | 2341 | val = XINT (c); |
| 2342 | } | 2342 | } |
| 2343 | else if (FLOATP (c)) | 2343 | else if (FLOATP (c)) |
| 2344 | { | 2344 | { |
| 2345 | double d = XFLOAT_DATA (c); | 2345 | double d = XFLOAT_DATA (c); |
| 2346 | if (d >= 0 | 2346 | if (0 <= d |
| 2347 | && d < (max == UINTMAX_MAX ? (double) UINTMAX_MAX + 1 : max + 1)) | 2347 | && d < (max == UINTMAX_MAX ? (double) UINTMAX_MAX + 1 : max + 1)) |
| 2348 | { | 2348 | { |
| 2349 | val = d; | 2349 | val = d; |
diff --git a/src/dired.c b/src/dired.c index ab48488966b..7bbfee7e5b0 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -517,8 +517,9 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 517 | 517 | ||
| 518 | QUIT; | 518 | QUIT; |
| 519 | if (len < SCHARS (encoded_file) | 519 | if (len < SCHARS (encoded_file) |
| 520 | || scmp (dp->d_name, SSDATA (encoded_file), | 520 | || (scmp (dp->d_name, SSDATA (encoded_file), |
| 521 | SCHARS (encoded_file)) >= 0) | 521 | SCHARS (encoded_file)) |
| 522 | >= 0)) | ||
| 522 | continue; | 523 | continue; |
| 523 | 524 | ||
| 524 | if (file_name_completion_stat (fd, dp, &st) < 0) | 525 | if (file_name_completion_stat (fd, dp, &st) < 0) |
diff --git a/src/dispextern.h b/src/dispextern.h index 9a03abf6766..0c35aff8285 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1422,25 +1422,24 @@ struct glyph_string | |||
| 1422 | 1422 | ||
| 1423 | /* Value is non-zero if window W wants a mode line. */ | 1423 | /* Value is non-zero if window W wants a mode line. */ |
| 1424 | 1424 | ||
| 1425 | #define WINDOW_WANTS_MODELINE_P(W) \ | 1425 | #define WINDOW_WANTS_MODELINE_P(W) \ |
| 1426 | (!MINI_WINDOW_P ((W)) \ | 1426 | (!MINI_WINDOW_P ((W)) \ |
| 1427 | && !(W)->pseudo_window_p \ | 1427 | && !(W)->pseudo_window_p \ |
| 1428 | && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ | 1428 | && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ |
| 1429 | && BUFFERP (W->buffer) \ | 1429 | && BUFFERP (W->contents) \ |
| 1430 | && !NILP (BVAR (XBUFFER (W->buffer), mode_line_format)) \ | 1430 | && !NILP (BVAR (XBUFFER (W->contents), mode_line_format)) \ |
| 1431 | && WINDOW_TOTAL_LINES (W) > 1) | 1431 | && WINDOW_TOTAL_LINES (W) > 1) |
| 1432 | 1432 | ||
| 1433 | /* Value is true if window W wants a header line. */ | 1433 | /* Value is true if window W wants a header line. */ |
| 1434 | 1434 | ||
| 1435 | #define WINDOW_WANTS_HEADER_LINE_P(W) \ | 1435 | #define WINDOW_WANTS_HEADER_LINE_P(W) \ |
| 1436 | (!MINI_WINDOW_P ((W)) \ | 1436 | (!MINI_WINDOW_P ((W)) \ |
| 1437 | && !(W)->pseudo_window_p \ | 1437 | && !(W)->pseudo_window_p \ |
| 1438 | && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ | 1438 | && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ |
| 1439 | && BUFFERP (W->buffer) \ | 1439 | && BUFFERP (W->contents) \ |
| 1440 | && !NILP (BVAR (XBUFFER (W->buffer), header_line_format)) \ | 1440 | && !NILP (BVAR (XBUFFER (W->contents), header_line_format)) \ |
| 1441 | && WINDOW_TOTAL_LINES (W) > 1 \ | 1441 | && WINDOW_TOTAL_LINES (W) > 1 \ |
| 1442 | + !NILP (BVAR (XBUFFER (W->buffer), mode_line_format))) | 1442 | + !NILP (BVAR (XBUFFER (W->contents), mode_line_format))) |
| 1443 | |||
| 1444 | 1443 | ||
| 1445 | /* Return proper value to be used as baseline offset of font that has | 1444 | /* Return proper value to be used as baseline offset of font that has |
| 1446 | ASCENT and DESCENT to draw characters by the font at the vertical | 1445 | ASCENT and DESCENT to draw characters by the font at the vertical |
diff --git a/src/dispnew.c b/src/dispnew.c index de1ca47ef60..ab73b6403ee 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -226,9 +226,9 @@ add_window_display_history (struct window *w, const char *msg, bool paused_p) | |||
| 226 | "%"pMu": window %p (`%s')%s\n%s", | 226 | "%"pMu": window %p (`%s')%s\n%s", |
| 227 | history_tick++, | 227 | history_tick++, |
| 228 | w, | 228 | w, |
| 229 | ((BUFFERP (w->buffer) | 229 | ((BUFFERP (w->contents) |
| 230 | && STRINGP (BVAR (XBUFFER (w->buffer), name))) | 230 | && STRINGP (BVAR (XBUFFER (w->contents), name))) |
| 231 | ? SSDATA (BVAR (XBUFFER (w->buffer), name)) | 231 | ? SSDATA (BVAR (XBUFFER (w->contents), name)) |
| 232 | : "???"), | 232 | : "???"), |
| 233 | paused_p ? " ***paused***" : "", | 233 | paused_p ? " ***paused***" : "", |
| 234 | msg); | 234 | msg); |
| @@ -844,16 +844,8 @@ clear_window_matrices (struct window *w, bool desired_p) | |||
| 844 | { | 844 | { |
| 845 | while (w) | 845 | while (w) |
| 846 | { | 846 | { |
| 847 | if (!NILP (w->hchild)) | 847 | if (WINDOWP (w->contents)) |
| 848 | { | 848 | clear_window_matrices (XWINDOW (w->contents), desired_p); |
| 849 | eassert (WINDOWP (w->hchild)); | ||
| 850 | clear_window_matrices (XWINDOW (w->hchild), desired_p); | ||
| 851 | } | ||
| 852 | else if (!NILP (w->vchild)) | ||
| 853 | { | ||
| 854 | eassert (WINDOWP (w->vchild)); | ||
| 855 | clear_window_matrices (XWINDOW (w->vchild), desired_p); | ||
| 856 | } | ||
| 857 | else | 849 | else |
| 858 | { | 850 | { |
| 859 | if (desired_p) | 851 | if (desired_p) |
| @@ -1474,7 +1466,7 @@ check_matrix_invariants (struct window *w) | |||
| 1474 | struct glyph_row *row = matrix->rows; | 1466 | struct glyph_row *row = matrix->rows; |
| 1475 | struct glyph_row *last_text_row = NULL; | 1467 | struct glyph_row *last_text_row = NULL; |
| 1476 | struct buffer *saved = current_buffer; | 1468 | struct buffer *saved = current_buffer; |
| 1477 | struct buffer *buffer = XBUFFER (w->buffer); | 1469 | struct buffer *buffer = XBUFFER (w->contents); |
| 1478 | int c; | 1470 | int c; |
| 1479 | 1471 | ||
| 1480 | /* This can sometimes happen for a fresh window. */ | 1472 | /* This can sometimes happen for a fresh window. */ |
| @@ -1638,7 +1630,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, | |||
| 1638 | vertically below other windows. */ | 1630 | vertically below other windows. */ |
| 1639 | in_horz_combination_p | 1631 | in_horz_combination_p |
| 1640 | = (!NILP (XWINDOW (window)->parent) | 1632 | = (!NILP (XWINDOW (window)->parent) |
| 1641 | && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild)); | 1633 | && WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (XWINDOW (window)->parent))); |
| 1642 | 1634 | ||
| 1643 | /* For WINDOW and all windows on the same level. */ | 1635 | /* For WINDOW and all windows on the same level. */ |
| 1644 | do | 1636 | do |
| @@ -1647,12 +1639,8 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, | |||
| 1647 | 1639 | ||
| 1648 | /* Get the dimension of the window sub-matrix for W, depending | 1640 | /* Get the dimension of the window sub-matrix for W, depending |
| 1649 | on whether this is a combination or a leaf window. */ | 1641 | on whether this is a combination or a leaf window. */ |
| 1650 | if (!NILP (w->hchild)) | 1642 | if (WINDOWP (w->contents)) |
| 1651 | dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y, | 1643 | dim = allocate_matrices_for_frame_redisplay (w->contents, x, y, |
| 1652 | dim_only_p, | ||
| 1653 | window_change_flags); | ||
| 1654 | else if (!NILP (w->vchild)) | ||
| 1655 | dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y, | ||
| 1656 | dim_only_p, | 1644 | dim_only_p, |
| 1657 | window_change_flags); | 1645 | window_change_flags); |
| 1658 | else | 1646 | else |
| @@ -1794,10 +1782,8 @@ allocate_matrices_for_window_redisplay (struct window *w) | |||
| 1794 | { | 1782 | { |
| 1795 | while (w) | 1783 | while (w) |
| 1796 | { | 1784 | { |
| 1797 | if (!NILP (w->vchild)) | 1785 | if (WINDOWP (w->contents)) |
| 1798 | allocate_matrices_for_window_redisplay (XWINDOW (w->vchild)); | 1786 | allocate_matrices_for_window_redisplay (XWINDOW (w->contents)); |
| 1799 | else if (!NILP (w->hchild)) | ||
| 1800 | allocate_matrices_for_window_redisplay (XWINDOW (w->hchild)); | ||
| 1801 | else | 1787 | else |
| 1802 | { | 1788 | { |
| 1803 | /* W is a leaf window. */ | 1789 | /* W is a leaf window. */ |
| @@ -1869,18 +1855,12 @@ showing_window_margins_p (struct window *w) | |||
| 1869 | { | 1855 | { |
| 1870 | while (w) | 1856 | while (w) |
| 1871 | { | 1857 | { |
| 1872 | if (!NILP (w->hchild)) | 1858 | if (WINDOWP (w->contents)) |
| 1873 | { | 1859 | { |
| 1874 | if (showing_window_margins_p (XWINDOW (w->hchild))) | 1860 | if (showing_window_margins_p (XWINDOW (w->contents))) |
| 1875 | return 1; | 1861 | return 1; |
| 1876 | } | 1862 | } |
| 1877 | else if (!NILP (w->vchild)) | 1863 | else if (!NILP (w->left_margin_cols) || !NILP (w->right_margin_cols)) |
| 1878 | { | ||
| 1879 | if (showing_window_margins_p (XWINDOW (w->vchild))) | ||
| 1880 | return 1; | ||
| 1881 | } | ||
| 1882 | else if (!NILP (w->left_margin_cols) | ||
| 1883 | || !NILP (w->right_margin_cols)) | ||
| 1884 | return 1; | 1864 | return 1; |
| 1885 | 1865 | ||
| 1886 | w = NILP (w->next) ? 0 : XWINDOW (w->next); | 1866 | w = NILP (w->next) ? 0 : XWINDOW (w->next); |
| @@ -1901,10 +1881,8 @@ fake_current_matrices (Lisp_Object window) | |||
| 1901 | { | 1881 | { |
| 1902 | w = XWINDOW (window); | 1882 | w = XWINDOW (window); |
| 1903 | 1883 | ||
| 1904 | if (!NILP (w->hchild)) | 1884 | if (WINDOWP (w->contents)) |
| 1905 | fake_current_matrices (w->hchild); | 1885 | fake_current_matrices (w->contents); |
| 1906 | else if (!NILP (w->vchild)) | ||
| 1907 | fake_current_matrices (w->vchild); | ||
| 1908 | else | 1886 | else |
| 1909 | { | 1887 | { |
| 1910 | int i; | 1888 | int i; |
| @@ -2244,10 +2222,8 @@ free_window_matrices (struct window *w) | |||
| 2244 | { | 2222 | { |
| 2245 | while (w) | 2223 | while (w) |
| 2246 | { | 2224 | { |
| 2247 | if (!NILP (w->hchild)) | 2225 | if (WINDOWP (w->contents)) |
| 2248 | free_window_matrices (XWINDOW (w->hchild)); | 2226 | free_window_matrices (XWINDOW (w->contents)); |
| 2249 | else if (!NILP (w->vchild)) | ||
| 2250 | free_window_matrices (XWINDOW (w->vchild)); | ||
| 2251 | else | 2227 | else |
| 2252 | { | 2228 | { |
| 2253 | /* This is a leaf window. Free its memory and reset fields | 2229 | /* This is a leaf window. Free its memory and reset fields |
| @@ -2380,10 +2356,8 @@ build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window | |||
| 2380 | { | 2356 | { |
| 2381 | while (w) | 2357 | while (w) |
| 2382 | { | 2358 | { |
| 2383 | if (!NILP (w->hchild)) | 2359 | if (WINDOWP (w->contents)) |
| 2384 | build_frame_matrix_from_window_tree (matrix, XWINDOW (w->hchild)); | 2360 | build_frame_matrix_from_window_tree (matrix, XWINDOW (w->contents)); |
| 2385 | else if (!NILP (w->vchild)) | ||
| 2386 | build_frame_matrix_from_window_tree (matrix, XWINDOW (w->vchild)); | ||
| 2387 | else | 2361 | else |
| 2388 | build_frame_matrix_from_leaf_window (matrix, w); | 2362 | build_frame_matrix_from_leaf_window (matrix, w); |
| 2389 | 2363 | ||
| @@ -2647,10 +2621,8 @@ mirror_make_current (struct window *w, int frame_row) | |||
| 2647 | { | 2621 | { |
| 2648 | while (w) | 2622 | while (w) |
| 2649 | { | 2623 | { |
| 2650 | if (!NILP (w->hchild)) | 2624 | if (WINDOWP (w->contents)) |
| 2651 | mirror_make_current (XWINDOW (w->hchild), frame_row); | 2625 | mirror_make_current (XWINDOW (w->contents), frame_row); |
| 2652 | else if (!NILP (w->vchild)) | ||
| 2653 | mirror_make_current (XWINDOW (w->vchild), frame_row); | ||
| 2654 | else | 2626 | else |
| 2655 | { | 2627 | { |
| 2656 | /* Row relative to window W. Don't use FRAME_TO_WINDOW_VPOS | 2628 | /* Row relative to window W. Don't use FRAME_TO_WINDOW_VPOS |
| @@ -2746,8 +2718,8 @@ sync_window_with_frame_matrix_rows (struct window *w) | |||
| 2746 | struct glyph_row *window_row, *window_row_end, *frame_row; | 2718 | struct glyph_row *window_row, *window_row_end, *frame_row; |
| 2747 | int left, right, x, width; | 2719 | int left, right, x, width; |
| 2748 | 2720 | ||
| 2749 | /* Preconditions: W must be a leaf window on a tty frame. */ | 2721 | /* Preconditions: W must be a live window on a tty frame. */ |
| 2750 | eassert (NILP (w->hchild) && NILP (w->vchild)); | 2722 | eassert (BUFFERP (w->contents)); |
| 2751 | eassert (!FRAME_WINDOW_P (f)); | 2723 | eassert (!FRAME_WINDOW_P (f)); |
| 2752 | 2724 | ||
| 2753 | left = margin_glyphs_to_reserve (w, 1, w->left_margin_cols); | 2725 | left = margin_glyphs_to_reserve (w, 1, w->left_margin_cols); |
| @@ -2783,10 +2755,8 @@ frame_row_to_window (struct window *w, int row) | |||
| 2783 | 2755 | ||
| 2784 | while (w && !found) | 2756 | while (w && !found) |
| 2785 | { | 2757 | { |
| 2786 | if (!NILP (w->hchild)) | 2758 | if (WINDOWP (w->contents)) |
| 2787 | found = frame_row_to_window (XWINDOW (w->hchild), row); | 2759 | found = frame_row_to_window (XWINDOW (w->contents), row); |
| 2788 | else if (!NILP (w->vchild)) | ||
| 2789 | found = frame_row_to_window (XWINDOW (w->vchild), row); | ||
| 2790 | else if (row >= WINDOW_TOP_EDGE_LINE (w) | 2760 | else if (row >= WINDOW_TOP_EDGE_LINE (w) |
| 2791 | && row < WINDOW_BOTTOM_EDGE_LINE (w)) | 2761 | && row < WINDOW_BOTTOM_EDGE_LINE (w)) |
| 2792 | found = w; | 2762 | found = w; |
| @@ -2814,11 +2784,8 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy | |||
| 2814 | { | 2784 | { |
| 2815 | while (w) | 2785 | while (w) |
| 2816 | { | 2786 | { |
| 2817 | if (!NILP (w->hchild)) | 2787 | if (WINDOWP (w->contents)) |
| 2818 | mirror_line_dance (XWINDOW (w->hchild), unchanged_at_top, | 2788 | mirror_line_dance (XWINDOW (w->contents), unchanged_at_top, |
| 2819 | nlines, copy_from, retained_p); | ||
| 2820 | else if (!NILP (w->vchild)) | ||
| 2821 | mirror_line_dance (XWINDOW (w->vchild), unchanged_at_top, | ||
| 2822 | nlines, copy_from, retained_p); | 2789 | nlines, copy_from, retained_p); |
| 2823 | else | 2790 | else |
| 2824 | { | 2791 | { |
| @@ -2927,10 +2894,8 @@ check_window_matrix_pointers (struct window *w) | |||
| 2927 | { | 2894 | { |
| 2928 | while (w) | 2895 | while (w) |
| 2929 | { | 2896 | { |
| 2930 | if (!NILP (w->hchild)) | 2897 | if (WINDOWP (w->contents)) |
| 2931 | check_window_matrix_pointers (XWINDOW (w->hchild)); | 2898 | check_window_matrix_pointers (XWINDOW (w->contents)); |
| 2932 | else if (!NILP (w->vchild)) | ||
| 2933 | check_window_matrix_pointers (XWINDOW (w->vchild)); | ||
| 2934 | else | 2899 | else |
| 2935 | { | 2900 | { |
| 2936 | struct frame *f = XFRAME (w->frame); | 2901 | struct frame *f = XFRAME (w->frame); |
| @@ -3196,10 +3161,8 @@ update_window_tree (struct window *w, bool force_p) | |||
| 3196 | 3161 | ||
| 3197 | while (w && !paused_p) | 3162 | while (w && !paused_p) |
| 3198 | { | 3163 | { |
| 3199 | if (!NILP (w->hchild)) | 3164 | if (WINDOWP (w->contents)) |
| 3200 | paused_p |= update_window_tree (XWINDOW (w->hchild), force_p); | 3165 | paused_p |= update_window_tree (XWINDOW (w->contents), force_p); |
| 3201 | else if (!NILP (w->vchild)) | ||
| 3202 | paused_p |= update_window_tree (XWINDOW (w->vchild), force_p); | ||
| 3203 | else if (w->must_be_updated_p) | 3166 | else if (w->must_be_updated_p) |
| 3204 | paused_p |= update_window (w, force_p); | 3167 | paused_p |= update_window (w, force_p); |
| 3205 | 3168 | ||
| @@ -3980,10 +3943,8 @@ set_window_update_flags (struct window *w, bool on_p) | |||
| 3980 | { | 3943 | { |
| 3981 | while (w) | 3944 | while (w) |
| 3982 | { | 3945 | { |
| 3983 | if (!NILP (w->hchild)) | 3946 | if (WINDOWP (w->contents)) |
| 3984 | set_window_update_flags (XWINDOW (w->hchild), on_p); | 3947 | set_window_update_flags (XWINDOW (w->contents), on_p); |
| 3985 | else if (!NILP (w->vchild)) | ||
| 3986 | set_window_update_flags (XWINDOW (w->vchild), on_p); | ||
| 3987 | else | 3948 | else |
| 3988 | w->must_be_updated_p = on_p; | 3949 | w->must_be_updated_p = on_p; |
| 3989 | 3950 | ||
| @@ -4556,7 +4517,7 @@ update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p) | |||
| 4556 | } | 4517 | } |
| 4557 | } | 4518 | } |
| 4558 | 4519 | ||
| 4559 | lint_assume (FRAME_LINES (f) >= 0); | 4520 | lint_assume (0 <= FRAME_LINES (f)); |
| 4560 | pause_p = 0 < i && i < FRAME_LINES (f) - 1; | 4521 | pause_p = 0 < i && i < FRAME_LINES (f) - 1; |
| 4561 | 4522 | ||
| 4562 | /* Now just clean up termcap drivers and set cursor, etc. */ | 4523 | /* Now just clean up termcap drivers and set cursor, etc. */ |
| @@ -5136,7 +5097,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5136 | 5097 | ||
| 5137 | /* We used to set current_buffer directly here, but that does the | 5098 | /* We used to set current_buffer directly here, but that does the |
| 5138 | wrong thing with `face-remapping-alist' (bug#2044). */ | 5099 | wrong thing with `face-remapping-alist' (bug#2044). */ |
| 5139 | Fset_buffer (w->buffer); | 5100 | Fset_buffer (w->contents); |
| 5140 | itdata = bidi_shelve_cache (); | 5101 | itdata = bidi_shelve_cache (); |
| 5141 | SET_TEXT_POS_FROM_MARKER (startp, w->start); | 5102 | SET_TEXT_POS_FROM_MARKER (startp, w->start); |
| 5142 | CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); | 5103 | CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); |
| @@ -5182,7 +5143,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5182 | *dx = x0 + it.first_visible_x - it.current_x; | 5143 | *dx = x0 + it.first_visible_x - it.current_x; |
| 5183 | *dy = *y - it.current_y; | 5144 | *dy = *y - it.current_y; |
| 5184 | 5145 | ||
| 5185 | string = w->buffer; | 5146 | string = w->contents; |
| 5186 | if (STRINGP (it.string)) | 5147 | if (STRINGP (it.string)) |
| 5187 | string = it.string; | 5148 | string = it.string; |
| 5188 | *pos = it.current; | 5149 | *pos = it.current; |
| @@ -5200,7 +5161,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5200 | if (STRINGP (it.string)) | 5161 | if (STRINGP (it.string)) |
| 5201 | BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos)); | 5162 | BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos)); |
| 5202 | else | 5163 | else |
| 5203 | BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (w->buffer), | 5164 | BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (w->contents), |
| 5204 | CHARPOS (pos->pos)); | 5165 | CHARPOS (pos->pos)); |
| 5205 | } | 5166 | } |
| 5206 | 5167 | ||
| @@ -5822,7 +5783,7 @@ sit_for (Lisp_Object timeout, bool reading, int display_option) | |||
| 5822 | else if (FLOATP (timeout)) | 5783 | else if (FLOATP (timeout)) |
| 5823 | { | 5784 | { |
| 5824 | double seconds = XFLOAT_DATA (timeout); | 5785 | double seconds = XFLOAT_DATA (timeout); |
| 5825 | if (seconds <= 0) | 5786 | if (! (0 < seconds)) |
| 5826 | return Qt; | 5787 | return Qt; |
| 5827 | else | 5788 | else |
| 5828 | { | 5789 | { |
| @@ -826,7 +826,7 @@ Otherwise, return a new string, without any text properties. */) | |||
| 826 | if (NILP (tem)) /* but not on any keys */ | 826 | if (NILP (tem)) /* but not on any keys */ |
| 827 | { | 827 | { |
| 828 | ptrdiff_t offset = bufp - buf; | 828 | ptrdiff_t offset = bufp - buf; |
| 829 | if (bsize > STRING_BYTES_BOUND - 4) | 829 | if (STRING_BYTES_BOUND - 4 < bsize) |
| 830 | string_overflow (); | 830 | string_overflow (); |
| 831 | buf = xrealloc (buf, bsize += 4); | 831 | buf = xrealloc (buf, bsize += 4); |
| 832 | bufp = buf + offset; | 832 | bufp = buf + offset; |
diff --git a/src/doprnt.c b/src/doprnt.c index 087256ced2a..471e35c7b43 100644 --- a/src/doprnt.c +++ b/src/doprnt.c | |||
| @@ -361,7 +361,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format, | |||
| 361 | 361 | ||
| 362 | /* Copy string into final output, truncating if no room. */ | 362 | /* Copy string into final output, truncating if no room. */ |
| 363 | doit: | 363 | doit: |
| 364 | eassert (tem >= 0); | 364 | eassert (0 <= tem); |
| 365 | /* Coming here means STRING contains ASCII only. */ | 365 | /* Coming here means STRING contains ASCII only. */ |
| 366 | if (STRING_BYTES_BOUND < tem) | 366 | if (STRING_BYTES_BOUND < tem) |
| 367 | error ("Format width or precision too large"); | 367 | error ("Format width or precision too large"); |
diff --git a/src/editfns.c b/src/editfns.c index 2d87b8e0064..e0b0347fe69 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -373,7 +373,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o | |||
| 373 | if (NILP (object)) | 373 | if (NILP (object)) |
| 374 | XSETBUFFER (object, current_buffer); | 374 | XSETBUFFER (object, current_buffer); |
| 375 | else if (WINDOWP (object)) | 375 | else if (WINDOWP (object)) |
| 376 | object = XWINDOW (object)->buffer; | 376 | object = XWINDOW (object)->contents; |
| 377 | 377 | ||
| 378 | if (!BUFFERP (object)) | 378 | if (!BUFFERP (object)) |
| 379 | /* pos-property only makes sense in buffers right now, since strings | 379 | /* pos-property only makes sense in buffers right now, since strings |
| @@ -846,7 +846,7 @@ save_excursion_save (void) | |||
| 846 | ? Fcopy_marker (BVAR (current_buffer, mark), Qnil) | 846 | ? Fcopy_marker (BVAR (current_buffer, mark), Qnil) |
| 847 | : Qnil), | 847 | : Qnil), |
| 848 | /* Selected window if current buffer is shown in it, nil otherwise. */ | 848 | /* Selected window if current buffer is shown in it, nil otherwise. */ |
| 849 | ((XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) | 849 | (EQ (XWINDOW (selected_window)->contents, Fcurrent_buffer ()) |
| 850 | ? selected_window : Qnil), | 850 | ? selected_window : Qnil), |
| 851 | BVAR (current_buffer, mark_active)); | 851 | BVAR (current_buffer, mark_active)); |
| 852 | } | 852 | } |
| @@ -915,7 +915,7 @@ save_excursion_restore (Lisp_Object info) | |||
| 915 | tem = XSAVE_OBJECT (info, 2); | 915 | tem = XSAVE_OBJECT (info, 2); |
| 916 | if (WINDOWP (tem) | 916 | if (WINDOWP (tem) |
| 917 | && !EQ (tem, selected_window) | 917 | && !EQ (tem, selected_window) |
| 918 | && (tem1 = XWINDOW (tem)->buffer, | 918 | && (tem1 = XWINDOW (tem)->contents, |
| 919 | (/* Window is live... */ | 919 | (/* Window is live... */ |
| 920 | BUFFERP (tem1) | 920 | BUFFERP (tem1) |
| 921 | /* ...and it shows the current buffer. */ | 921 | /* ...and it shows the current buffer. */ |
| @@ -1398,8 +1398,8 @@ hi_time (time_t t) | |||
| 1398 | no runtime check is needed, and taking care not to convert | 1398 | no runtime check is needed, and taking care not to convert |
| 1399 | negative numbers to unsigned before comparing them. */ | 1399 | negative numbers to unsigned before comparing them. */ |
| 1400 | if (! ((! TYPE_SIGNED (time_t) | 1400 | if (! ((! TYPE_SIGNED (time_t) |
| 1401 | || TIME_T_MIN >> 16 >= MOST_NEGATIVE_FIXNUM | 1401 | || MOST_NEGATIVE_FIXNUM <= TIME_T_MIN >> 16 |
| 1402 | || hi >= MOST_NEGATIVE_FIXNUM) | 1402 | || MOST_NEGATIVE_FIXNUM <= hi) |
| 1403 | && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM | 1403 | && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM |
| 1404 | || hi <= MOST_POSITIVE_FIXNUM))) | 1404 | || hi <= MOST_POSITIVE_FIXNUM))) |
| 1405 | time_overflow (); | 1405 | time_overflow (); |
| @@ -1561,7 +1561,7 @@ decode_time_components (Lisp_Object high, Lisp_Object low, Lisp_Object usec, | |||
| 1561 | 1561 | ||
| 1562 | if (result) | 1562 | if (result) |
| 1563 | { | 1563 | { |
| 1564 | if (hi >= (TYPE_SIGNED (time_t) ? TIME_T_MIN >> 16 : 0) | 1564 | if ((TYPE_SIGNED (time_t) ? TIME_T_MIN >> 16 <= hi : 0 <= hi) |
| 1565 | && hi <= TIME_T_MAX >> 16) | 1565 | && hi <= TIME_T_MAX >> 16) |
| 1566 | { | 1566 | { |
| 1567 | /* Return the greatest representable time that is not greater | 1567 | /* Return the greatest representable time that is not greater |
diff --git a/src/fileio.c b/src/fileio.c index 1919768d98a..1049522e5a9 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -81,6 +81,25 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 81 | #define DRIVE_LETTER(x) c_tolower (x) | 81 | #define DRIVE_LETTER(x) c_tolower (x) |
| 82 | #endif | 82 | #endif |
| 83 | 83 | ||
| 84 | #ifdef HAVE_POSIX_ACL | ||
| 85 | /* FIXME: this macro was copied from gnulib's private acl-internal.h | ||
| 86 | header file. */ | ||
| 87 | /* Recognize some common errors such as from an NFS mount that does | ||
| 88 | not support ACLs, even when local drives do. */ | ||
| 89 | #if defined __APPLE__ && defined __MACH__ /* Mac OS X */ | ||
| 90 | #define ACL_NOT_WELL_SUPPORTED(Err) \ | ||
| 91 | ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == ENOENT) | ||
| 92 | #elif defined EOPNOTSUPP /* Tru64 NFS */ | ||
| 93 | #define ACL_NOT_WELL_SUPPORTED(Err) \ | ||
| 94 | ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == EOPNOTSUPP) | ||
| 95 | #elif defined WINDOWSNT | ||
| 96 | #define ACL_NOT_WELL_SUPPORTED(Err) ((Err) == ENOTSUP) | ||
| 97 | #else | ||
| 98 | #define ACL_NOT_WELL_SUPPORTED(Err) \ | ||
| 99 | ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY) | ||
| 100 | #endif | ||
| 101 | #endif /* HAVE_POSIX_ACL */ | ||
| 102 | |||
| 84 | #include "systime.h" | 103 | #include "systime.h" |
| 85 | #include <allocator.h> | 104 | #include <allocator.h> |
| 86 | #include <careadlinkat.h> | 105 | #include <careadlinkat.h> |
| @@ -2011,7 +2030,7 @@ entries (depending on how Emacs was built). */) | |||
| 2011 | { | 2030 | { |
| 2012 | #ifdef HAVE_POSIX_ACL | 2031 | #ifdef HAVE_POSIX_ACL |
| 2013 | acl = acl_get_file (SDATA (encoded_file), ACL_TYPE_ACCESS); | 2032 | acl = acl_get_file (SDATA (encoded_file), ACL_TYPE_ACCESS); |
| 2014 | if (acl == NULL && errno != ENOTSUP) | 2033 | if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2015 | report_file_error ("Getting ACL", Fcons (file, Qnil)); | 2034 | report_file_error ("Getting ACL", Fcons (file, Qnil)); |
| 2016 | #endif | 2035 | #endif |
| 2017 | } | 2036 | } |
| @@ -2055,7 +2074,7 @@ entries (depending on how Emacs was built). */) | |||
| 2055 | { | 2074 | { |
| 2056 | bool fail = | 2075 | bool fail = |
| 2057 | acl_set_file (SDATA (encoded_newname), ACL_TYPE_ACCESS, acl) != 0; | 2076 | acl_set_file (SDATA (encoded_newname), ACL_TYPE_ACCESS, acl) != 0; |
| 2058 | if (fail && errno != ENOTSUP) | 2077 | if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2059 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); | 2078 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); |
| 2060 | 2079 | ||
| 2061 | acl_free (acl); | 2080 | acl_free (acl); |
| @@ -2087,7 +2106,7 @@ entries (depending on how Emacs was built). */) | |||
| 2087 | 2106 | ||
| 2088 | #ifdef HAVE_POSIX_ACL | 2107 | #ifdef HAVE_POSIX_ACL |
| 2089 | acl = acl_get_fd (ifd); | 2108 | acl = acl_get_fd (ifd); |
| 2090 | if (acl == NULL && errno != ENOTSUP) | 2109 | if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2091 | report_file_error ("Getting ACL", Fcons (file, Qnil)); | 2110 | report_file_error ("Getting ACL", Fcons (file, Qnil)); |
| 2092 | #endif | 2111 | #endif |
| 2093 | } | 2112 | } |
| @@ -2176,7 +2195,7 @@ entries (depending on how Emacs was built). */) | |||
| 2176 | if (acl != NULL) | 2195 | if (acl != NULL) |
| 2177 | { | 2196 | { |
| 2178 | bool fail = acl_set_fd (ofd, acl) != 0; | 2197 | bool fail = acl_set_fd (ofd, acl) != 0; |
| 2179 | if (fail && errno != ENOTSUP) | 2198 | if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 2180 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); | 2199 | report_file_error ("Setting ACL", Fcons (newname, Qnil)); |
| 2181 | 2200 | ||
| 2182 | acl_free (acl); | 2201 | acl_free (acl); |
| @@ -3174,7 +3193,7 @@ support. */) | |||
| 3174 | fail = (acl_set_file (SSDATA (encoded_absname), ACL_TYPE_ACCESS, | 3193 | fail = (acl_set_file (SSDATA (encoded_absname), ACL_TYPE_ACCESS, |
| 3175 | acl) | 3194 | acl) |
| 3176 | != 0); | 3195 | != 0); |
| 3177 | if (fail && errno != ENOTSUP) | 3196 | if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) |
| 3178 | report_file_error ("Setting ACL", Fcons (absname, Qnil)); | 3197 | report_file_error ("Setting ACL", Fcons (absname, Qnil)); |
| 3179 | 3198 | ||
| 3180 | acl_free (acl); | 3199 | acl_free (acl); |
| @@ -3449,7 +3468,7 @@ file_offset (Lisp_Object val) | |||
| 3449 | if (FLOATP (val)) | 3468 | if (FLOATP (val)) |
| 3450 | { | 3469 | { |
| 3451 | double v = XFLOAT_DATA (val); | 3470 | double v = XFLOAT_DATA (val); |
| 3452 | if (v >= 0 | 3471 | if (0 <= v |
| 3453 | && (sizeof (off_t) < sizeof v | 3472 | && (sizeof (off_t) < sizeof v |
| 3454 | ? v <= TYPE_MAXIMUM (off_t) | 3473 | ? v <= TYPE_MAXIMUM (off_t) |
| 3455 | : v < TYPE_MAXIMUM (off_t))) | 3474 | : v < TYPE_MAXIMUM (off_t))) |
| @@ -3958,7 +3977,7 @@ by calling `format-decode', which see. */) | |||
| 3958 | 3977 | ||
| 3959 | /* If display currently starts at beginning of line, | 3978 | /* If display currently starts at beginning of line, |
| 3960 | keep it that way. */ | 3979 | keep it that way. */ |
| 3961 | if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) | 3980 | if (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer) |
| 3962 | XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); | 3981 | XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); |
| 3963 | 3982 | ||
| 3964 | replace_handled = 1; | 3983 | replace_handled = 1; |
| @@ -4108,7 +4127,7 @@ by calling `format-decode', which see. */) | |||
| 4108 | 4127 | ||
| 4109 | /* If display currently starts at beginning of line, | 4128 | /* If display currently starts at beginning of line, |
| 4110 | keep it that way. */ | 4129 | keep it that way. */ |
| 4111 | if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) | 4130 | if (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer) |
| 4112 | XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); | 4131 | XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); |
| 4113 | 4132 | ||
| 4114 | /* Replace the chars that we need to replace, | 4133 | /* Replace the chars that we need to replace, |
| @@ -5816,7 +5835,7 @@ before any other event (mouse or keypress) is handled. */) | |||
| 5816 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | 5835 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
| 5817 | && use_dialog_box | 5836 | && use_dialog_box |
| 5818 | && use_file_dialog | 5837 | && use_file_dialog |
| 5819 | && have_menus_p ()) | 5838 | && window_system_available (SELECTED_FRAME ())) |
| 5820 | return Qt; | 5839 | return Qt; |
| 5821 | #endif | 5840 | #endif |
| 5822 | return Qnil; | 5841 | return Qnil; |
| @@ -2443,10 +2443,9 @@ is nil, and `use-dialog-box' is non-nil. */) | |||
| 2443 | CHECK_STRING (prompt); | 2443 | CHECK_STRING (prompt); |
| 2444 | 2444 | ||
| 2445 | #ifdef HAVE_MENUS | 2445 | #ifdef HAVE_MENUS |
| 2446 | if (FRAME_WINDOW_P (SELECTED_FRAME ()) | 2446 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
| 2447 | && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | ||
| 2448 | && use_dialog_box | 2447 | && use_dialog_box |
| 2449 | && have_menus_p ()) | 2448 | && window_system_available (SELECTED_FRAME ())) |
| 2450 | { | 2449 | { |
| 2451 | Lisp_Object pane, menu, obj; | 2450 | Lisp_Object pane, menu, obj; |
| 2452 | redisplay_preserve_echo_area (4); | 2451 | redisplay_preserve_echo_area (4); |
| @@ -3409,7 +3408,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | |||
| 3409 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max | 3408 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max |
| 3410 | ? nitems_max : C_language_max); | 3409 | ? nitems_max : C_language_max); |
| 3411 | eassert (VECTORP (vec)); | 3410 | eassert (VECTORP (vec)); |
| 3412 | eassert (incr_min > 0 && nitems_max >= -1); | 3411 | eassert (0 < incr_min && -1 <= nitems_max); |
| 3413 | old_size = ASIZE (vec); | 3412 | old_size = ASIZE (vec); |
| 3414 | incr_max = n_max - old_size; | 3413 | incr_max = n_max - old_size; |
| 3415 | incr = max (incr_min, min (old_size >> 1, incr_max)); | 3414 | incr = max (incr_min, min (old_size >> 1, incr_max)); |
| @@ -3574,9 +3573,9 @@ make_hash_table (struct hash_table_test test, | |||
| 3574 | eassert (SYMBOLP (test.name)); | 3573 | eassert (SYMBOLP (test.name)); |
| 3575 | eassert (INTEGERP (size) && XINT (size) >= 0); | 3574 | eassert (INTEGERP (size) && XINT (size) >= 0); |
| 3576 | eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) | 3575 | eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) |
| 3577 | || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1)); | 3576 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size))); |
| 3578 | eassert (FLOATP (rehash_threshold) | 3577 | eassert (FLOATP (rehash_threshold) |
| 3579 | && XFLOAT_DATA (rehash_threshold) > 0 | 3578 | && 0 < XFLOAT_DATA (rehash_threshold) |
| 3580 | && XFLOAT_DATA (rehash_threshold) <= 1.0); | 3579 | && XFLOAT_DATA (rehash_threshold) <= 1.0); |
| 3581 | 3580 | ||
| 3582 | if (XFASTINT (size) == 0) | 3581 | if (XFASTINT (size) == 0) |
| @@ -4312,15 +4311,15 @@ usage: (make-hash-table &rest KEYWORD-ARGS) */) | |||
| 4312 | /* Look for `:rehash-size SIZE'. */ | 4311 | /* Look for `:rehash-size SIZE'. */ |
| 4313 | i = get_key_arg (QCrehash_size, nargs, args, used); | 4312 | i = get_key_arg (QCrehash_size, nargs, args, used); |
| 4314 | rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); | 4313 | rehash_size = i ? args[i] : make_float (DEFAULT_REHASH_SIZE); |
| 4315 | if (! ((INTEGERP (rehash_size) && XINT (rehash_size) > 0) | 4314 | if (! ((INTEGERP (rehash_size) && 0 < XINT (rehash_size)) |
| 4316 | || (FLOATP (rehash_size) && XFLOAT_DATA (rehash_size) > 1))) | 4315 | || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)))) |
| 4317 | signal_error ("Invalid hash table rehash size", rehash_size); | 4316 | signal_error ("Invalid hash table rehash size", rehash_size); |
| 4318 | 4317 | ||
| 4319 | /* Look for `:rehash-threshold THRESHOLD'. */ | 4318 | /* Look for `:rehash-threshold THRESHOLD'. */ |
| 4320 | i = get_key_arg (QCrehash_threshold, nargs, args, used); | 4319 | i = get_key_arg (QCrehash_threshold, nargs, args, used); |
| 4321 | rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD); | 4320 | rehash_threshold = i ? args[i] : make_float (DEFAULT_REHASH_THRESHOLD); |
| 4322 | if (! (FLOATP (rehash_threshold) | 4321 | if (! (FLOATP (rehash_threshold) |
| 4323 | && XFLOAT_DATA (rehash_threshold) > 0 | 4322 | && 0 < XFLOAT_DATA (rehash_threshold) |
| 4324 | && XFLOAT_DATA (rehash_threshold) <= 1)) | 4323 | && XFLOAT_DATA (rehash_threshold) <= 1)) |
| 4325 | signal_error ("Invalid hash table rehash threshold", rehash_threshold); | 4324 | signal_error ("Invalid hash table rehash threshold", rehash_threshold); |
| 4326 | 4325 | ||
diff --git a/src/font.c b/src/font.c index 357f8483b14..6247eeca948 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -229,7 +229,7 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) | |||
| 229 | 229 | ||
| 230 | if (len == 1 && *str == '*') | 230 | if (len == 1 && *str == '*') |
| 231 | return Qnil; | 231 | return Qnil; |
| 232 | if (!force_symbol && len > 0 && '0' <= *str && *str <= '9') | 232 | if (!force_symbol && 0 < len && '0' <= *str && *str <= '9') |
| 233 | { | 233 | { |
| 234 | for (i = 1; i < len; i++) | 234 | for (i = 1; i < len; i++) |
| 235 | if (! ('0' <= str[i] && str[i] <= '9')) | 235 | if (! ('0' <= str[i] && str[i] <= '9')) |
| @@ -243,7 +243,7 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) | |||
| 243 | { | 243 | { |
| 244 | if (i == len) | 244 | if (i == len) |
| 245 | return make_number (n); | 245 | return make_number (n); |
| 246 | if (n > MOST_POSITIVE_FIXNUM / 10) | 246 | if (MOST_POSITIVE_FIXNUM / 10 < n) |
| 247 | break; | 247 | break; |
| 248 | } | 248 | } |
| 249 | 249 | ||
| @@ -4761,7 +4761,7 @@ character at index specified by POSITION. */) | |||
| 4761 | 4761 | ||
| 4762 | if (NILP (string)) | 4762 | if (NILP (string)) |
| 4763 | { | 4763 | { |
| 4764 | if (XBUFFER (w->buffer) != current_buffer) | 4764 | if (XBUFFER (w->contents) != current_buffer) |
| 4765 | error ("Specified window is not displaying the current buffer."); | 4765 | error ("Specified window is not displaying the current buffer."); |
| 4766 | CHECK_NUMBER_COERCE_MARKER (position); | 4766 | CHECK_NUMBER_COERCE_MARKER (position); |
| 4767 | if (! (BEGV <= XINT (position) && XINT (position) < ZV)) | 4767 | if (! (BEGV <= XINT (position) && XINT (position) < ZV)) |
| @@ -4844,11 +4844,9 @@ If the named font is not yet loaded, return nil. */) | |||
| 4844 | Lisp_Object info; | 4844 | Lisp_Object info; |
| 4845 | Lisp_Object font_object; | 4845 | Lisp_Object font_object; |
| 4846 | 4846 | ||
| 4847 | (*check_window_system_func) (); | ||
| 4848 | |||
| 4849 | if (! FONTP (name)) | 4847 | if (! FONTP (name)) |
| 4850 | CHECK_STRING (name); | 4848 | CHECK_STRING (name); |
| 4851 | f = decode_live_frame (frame); | 4849 | f = decode_window_system_frame (frame); |
| 4852 | 4850 | ||
| 4853 | if (STRINGP (name)) | 4851 | if (STRINGP (name)) |
| 4854 | { | 4852 | { |
diff --git a/src/fontset.c b/src/fontset.c index 3578bc9403d..2f6313c4214 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -179,10 +179,6 @@ static int next_fontset_id; | |||
| 179 | font for each character. */ | 179 | font for each character. */ |
| 180 | static Lisp_Object Vdefault_fontset; | 180 | static Lisp_Object Vdefault_fontset; |
| 181 | 181 | ||
| 182 | /* Check if any window system is used now. */ | ||
| 183 | void (*check_window_system_func) (void); | ||
| 184 | |||
| 185 | |||
| 186 | /* Prototype declarations for static functions. */ | 182 | /* Prototype declarations for static functions. */ |
| 187 | static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); | 183 | static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); |
| 188 | 184 | ||
| @@ -1213,7 +1209,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */) | |||
| 1213 | Lisp_Object fontset; | 1209 | Lisp_Object fontset; |
| 1214 | int id; | 1210 | int id; |
| 1215 | 1211 | ||
| 1216 | (*check_window_system_func) (); | 1212 | check_window_system (NULL); |
| 1217 | 1213 | ||
| 1218 | CHECK_STRING (pattern); | 1214 | CHECK_STRING (pattern); |
| 1219 | 1215 | ||
| @@ -1919,8 +1915,7 @@ format is the same as above. */) | |||
| 1919 | Lisp_Object val, elt; | 1915 | Lisp_Object val, elt; |
| 1920 | int c, i, j, k; | 1916 | int c, i, j, k; |
| 1921 | 1917 | ||
| 1922 | (*check_window_system_func) (); | 1918 | check_window_system (NULL); |
| 1923 | |||
| 1924 | fontset = check_fontset_name (fontset, &frame); | 1919 | fontset = check_fontset_name (fontset, &frame); |
| 1925 | 1920 | ||
| 1926 | /* Recode fontsets realized on FRAME from the base fontset FONTSET | 1921 | /* Recode fontsets realized on FRAME from the base fontset FONTSET |
diff --git a/src/fontset.h b/src/fontset.h index 07ee5d65c25..926520c8001 100644 --- a/src/fontset.h +++ b/src/fontset.h | |||
| @@ -26,9 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #ifndef EMACS_FONTSET_H | 26 | #ifndef EMACS_FONTSET_H |
| 27 | #define EMACS_FONTSET_H | 27 | #define EMACS_FONTSET_H |
| 28 | 28 | ||
| 29 | /* Check if any window system is used now. */ | ||
| 30 | extern void (*check_window_system_func) (void); | ||
| 31 | |||
| 32 | struct face; | 29 | struct face; |
| 33 | 30 | ||
| 34 | extern void free_face_fontset (FRAME_PTR, struct face *); | 31 | extern void free_face_fontset (FRAME_PTR, struct face *); |
diff --git a/src/frame.c b/src/frame.c index cea39144cef..2fe398296ed 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -149,6 +149,37 @@ decode_any_frame (register Lisp_Object frame) | |||
| 149 | return XFRAME (frame); | 149 | return XFRAME (frame); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | bool | ||
| 153 | window_system_available (struct frame *f) | ||
| 154 | { | ||
| 155 | if (f) | ||
| 156 | return FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f); | ||
| 157 | else | ||
| 158 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 159 | return x_display_list != NULL; | ||
| 160 | #else | ||
| 161 | return 0; | ||
| 162 | #endif | ||
| 163 | } | ||
| 164 | |||
| 165 | struct frame * | ||
| 166 | decode_window_system_frame (Lisp_Object frame) | ||
| 167 | { | ||
| 168 | struct frame *f = decode_live_frame (frame); | ||
| 169 | |||
| 170 | if (!window_system_available (f)) | ||
| 171 | error ("Window system frame should be used"); | ||
| 172 | return f; | ||
| 173 | } | ||
| 174 | |||
| 175 | void | ||
| 176 | check_window_system (struct frame *f) | ||
| 177 | { | ||
| 178 | if (!window_system_available (f)) | ||
| 179 | error (f ? "Window system frame should be used" | ||
| 180 | : "Window system is not in use or not initialized"); | ||
| 181 | } | ||
| 182 | |||
| 152 | static void | 183 | static void |
| 153 | set_menu_bar_lines_1 (Lisp_Object window, int n) | 184 | set_menu_bar_lines_1 (Lisp_Object window, int n) |
| 154 | { | 185 | { |
| @@ -159,15 +190,15 @@ set_menu_bar_lines_1 (Lisp_Object window, int n) | |||
| 159 | w->total_lines -= n; | 190 | w->total_lines -= n; |
| 160 | 191 | ||
| 161 | /* Handle just the top child in a vertical split. */ | 192 | /* Handle just the top child in a vertical split. */ |
| 162 | if (!NILP (w->vchild)) | 193 | if (WINDOW_VERTICAL_COMBINATION_P (w)) |
| 163 | set_menu_bar_lines_1 (w->vchild, n); | 194 | set_menu_bar_lines_1 (w->contents, n); |
| 164 | 195 | else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) | |
| 165 | /* Adjust all children in a horizontal split. */ | 196 | /* Adjust all children in a horizontal split. */ |
| 166 | for (window = w->hchild; !NILP (window); window = w->next) | 197 | for (window = w->contents; !NILP (window); window = w->next) |
| 167 | { | 198 | { |
| 168 | w = XWINDOW (window); | 199 | w = XWINDOW (window); |
| 169 | set_menu_bar_lines_1 (window, n); | 200 | set_menu_bar_lines_1 (window, n); |
| 170 | } | 201 | } |
| 171 | } | 202 | } |
| 172 | 203 | ||
| 173 | void | 204 | void |
| @@ -421,7 +452,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis | |||
| 421 | 452 | ||
| 422 | /* Make the chosen minibuffer window display the proper minibuffer, | 453 | /* Make the chosen minibuffer window display the proper minibuffer, |
| 423 | unless it is already showing a minibuffer. */ | 454 | unless it is already showing a minibuffer. */ |
| 424 | if (NILP (Fmemq (XWINDOW (mini_window)->buffer, Vminibuffer_list))) | 455 | if (NILP (Fmemq (XWINDOW (mini_window)->contents, Vminibuffer_list))) |
| 425 | /* Use set_window_buffer instead of Fset_window_buffer (see | 456 | /* Use set_window_buffer instead of Fset_window_buffer (see |
| 426 | discussion of bug#11984, bug#12025, bug#12026). */ | 457 | discussion of bug#11984, bug#12025, bug#12026). */ |
| 427 | set_window_buffer (mini_window, | 458 | set_window_buffer (mini_window, |
| @@ -889,7 +920,7 @@ DEFUN ("frame-list", Fframe_list, Sframe_list, | |||
| 889 | /* Return CANDIDATE if it can be used as 'other-than-FRAME' frame on the | 920 | /* Return CANDIDATE if it can be used as 'other-than-FRAME' frame on the |
| 890 | same tty (for tty frames) or among frames which uses FRAME's keyboard. | 921 | same tty (for tty frames) or among frames which uses FRAME's keyboard. |
| 891 | If MINIBUF is nil, do not consider minibuffer-only candidate. | 922 | If MINIBUF is nil, do not consider minibuffer-only candidate. |
| 892 | If MINIBUF is `visible', do not consider an invisible candidate. | 923 | If MINIBUF is `visible', do not consider an invisible candidate. |
| 893 | If MINIBUF is a window, consider only its own frame and candidate now | 924 | If MINIBUF is a window, consider only its own frame and candidate now |
| 894 | using that window as the minibuffer. | 925 | using that window as the minibuffer. |
| 895 | If MINIBUF is 0, consider candidate if it is visible or iconified. | 926 | If MINIBUF is 0, consider candidate if it is visible or iconified. |
| @@ -1189,7 +1220,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1189 | /* Use set_window_buffer instead of Fset_window_buffer (see | 1220 | /* Use set_window_buffer instead of Fset_window_buffer (see |
| 1190 | discussion of bug#11984, bug#12025, bug#12026). */ | 1221 | discussion of bug#11984, bug#12025, bug#12026). */ |
| 1191 | set_window_buffer (sf->minibuffer_window, | 1222 | set_window_buffer (sf->minibuffer_window, |
| 1192 | XWINDOW (minibuf_window)->buffer, 0, 0); | 1223 | XWINDOW (minibuf_window)->contents, 0, 0); |
| 1193 | minibuf_window = sf->minibuffer_window; | 1224 | minibuf_window = sf->minibuffer_window; |
| 1194 | 1225 | ||
| 1195 | /* If the dying minibuffer window was selected, | 1226 | /* If the dying minibuffer window was selected, |
| @@ -1593,17 +1624,13 @@ make_frame_visible_1 (Lisp_Object window) | |||
| 1593 | { | 1624 | { |
| 1594 | struct window *w; | 1625 | struct window *w; |
| 1595 | 1626 | ||
| 1596 | for (;!NILP (window); window = w->next) | 1627 | for (; !NILP (window); window = w->next) |
| 1597 | { | 1628 | { |
| 1598 | w = XWINDOW (window); | 1629 | w = XWINDOW (window); |
| 1599 | 1630 | if (WINDOWP (w->contents)) | |
| 1600 | if (!NILP (w->buffer)) | 1631 | make_frame_visible_1 (w->contents); |
| 1601 | bset_display_time (XBUFFER (w->buffer), Fcurrent_time ()); | 1632 | else |
| 1602 | 1633 | bset_display_time (XBUFFER (w->contents), Fcurrent_time ()); | |
| 1603 | if (!NILP (w->vchild)) | ||
| 1604 | make_frame_visible_1 (w->vchild); | ||
| 1605 | if (!NILP (w->hchild)) | ||
| 1606 | make_frame_visible_1 (w->hchild); | ||
| 1607 | } | 1634 | } |
| 1608 | } | 1635 | } |
| 1609 | 1636 | ||
| @@ -1634,7 +1661,7 @@ displayed in the terminal. */) | |||
| 1634 | /* Use set_window_buffer instead of Fset_window_buffer (see | 1661 | /* Use set_window_buffer instead of Fset_window_buffer (see |
| 1635 | discussion of bug#11984, bug#12025, bug#12026). */ | 1662 | discussion of bug#11984, bug#12025, bug#12026). */ |
| 1636 | set_window_buffer (sf->minibuffer_window, | 1663 | set_window_buffer (sf->minibuffer_window, |
| 1637 | XWINDOW (minibuf_window)->buffer, 0, 0); | 1664 | XWINDOW (minibuf_window)->contents, 0, 0); |
| 1638 | minibuf_window = sf->minibuffer_window; | 1665 | minibuf_window = sf->minibuffer_window; |
| 1639 | } | 1666 | } |
| 1640 | 1667 | ||
| @@ -1665,7 +1692,7 @@ If omitted, FRAME defaults to the currently selected frame. */) | |||
| 1665 | /* Use set_window_buffer instead of Fset_window_buffer (see | 1692 | /* Use set_window_buffer instead of Fset_window_buffer (see |
| 1666 | discussion of bug#11984, bug#12025, bug#12026). */ | 1693 | discussion of bug#11984, bug#12025, bug#12026). */ |
| 1667 | set_window_buffer (sf->minibuffer_window, | 1694 | set_window_buffer (sf->minibuffer_window, |
| 1668 | XWINDOW (minibuf_window)->buffer, 0, 0); | 1695 | XWINDOW (minibuf_window)->contents, 0, 0); |
| 1669 | minibuf_window = sf->minibuffer_window; | 1696 | minibuf_window = sf->minibuffer_window; |
| 1670 | } | 1697 | } |
| 1671 | 1698 | ||
| @@ -3315,16 +3342,15 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 3315 | else if (FLOATP (item)) | 3342 | else if (FLOATP (item)) |
| 3316 | { | 3343 | { |
| 3317 | alpha = XFLOAT_DATA (item); | 3344 | alpha = XFLOAT_DATA (item); |
| 3318 | if (alpha < 0.0 || alpha > 1.0) | 3345 | if (! (0 <= alpha && alpha <= 1.0)) |
| 3319 | args_out_of_range (make_float (0.0), make_float (1.0)); | 3346 | args_out_of_range (make_float (0.0), make_float (1.0)); |
| 3320 | } | 3347 | } |
| 3321 | else if (INTEGERP (item)) | 3348 | else if (INTEGERP (item)) |
| 3322 | { | 3349 | { |
| 3323 | EMACS_INT ialpha = XINT (item); | 3350 | EMACS_INT ialpha = XINT (item); |
| 3324 | if (ialpha < 0 || ialpha > 100) | 3351 | if (! (0 <= ialpha && alpha <= 100)) |
| 3325 | args_out_of_range (make_number (0), make_number (100)); | 3352 | args_out_of_range (make_number (0), make_number (100)); |
| 3326 | else | 3353 | alpha = ialpha / 100.0; |
| 3327 | alpha = ialpha / 100.0; | ||
| 3328 | } | 3354 | } |
| 3329 | else | 3355 | else |
| 3330 | wrong_type_argument (Qnumberp, item); | 3356 | wrong_type_argument (Qnumberp, item); |
| @@ -3498,9 +3524,7 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) | |||
| 3498 | (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, | 3524 | (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, |
| 3499 | Lisp_Object subclass) | 3525 | Lisp_Object subclass) |
| 3500 | { | 3526 | { |
| 3501 | #ifdef HAVE_X_WINDOWS | 3527 | check_window_system (NULL); |
| 3502 | check_x (); | ||
| 3503 | #endif | ||
| 3504 | 3528 | ||
| 3505 | return xrdb_get_resource (check_x_display_info (Qnil)->xrdb, | 3529 | return xrdb_get_resource (check_x_display_info (Qnil)->xrdb, |
| 3506 | attribute, class, component, subclass); | 3530 | attribute, class, component, subclass); |
diff --git a/src/frame.h b/src/frame.h index 32a6954024e..b69f19b7ef8 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -427,10 +427,6 @@ struct frame | |||
| 427 | /* Width of bar cursor (if we are using that) for blink-off state. */ | 427 | /* Width of bar cursor (if we are using that) for blink-off state. */ |
| 428 | int blink_off_cursor_width; | 428 | int blink_off_cursor_width; |
| 429 | 429 | ||
| 430 | /* Nonnegative if current redisplay should not do scroll computation | ||
| 431 | for lines beyond a certain vpos. This is the vpos. */ | ||
| 432 | int scroll_bottom_vpos; | ||
| 433 | |||
| 434 | /* Configured width of the scroll bar, in pixels and in characters. | 430 | /* Configured width of the scroll bar, in pixels and in characters. |
| 435 | config_scroll_bar_cols tracks config_scroll_bar_width if the | 431 | config_scroll_bar_cols tracks config_scroll_bar_width if the |
| 436 | latter is positive; a zero value in config_scroll_bar_width means | 432 | latter is positive; a zero value in config_scroll_bar_width means |
| @@ -785,7 +781,6 @@ typedef struct frame *FRAME_PTR; | |||
| 785 | #define FRAME_DELETE_COST(f) (f)->delete_line_cost | 781 | #define FRAME_DELETE_COST(f) (f)->delete_line_cost |
| 786 | #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost | 782 | #define FRAME_INSERTN_COST(f) (f)->insert_n_lines_cost |
| 787 | #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost | 783 | #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost |
| 788 | #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos | ||
| 789 | #define FRAME_FOCUS_FRAME(f) f->focus_frame | 784 | #define FRAME_FOCUS_FRAME(f) f->focus_frame |
| 790 | 785 | ||
| 791 | /* This frame slot says whether scroll bars are currently enabled for frame F, | 786 | /* This frame slot says whether scroll bars are currently enabled for frame F, |
| @@ -963,6 +958,7 @@ extern Lisp_Object Qnoelisp; | |||
| 963 | extern struct frame *last_nonminibuf_frame; | 958 | extern struct frame *last_nonminibuf_frame; |
| 964 | 959 | ||
| 965 | extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); | 960 | extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); |
| 961 | extern struct frame *decode_window_system_frame (Lisp_Object); | ||
| 966 | extern struct frame *decode_live_frame (Lisp_Object); | 962 | extern struct frame *decode_live_frame (Lisp_Object); |
| 967 | extern struct frame *decode_any_frame (Lisp_Object); | 963 | extern struct frame *decode_any_frame (Lisp_Object); |
| 968 | extern struct frame *make_initial_frame (void); | 964 | extern struct frame *make_initial_frame (void); |
| @@ -973,6 +969,8 @@ extern struct frame *make_frame_without_minibuffer (Lisp_Object, | |||
| 973 | struct kboard *, | 969 | struct kboard *, |
| 974 | Lisp_Object); | 970 | Lisp_Object); |
| 975 | #endif /* HAVE_WINDOW_SYSTEM */ | 971 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 972 | extern bool window_system_available (struct frame *); | ||
| 973 | extern void check_window_system (struct frame *); | ||
| 976 | extern void frame_make_pointer_invisible (void); | 974 | extern void frame_make_pointer_invisible (void); |
| 977 | extern void frame_make_pointer_visible (void); | 975 | extern void frame_make_pointer_visible (void); |
| 978 | extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object); | 976 | extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object); |
diff --git a/src/fringe.c b/src/fringe.c index fa6f889ba69..f728cd6d5ff 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -699,7 +699,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor) | |||
| 699 | { | 699 | { |
| 700 | Lisp_Object cmap, bm = Qnil; | 700 | Lisp_Object cmap, bm = Qnil; |
| 701 | 701 | ||
| 702 | if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap)) | 702 | if ((cmap = BVAR (XBUFFER (w->contents), fringe_cursor_alist)), !NILP (cmap)) |
| 703 | { | 703 | { |
| 704 | bm = Fassq (cursor, cmap); | 704 | bm = Fassq (cursor, cmap); |
| 705 | if (CONSP (bm)) | 705 | if (CONSP (bm)) |
| @@ -736,7 +736,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in | |||
| 736 | If partial, lookup partial bitmap in default value if not found here. | 736 | If partial, lookup partial bitmap in default value if not found here. |
| 737 | If not partial, or no partial spec is present, use non-partial bitmap. */ | 737 | If not partial, or no partial spec is present, use non-partial bitmap. */ |
| 738 | 738 | ||
| 739 | if ((cmap = BVAR (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap)) | 739 | if ((cmap = BVAR (XBUFFER (w->contents), fringe_indicator_alist)), !NILP (cmap)) |
| 740 | { | 740 | { |
| 741 | bm1 = Fassq (bitmap, cmap); | 741 | bm1 = Fassq (bitmap, cmap); |
| 742 | if (CONSP (bm1)) | 742 | if (CONSP (bm1)) |
| @@ -963,7 +963,7 @@ update_window_fringes (struct window *w, int keep_current_p) | |||
| 963 | return 0; | 963 | return 0; |
| 964 | 964 | ||
| 965 | if (!MINI_WINDOW_P (w) | 965 | if (!MINI_WINDOW_P (w) |
| 966 | && (ind = BVAR (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind))) | 966 | && (ind = BVAR (XBUFFER (w->contents), indicate_buffer_boundaries), !NILP (ind))) |
| 967 | { | 967 | { |
| 968 | if (EQ (ind, Qleft) || EQ (ind, Qright)) | 968 | if (EQ (ind, Qleft) || EQ (ind, Qright)) |
| 969 | boundary_top = boundary_bot = arrow_top = arrow_bot = ind; | 969 | boundary_top = boundary_bot = arrow_top = arrow_bot = ind; |
| @@ -1004,7 +1004,7 @@ update_window_fringes (struct window *w, int keep_current_p) | |||
| 1004 | { | 1004 | { |
| 1005 | if (top_ind_rn < 0 && row->visible_height > 0) | 1005 | if (top_ind_rn < 0 && row->visible_height > 0) |
| 1006 | { | 1006 | { |
| 1007 | if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)) | 1007 | if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->contents)) |
| 1008 | && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) | 1008 | && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) |
| 1009 | row->indicate_bob_p = !NILP (boundary_top); | 1009 | row->indicate_bob_p = !NILP (boundary_top); |
| 1010 | else | 1010 | else |
| @@ -1014,7 +1014,7 @@ update_window_fringes (struct window *w, int keep_current_p) | |||
| 1014 | 1014 | ||
| 1015 | if (bot_ind_rn < 0) | 1015 | if (bot_ind_rn < 0) |
| 1016 | { | 1016 | { |
| 1017 | if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)) | 1017 | if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->contents)) |
| 1018 | && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) | 1018 | && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) |
| 1019 | row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn; | 1019 | row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn; |
| 1020 | else if (y + row->height >= yb) | 1020 | else if (y + row->height >= yb) |
| @@ -1024,7 +1024,7 @@ update_window_fringes (struct window *w, int keep_current_p) | |||
| 1024 | } | 1024 | } |
| 1025 | } | 1025 | } |
| 1026 | 1026 | ||
| 1027 | empty_pos = BVAR (XBUFFER (w->buffer), indicate_empty_lines); | 1027 | empty_pos = BVAR (XBUFFER (w->contents), indicate_empty_lines); |
| 1028 | if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) | 1028 | if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) |
| 1029 | empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; | 1029 | empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; |
| 1030 | 1030 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index 595a7427c21..f83d8660fcc 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -543,7 +543,7 @@ get_utf8_string (const char *str) | |||
| 543 | if (cp) g_free (cp); | 543 | if (cp) g_free (cp); |
| 544 | 544 | ||
| 545 | len = strlen (str); | 545 | len = strlen (str); |
| 546 | if (nr_bad > (min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4) | 546 | if ((min (PTRDIFF_MAX, SIZE_MAX) - len - 1) / 4 < nr_bad) |
| 547 | memory_full (SIZE_MAX); | 547 | memory_full (SIZE_MAX); |
| 548 | up = utf8_str = xmalloc (len + nr_bad * 4 + 1); | 548 | up = utf8_str = xmalloc (len + nr_bad * 4 + 1); |
| 549 | p = (unsigned char *)str; | 549 | p = (unsigned char *)str; |
diff --git a/src/image.c b/src/image.c index 6da430bee73..2dae63a294f 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -889,7 +889,7 @@ or omitted means use the selected frame. */) | |||
| 889 | size = Qnil; | 889 | size = Qnil; |
| 890 | if (valid_image_p (spec)) | 890 | if (valid_image_p (spec)) |
| 891 | { | 891 | { |
| 892 | struct frame *f = check_x_frame (frame); | 892 | struct frame *f = decode_window_system_frame (frame); |
| 893 | ptrdiff_t id = lookup_image (f, spec); | 893 | ptrdiff_t id = lookup_image (f, spec); |
| 894 | struct image *img = IMAGE_FROM_ID (f, id); | 894 | struct image *img = IMAGE_FROM_ID (f, id); |
| 895 | int width = img->width + 2 * img->hmargin; | 895 | int width = img->width + 2 * img->hmargin; |
| @@ -919,7 +919,7 @@ or omitted means use the selected frame. */) | |||
| 919 | mask = Qnil; | 919 | mask = Qnil; |
| 920 | if (valid_image_p (spec)) | 920 | if (valid_image_p (spec)) |
| 921 | { | 921 | { |
| 922 | struct frame *f = check_x_frame (frame); | 922 | struct frame *f = decode_window_system_frame (frame); |
| 923 | ptrdiff_t id = lookup_image (f, spec); | 923 | ptrdiff_t id = lookup_image (f, spec); |
| 924 | struct image *img = IMAGE_FROM_ID (f, id); | 924 | struct image *img = IMAGE_FROM_ID (f, id); |
| 925 | if (img->mask) | 925 | if (img->mask) |
| @@ -942,7 +942,7 @@ or omitted means use the selected frame. */) | |||
| 942 | ext = Qnil; | 942 | ext = Qnil; |
| 943 | if (valid_image_p (spec)) | 943 | if (valid_image_p (spec)) |
| 944 | { | 944 | { |
| 945 | struct frame *f = check_x_frame (frame); | 945 | struct frame *f = decode_window_system_frame (frame); |
| 946 | ptrdiff_t id = lookup_image (f, spec); | 946 | ptrdiff_t id = lookup_image (f, spec); |
| 947 | struct image *img = IMAGE_FROM_ID (f, id); | 947 | struct image *img = IMAGE_FROM_ID (f, id); |
| 948 | ext = img->lisp_data; | 948 | ext = img->lisp_data; |
| @@ -1550,7 +1550,7 @@ which is then usually a filename. */) | |||
| 1550 | if (!(EQ (filter, Qnil) || FRAMEP (filter))) | 1550 | if (!(EQ (filter, Qnil) || FRAMEP (filter))) |
| 1551 | clear_image_caches (filter); | 1551 | clear_image_caches (filter); |
| 1552 | else | 1552 | else |
| 1553 | clear_image_cache (check_x_frame (filter), Qt); | 1553 | clear_image_cache (decode_window_system_frame (filter), Qt); |
| 1554 | 1554 | ||
| 1555 | return Qnil; | 1555 | return Qnil; |
| 1556 | } | 1556 | } |
| @@ -1581,7 +1581,7 @@ FRAME t means refresh the image on all frames. */) | |||
| 1581 | } | 1581 | } |
| 1582 | } | 1582 | } |
| 1583 | else | 1583 | else |
| 1584 | uncache_image (check_x_frame (frame), spec); | 1584 | uncache_image (decode_window_system_frame (frame), spec); |
| 1585 | 1585 | ||
| 1586 | return Qnil; | 1586 | return Qnil; |
| 1587 | } | 1587 | } |
| @@ -8138,6 +8138,7 @@ DEF_IMGLIB_FN (int, gdk_pixbuf_get_bits_per_sample, (const GdkPixbuf *)); | |||
| 8138 | 8138 | ||
| 8139 | DEF_IMGLIB_FN (void, g_type_init, (void)); | 8139 | DEF_IMGLIB_FN (void, g_type_init, (void)); |
| 8140 | DEF_IMGLIB_FN (void, g_object_unref, (gpointer)); | 8140 | DEF_IMGLIB_FN (void, g_object_unref, (gpointer)); |
| 8141 | DEF_IMGLIB_FN (void, g_error_free, (GError *)); | ||
| 8141 | 8142 | ||
| 8142 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; | 8143 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; |
| 8143 | 8144 | ||
diff --git a/src/indent.c b/src/indent.c index ac448532dd4..67796ab8a8f 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -56,11 +56,6 @@ static EMACS_INT last_known_column_modified; | |||
| 56 | static ptrdiff_t current_column_1 (void); | 56 | static ptrdiff_t current_column_1 (void); |
| 57 | static ptrdiff_t position_indentation (ptrdiff_t); | 57 | static ptrdiff_t position_indentation (ptrdiff_t); |
| 58 | 58 | ||
| 59 | /* Cache of beginning of line found by the last call of | ||
| 60 | current_column. */ | ||
| 61 | |||
| 62 | static ptrdiff_t current_column_bol_cache; | ||
| 63 | |||
| 64 | /* Get the display table to use for the current buffer. */ | 59 | /* Get the display table to use for the current buffer. */ |
| 65 | 60 | ||
| 66 | struct Lisp_Char_Table * | 61 | struct Lisp_Char_Table * |
| @@ -254,7 +249,7 @@ skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, ptrdiff_t to, Lisp_Ob | |||
| 254 | the next property change */ | 249 | the next property change */ |
| 255 | prop = Fget_char_property (position, Qinvisible, | 250 | prop = Fget_char_property (position, Qinvisible, |
| 256 | (!NILP (window) | 251 | (!NILP (window) |
| 257 | && EQ (XWINDOW (window)->buffer, buffer)) | 252 | && EQ (XWINDOW (window)->contents, buffer)) |
| 258 | ? window : buffer); | 253 | ? window : buffer); |
| 259 | inv_p = TEXT_PROP_MEANS_INVISIBLE (prop); | 254 | inv_p = TEXT_PROP_MEANS_INVISIBLE (prop); |
| 260 | /* When counting columns (window == nil), don't skip over ellipsis text. */ | 255 | /* When counting columns (window == nil), don't skip over ellipsis text. */ |
| @@ -439,11 +434,6 @@ current_column (void) | |||
| 439 | col += post_tab; | 434 | col += post_tab; |
| 440 | } | 435 | } |
| 441 | 436 | ||
| 442 | if (ptr == BEGV_ADDR) | ||
| 443 | current_column_bol_cache = BEGV; | ||
| 444 | else | ||
| 445 | current_column_bol_cache = BYTE_TO_CHAR (PTR_BYTE_POS (ptr)); | ||
| 446 | |||
| 447 | last_known_column = col; | 437 | last_known_column = col; |
| 448 | last_known_column_point = PT; | 438 | last_known_column_point = PT; |
| 449 | last_known_column_modified = MODIFF; | 439 | last_known_column_modified = MODIFF; |
| @@ -476,7 +466,7 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) | |||
| 476 | if ((prop = Fplist_get (plist, QCwidth), | 466 | if ((prop = Fplist_get (plist, QCwidth), |
| 477 | RANGED_INTEGERP (0, prop, INT_MAX))) | 467 | RANGED_INTEGERP (0, prop, INT_MAX))) |
| 478 | width = XINT (prop); | 468 | width = XINT (prop); |
| 479 | else if (FLOATP (prop) && XFLOAT_DATA (prop) >= 0 | 469 | else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) |
| 480 | && XFLOAT_DATA (prop) <= INT_MAX) | 470 | && XFLOAT_DATA (prop) <= INT_MAX) |
| 481 | width = (int)(XFLOAT_DATA (prop) + 0.5); | 471 | width = (int)(XFLOAT_DATA (prop) + 0.5); |
| 482 | else if ((prop = Fplist_get (plist, QCalign_to), | 472 | else if ((prop = Fplist_get (plist, QCalign_to), |
| @@ -525,7 +515,6 @@ scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol) | |||
| 525 | { | 515 | { |
| 526 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; | 516 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 527 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); | 517 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); |
| 528 | current_column_bol_cache = PT; | ||
| 529 | scan = PT, scan_byte = PT_BYTE; | 518 | scan = PT, scan_byte = PT_BYTE; |
| 530 | SET_PT_BOTH (opoint, opoint_byte); | 519 | SET_PT_BOTH (opoint, opoint_byte); |
| 531 | next_boundary = scan; | 520 | next_boundary = scan; |
| @@ -1088,8 +1077,8 @@ static struct position val_compute_motion; | |||
| 1088 | : (window_width + window_left != frame_cols)) | 1077 | : (window_width + window_left != frame_cols)) |
| 1089 | 1078 | ||
| 1090 | where | 1079 | where |
| 1091 | window_width is XFASTINT (w->total_cols), | 1080 | window_width is w->total_cols, |
| 1092 | window_left is XFASTINT (w->left_col), | 1081 | window_left is w->left_col, |
| 1093 | has_vertical_scroll_bars is | 1082 | has_vertical_scroll_bars is |
| 1094 | WINDOW_HAS_VERTICAL_SCROLL_BAR (window) | 1083 | WINDOW_HAS_VERTICAL_SCROLL_BAR (window) |
| 1095 | and frame_cols = FRAME_COLS (XFRAME (window->frame)) | 1084 | and frame_cols = FRAME_COLS (XFRAME (window->frame)) |
| @@ -1826,7 +1815,7 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte, | |||
| 1826 | 1815 | ||
| 1827 | /* If the window contains this buffer, use it for getting text properties. | 1816 | /* If the window contains this buffer, use it for getting text properties. |
| 1828 | Otherwise use the current buffer as arg for doing that. */ | 1817 | Otherwise use the current buffer as arg for doing that. */ |
| 1829 | if (EQ (w->buffer, Fcurrent_buffer ())) | 1818 | if (EQ (w->contents, Fcurrent_buffer ())) |
| 1830 | text_prop_object = window; | 1819 | text_prop_object = window; |
| 1831 | else | 1820 | else |
| 1832 | text_prop_object = Fcurrent_buffer (); | 1821 | text_prop_object = Fcurrent_buffer (); |
| @@ -1979,14 +1968,14 @@ whether or not it is currently displayed in some window. */) | |||
| 1979 | 1968 | ||
| 1980 | old_buffer = Qnil; | 1969 | old_buffer = Qnil; |
| 1981 | GCPRO1 (old_buffer); | 1970 | GCPRO1 (old_buffer); |
| 1982 | if (XBUFFER (w->buffer) != current_buffer) | 1971 | if (XBUFFER (w->contents) != current_buffer) |
| 1983 | { | 1972 | { |
| 1984 | /* Set the window's buffer temporarily to the current buffer. */ | 1973 | /* Set the window's buffer temporarily to the current buffer. */ |
| 1985 | old_buffer = w->buffer; | 1974 | old_buffer = w->contents; |
| 1986 | old_charpos = marker_position (w->pointm); | 1975 | old_charpos = marker_position (w->pointm); |
| 1987 | old_bytepos = marker_byte_position (w->pointm); | 1976 | old_bytepos = marker_byte_position (w->pointm); |
| 1988 | wset_buffer (w, Fcurrent_buffer ()); | 1977 | wset_buffer (w, Fcurrent_buffer ()); |
| 1989 | set_marker_both (w->pointm, w->buffer, | 1978 | set_marker_both (w->pointm, w->contents, |
| 1990 | BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); | 1979 | BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); |
| 1991 | } | 1980 | } |
| 1992 | 1981 | ||
| @@ -2139,7 +2128,7 @@ whether or not it is currently displayed in some window. */) | |||
| 2139 | if (BUFFERP (old_buffer)) | 2128 | if (BUFFERP (old_buffer)) |
| 2140 | { | 2129 | { |
| 2141 | wset_buffer (w, old_buffer); | 2130 | wset_buffer (w, old_buffer); |
| 2142 | set_marker_both (w->pointm, w->buffer, | 2131 | set_marker_both (w->pointm, w->contents, |
| 2143 | old_charpos, old_bytepos); | 2132 | old_charpos, old_bytepos); |
| 2144 | } | 2133 | } |
| 2145 | 2134 | ||
diff --git a/src/insdel.c b/src/insdel.c index a60fed0c32e..8029291cd68 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -983,6 +983,9 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, | |||
| 983 | void | 983 | void |
| 984 | insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) | 984 | insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) |
| 985 | { | 985 | { |
| 986 | int ins_charpos = GPT; | ||
| 987 | int ins_bytepos = GPT_BYTE; | ||
| 988 | |||
| 986 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) | 989 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 987 | nchars = nbytes; | 990 | nchars = nbytes; |
| 988 | 991 | ||
| @@ -1003,18 +1006,18 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) | |||
| 1003 | 1006 | ||
| 1004 | eassert (GPT <= GPT_BYTE); | 1007 | eassert (GPT <= GPT_BYTE); |
| 1005 | 1008 | ||
| 1006 | adjust_overlays_for_insert (GPT - nchars, nchars); | 1009 | adjust_overlays_for_insert (ins_charpos, nchars); |
| 1007 | adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, | 1010 | adjust_markers_for_insert (ins_charpos, ins_bytepos, |
| 1008 | GPT, GPT_BYTE, 0); | 1011 | ins_charpos + nchars, ins_bytepos + nbytes, 0); |
| 1009 | 1012 | ||
| 1010 | if (buffer_intervals (current_buffer)) | 1013 | if (buffer_intervals (current_buffer)) |
| 1011 | { | 1014 | { |
| 1012 | offset_intervals (current_buffer, GPT - nchars, nchars); | 1015 | offset_intervals (current_buffer, ins_charpos, nchars); |
| 1013 | graft_intervals_into_buffer (NULL, GPT - nchars, nchars, | 1016 | graft_intervals_into_buffer (NULL, ins_charpos, nchars, |
| 1014 | current_buffer, 0); | 1017 | current_buffer, 0); |
| 1015 | } | 1018 | } |
| 1016 | 1019 | ||
| 1017 | if (! text_at_gap_tail && GPT - nchars < PT) | 1020 | if (ins_charpos < PT) |
| 1018 | adjust_point (nchars, nbytes); | 1021 | adjust_point (nchars, nbytes); |
| 1019 | 1022 | ||
| 1020 | check_markers (); | 1023 | check_markers (); |
| @@ -1798,7 +1801,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, | |||
| 1798 | 1801 | ||
| 1799 | /* If we're modifying the buffer other than shown in a selected window, | 1802 | /* If we're modifying the buffer other than shown in a selected window, |
| 1800 | let redisplay consider other windows if this buffer is visible. */ | 1803 | let redisplay consider other windows if this buffer is visible. */ |
| 1801 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer | 1804 | if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer |
| 1802 | && buffer_window_count (current_buffer)) | 1805 | && buffer_window_count (current_buffer)) |
| 1803 | ++windows_or_buffers_changed; | 1806 | ++windows_or_buffers_changed; |
| 1804 | 1807 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index d373935f3e4..eb9f93a4c7d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -210,12 +210,6 @@ static EMACS_INT last_auto_save; | |||
| 210 | /* The value of point when the last command was started. */ | 210 | /* The value of point when the last command was started. */ |
| 211 | static ptrdiff_t last_point_position; | 211 | static ptrdiff_t last_point_position; |
| 212 | 212 | ||
| 213 | /* The buffer that was current when the last command was started. */ | ||
| 214 | static Lisp_Object last_point_position_buffer; | ||
| 215 | |||
| 216 | /* The window that was selected when the last command was started. */ | ||
| 217 | static Lisp_Object last_point_position_window; | ||
| 218 | |||
| 219 | /* The frame in which the last input event occurred, or Qmacro if the | 213 | /* The frame in which the last input event occurred, or Qmacro if the |
| 220 | last event came from a macro. We use this to determine when to | 214 | last event came from a macro. We use this to determine when to |
| 221 | generate switch-frame events. This may be cleared by functions | 215 | generate switch-frame events. This may be cleared by functions |
| @@ -836,7 +830,7 @@ This function is called by the editor initialization to begin editing. */) | |||
| 836 | update_mode_lines = 1; | 830 | update_mode_lines = 1; |
| 837 | 831 | ||
| 838 | if (command_loop_level | 832 | if (command_loop_level |
| 839 | && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) | 833 | && current_buffer != XBUFFER (XWINDOW (selected_window)->contents)) |
| 840 | buffer = Fcurrent_buffer (); | 834 | buffer = Fcurrent_buffer (); |
| 841 | else | 835 | else |
| 842 | buffer = Qnil; | 836 | buffer = Qnil; |
| @@ -1398,7 +1392,7 @@ command_loop_1 (void) | |||
| 1398 | Fkill_emacs (Qnil); | 1392 | Fkill_emacs (Qnil); |
| 1399 | 1393 | ||
| 1400 | /* Make sure the current window's buffer is selected. */ | 1394 | /* Make sure the current window's buffer is selected. */ |
| 1401 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); | 1395 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents)); |
| 1402 | 1396 | ||
| 1403 | /* Display any malloc warning that just came out. Use while because | 1397 | /* Display any malloc warning that just came out. Use while because |
| 1404 | displaying one warning can cause another. */ | 1398 | displaying one warning can cause another. */ |
| @@ -1464,7 +1458,7 @@ command_loop_1 (void) | |||
| 1464 | /* A filter may have run while we were reading the input. */ | 1458 | /* A filter may have run while we were reading the input. */ |
| 1465 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) | 1459 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) |
| 1466 | Fkill_emacs (Qnil); | 1460 | Fkill_emacs (Qnil); |
| 1467 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); | 1461 | set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents)); |
| 1468 | 1462 | ||
| 1469 | ++num_input_keys; | 1463 | ++num_input_keys; |
| 1470 | 1464 | ||
| @@ -1495,7 +1489,7 @@ command_loop_1 (void) | |||
| 1495 | { | 1489 | { |
| 1496 | struct buffer *b; | 1490 | struct buffer *b; |
| 1497 | XWINDOW (selected_window)->force_start = 0; | 1491 | XWINDOW (selected_window)->force_start = 0; |
| 1498 | b = XBUFFER (XWINDOW (selected_window)->buffer); | 1492 | b = XBUFFER (XWINDOW (selected_window)->contents); |
| 1499 | BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; | 1493 | BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; |
| 1500 | } | 1494 | } |
| 1501 | 1495 | ||
| @@ -1515,8 +1509,6 @@ command_loop_1 (void) | |||
| 1515 | prev_buffer = current_buffer; | 1509 | prev_buffer = current_buffer; |
| 1516 | prev_modiff = MODIFF; | 1510 | prev_modiff = MODIFF; |
| 1517 | last_point_position = PT; | 1511 | last_point_position = PT; |
| 1518 | last_point_position_window = selected_window; | ||
| 1519 | XSETBUFFER (last_point_position_buffer, prev_buffer); | ||
| 1520 | 1512 | ||
| 1521 | /* By default, we adjust point to a boundary of a region that | 1513 | /* By default, we adjust point to a boundary of a region that |
| 1522 | has such a property that should be treated intangible | 1514 | has such a property that should be treated intangible |
| @@ -5152,7 +5144,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, | |||
| 5152 | if (STRINGP (string)) | 5144 | if (STRINGP (string)) |
| 5153 | string_info = Fcons (string, make_number (charpos)); | 5145 | string_info = Fcons (string, make_number (charpos)); |
| 5154 | textpos = (w == XWINDOW (selected_window) | 5146 | textpos = (w == XWINDOW (selected_window) |
| 5155 | && current_buffer == XBUFFER (w->buffer)) | 5147 | && current_buffer == XBUFFER (w->contents)) |
| 5156 | ? PT : marker_position (w->pointm); | 5148 | ? PT : marker_position (w->pointm); |
| 5157 | 5149 | ||
| 5158 | xret = wx; | 5150 | xret = wx; |
| @@ -9164,9 +9156,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, | |||
| 9164 | { | 9156 | { |
| 9165 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) | 9157 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) |
| 9166 | Fkill_emacs (Qnil); | 9158 | Fkill_emacs (Qnil); |
| 9167 | if (XBUFFER (XWINDOW (selected_window)->buffer) | 9159 | if (XBUFFER (XWINDOW (selected_window)->contents) |
| 9168 | != current_buffer) | 9160 | != current_buffer) |
| 9169 | Fset_buffer (XWINDOW (selected_window)->buffer); | 9161 | Fset_buffer (XWINDOW (selected_window)->contents); |
| 9170 | } | 9162 | } |
| 9171 | 9163 | ||
| 9172 | goto replay_sequence; | 9164 | goto replay_sequence; |
| @@ -9214,9 +9206,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, | |||
| 9214 | special-event-map, ...) might have switched the current buffer | 9206 | special-event-map, ...) might have switched the current buffer |
| 9215 | or the selected window from under us in the mean time. */ | 9207 | or the selected window from under us in the mean time. */ |
| 9216 | if (fix_current_buffer | 9208 | if (fix_current_buffer |
| 9217 | && (XBUFFER (XWINDOW (selected_window)->buffer) | 9209 | && (XBUFFER (XWINDOW (selected_window)->contents) |
| 9218 | != current_buffer)) | 9210 | != current_buffer)) |
| 9219 | Fset_buffer (XWINDOW (selected_window)->buffer); | 9211 | Fset_buffer (XWINDOW (selected_window)->contents); |
| 9220 | current_binding = active_maps (first_event); | 9212 | current_binding = active_maps (first_event); |
| 9221 | } | 9213 | } |
| 9222 | 9214 | ||
| @@ -9265,8 +9257,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, | |||
| 9265 | not the current buffer. If we're at the | 9257 | not the current buffer. If we're at the |
| 9266 | beginning of a key sequence, switch buffers. */ | 9258 | beginning of a key sequence, switch buffers. */ |
| 9267 | if (WINDOWP (window) | 9259 | if (WINDOWP (window) |
| 9268 | && BUFFERP (XWINDOW (window)->buffer) | 9260 | && BUFFERP (XWINDOW (window)->contents) |
| 9269 | && XBUFFER (XWINDOW (window)->buffer) != current_buffer) | 9261 | && XBUFFER (XWINDOW (window)->contents) != current_buffer) |
| 9270 | { | 9262 | { |
| 9271 | ASET (raw_keybuf, raw_keybuf_count, key); | 9263 | ASET (raw_keybuf, raw_keybuf_count, key); |
| 9272 | raw_keybuf_count++; | 9264 | raw_keybuf_count++; |
| @@ -9287,7 +9279,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, | |||
| 9287 | 9279 | ||
| 9288 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) | 9280 | if (! FRAME_LIVE_P (XFRAME (selected_frame))) |
| 9289 | Fkill_emacs (Qnil); | 9281 | Fkill_emacs (Qnil); |
| 9290 | set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); | 9282 | set_buffer_internal (XBUFFER (XWINDOW (window)->contents)); |
| 9291 | goto replay_sequence; | 9283 | goto replay_sequence; |
| 9292 | } | 9284 | } |
| 9293 | } | 9285 | } |
| @@ -11070,9 +11062,6 @@ syms_of_keyboard (void) | |||
| 11070 | Fset (Qinput_method_exit_on_first_char, Qnil); | 11062 | Fset (Qinput_method_exit_on_first_char, Qnil); |
| 11071 | Fset (Qinput_method_use_echo_area, Qnil); | 11063 | Fset (Qinput_method_use_echo_area, Qnil); |
| 11072 | 11064 | ||
| 11073 | last_point_position_buffer = Qnil; | ||
| 11074 | last_point_position_window = Qnil; | ||
| 11075 | |||
| 11076 | { | 11065 | { |
| 11077 | int i; | 11066 | int i; |
| 11078 | int len = sizeof (head_table) / sizeof (head_table[0]); | 11067 | int len = sizeof (head_table) / sizeof (head_table[0]); |
diff --git a/src/keymap.c b/src/keymap.c index 110c8f43729..c43d528b25b 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1556,8 +1556,8 @@ like in the respective argument of `key-binding'. */) | |||
| 1556 | window = POSN_WINDOW (position); | 1556 | window = POSN_WINDOW (position); |
| 1557 | 1557 | ||
| 1558 | if (WINDOWP (window) | 1558 | if (WINDOWP (window) |
| 1559 | && BUFFERP (XWINDOW (window)->buffer) | 1559 | && BUFFERP (XWINDOW (window)->contents) |
| 1560 | && XBUFFER (XWINDOW (window)->buffer) != current_buffer) | 1560 | && XBUFFER (XWINDOW (window)->contents) != current_buffer) |
| 1561 | { | 1561 | { |
| 1562 | /* Arrange to go back to the original buffer once we're done | 1562 | /* Arrange to go back to the original buffer once we're done |
| 1563 | processing the key sequence. We don't use | 1563 | processing the key sequence. We don't use |
| @@ -1567,7 +1567,7 @@ like in the respective argument of `key-binding'. */) | |||
| 1567 | things the same. | 1567 | things the same. |
| 1568 | */ | 1568 | */ |
| 1569 | record_unwind_current_buffer (); | 1569 | record_unwind_current_buffer (); |
| 1570 | set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); | 1570 | set_buffer_internal (XBUFFER (XWINDOW (window)->contents)); |
| 1571 | } | 1571 | } |
| 1572 | } | 1572 | } |
| 1573 | 1573 | ||
| @@ -2063,7 +2063,7 @@ For an approximate inverse of this, see `kbd'. */) | |||
| 2063 | size += XINT (Flength (prefix)); | 2063 | size += XINT (Flength (prefix)); |
| 2064 | 2064 | ||
| 2065 | /* This has one extra element at the end that we don't pass to Fconcat. */ | 2065 | /* This has one extra element at the end that we don't pass to Fconcat. */ |
| 2066 | if (size > min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4) | 2066 | if (min (PTRDIFF_MAX, SIZE_MAX) / word_size / 4 < size) |
| 2067 | memory_full (SIZE_MAX); | 2067 | memory_full (SIZE_MAX); |
| 2068 | SAFE_ALLOCA_LISP (args, size * 4); | 2068 | SAFE_ALLOCA_LISP (args, size * 4); |
| 2069 | 2069 | ||
diff --git a/src/lisp.h b/src/lisp.h index 8187f7da993..175ec828c97 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -548,7 +548,7 @@ static EMACS_INT const VALMASK | |||
| 548 | type or if I is a NaN. */ | 548 | type or if I is a NaN. */ |
| 549 | 549 | ||
| 550 | #define FIXNUM_OVERFLOW_P(i) \ | 550 | #define FIXNUM_OVERFLOW_P(i) \ |
| 551 | (! (((i) >= 0 || (i) >= MOST_NEGATIVE_FIXNUM) && (i) <= MOST_POSITIVE_FIXNUM)) | 551 | (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) |
| 552 | 552 | ||
| 553 | LISP_INLINE ptrdiff_t | 553 | LISP_INLINE ptrdiff_t |
| 554 | clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) | 554 | clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) |
| @@ -557,11 +557,6 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) | |||
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | 559 | ||
| 560 | /* Forward declarations. */ | ||
| 561 | |||
| 562 | LISP_INLINE bool SAVE_VALUEP (Lisp_Object); | ||
| 563 | LISP_INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object); | ||
| 564 | |||
| 565 | /* Extract a value or address from a Lisp_Object. */ | 560 | /* Extract a value or address from a Lisp_Object. */ |
| 566 | 561 | ||
| 567 | #define XCONS(a) (eassert (CONSP (a)), \ | 562 | #define XCONS(a) (eassert (CONSP (a)), \ |
| @@ -1492,53 +1487,6 @@ struct Lisp_Save_Value | |||
| 1492 | } data[SAVE_VALUE_SLOTS]; | 1487 | } data[SAVE_VALUE_SLOTS]; |
| 1493 | }; | 1488 | }; |
| 1494 | 1489 | ||
| 1495 | /* Return the type of V's Nth saved value. */ | ||
| 1496 | LISP_INLINE int | ||
| 1497 | save_type (struct Lisp_Save_Value *v, int n) | ||
| 1498 | { | ||
| 1499 | eassert (0 <= n && n < SAVE_VALUE_SLOTS); | ||
| 1500 | return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1)); | ||
| 1501 | } | ||
| 1502 | |||
| 1503 | /* Get and set the Nth saved pointer. */ | ||
| 1504 | |||
| 1505 | LISP_INLINE void * | ||
| 1506 | XSAVE_POINTER (Lisp_Object obj, int n) | ||
| 1507 | { | ||
| 1508 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); | ||
| 1509 | return XSAVE_VALUE (obj)->data[n].pointer;; | ||
| 1510 | } | ||
| 1511 | LISP_INLINE void | ||
| 1512 | set_save_pointer (Lisp_Object obj, int n, void *val) | ||
| 1513 | { | ||
| 1514 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); | ||
| 1515 | XSAVE_VALUE (obj)->data[n].pointer = val; | ||
| 1516 | } | ||
| 1517 | |||
| 1518 | /* Likewise for the saved integer. */ | ||
| 1519 | |||
| 1520 | LISP_INLINE ptrdiff_t | ||
| 1521 | XSAVE_INTEGER (Lisp_Object obj, int n) | ||
| 1522 | { | ||
| 1523 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); | ||
| 1524 | return XSAVE_VALUE (obj)->data[n].integer; | ||
| 1525 | } | ||
| 1526 | LISP_INLINE void | ||
| 1527 | set_save_integer (Lisp_Object obj, int n, ptrdiff_t val) | ||
| 1528 | { | ||
| 1529 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); | ||
| 1530 | XSAVE_VALUE (obj)->data[n].integer = val; | ||
| 1531 | } | ||
| 1532 | |||
| 1533 | /* Extract Nth saved object. */ | ||
| 1534 | |||
| 1535 | LISP_INLINE Lisp_Object | ||
| 1536 | XSAVE_OBJECT (Lisp_Object obj, int n) | ||
| 1537 | { | ||
| 1538 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT); | ||
| 1539 | return XSAVE_VALUE (obj)->data[n].object; | ||
| 1540 | } | ||
| 1541 | |||
| 1542 | /* A miscellaneous object, when it's on the free list. */ | 1490 | /* A miscellaneous object, when it's on the free list. */ |
| 1543 | struct Lisp_Free | 1491 | struct Lisp_Free |
| 1544 | { | 1492 | { |
| @@ -1560,13 +1508,6 @@ union Lisp_Misc | |||
| 1560 | struct Lisp_Save_Value u_save_value; | 1508 | struct Lisp_Save_Value u_save_value; |
| 1561 | }; | 1509 | }; |
| 1562 | 1510 | ||
| 1563 | LISP_INLINE struct Lisp_Save_Value * | ||
| 1564 | XSAVE_VALUE (Lisp_Object a) | ||
| 1565 | { | ||
| 1566 | eassert (SAVE_VALUEP (a)); | ||
| 1567 | return & XMISC (a)->u_save_value; | ||
| 1568 | } | ||
| 1569 | |||
| 1570 | /* Forwarding pointer to an int variable. | 1511 | /* Forwarding pointer to an int variable. |
| 1571 | This is allowed only in the value cell of a symbol, | 1512 | This is allowed only in the value cell of a symbol, |
| 1572 | and it means that the symbol's value really lives in the | 1513 | and it means that the symbol's value really lives in the |
| @@ -1859,6 +1800,60 @@ SAVE_VALUEP (Lisp_Object x) | |||
| 1859 | return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value; | 1800 | return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value; |
| 1860 | } | 1801 | } |
| 1861 | 1802 | ||
| 1803 | LISP_INLINE struct Lisp_Save_Value * | ||
| 1804 | XSAVE_VALUE (Lisp_Object a) | ||
| 1805 | { | ||
| 1806 | eassert (SAVE_VALUEP (a)); | ||
| 1807 | return & XMISC (a)->u_save_value; | ||
| 1808 | } | ||
| 1809 | |||
| 1810 | /* Return the type of V's Nth saved value. */ | ||
| 1811 | LISP_INLINE int | ||
| 1812 | save_type (struct Lisp_Save_Value *v, int n) | ||
| 1813 | { | ||
| 1814 | eassert (0 <= n && n < SAVE_VALUE_SLOTS); | ||
| 1815 | return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1)); | ||
| 1816 | } | ||
| 1817 | |||
| 1818 | /* Get and set the Nth saved pointer. */ | ||
| 1819 | |||
| 1820 | LISP_INLINE void * | ||
| 1821 | XSAVE_POINTER (Lisp_Object obj, int n) | ||
| 1822 | { | ||
| 1823 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); | ||
| 1824 | return XSAVE_VALUE (obj)->data[n].pointer;; | ||
| 1825 | } | ||
| 1826 | LISP_INLINE void | ||
| 1827 | set_save_pointer (Lisp_Object obj, int n, void *val) | ||
| 1828 | { | ||
| 1829 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); | ||
| 1830 | XSAVE_VALUE (obj)->data[n].pointer = val; | ||
| 1831 | } | ||
| 1832 | |||
| 1833 | /* Likewise for the saved integer. */ | ||
| 1834 | |||
| 1835 | LISP_INLINE ptrdiff_t | ||
| 1836 | XSAVE_INTEGER (Lisp_Object obj, int n) | ||
| 1837 | { | ||
| 1838 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); | ||
| 1839 | return XSAVE_VALUE (obj)->data[n].integer; | ||
| 1840 | } | ||
| 1841 | LISP_INLINE void | ||
| 1842 | set_save_integer (Lisp_Object obj, int n, ptrdiff_t val) | ||
| 1843 | { | ||
| 1844 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); | ||
| 1845 | XSAVE_VALUE (obj)->data[n].integer = val; | ||
| 1846 | } | ||
| 1847 | |||
| 1848 | /* Extract Nth saved object. */ | ||
| 1849 | |||
| 1850 | LISP_INLINE Lisp_Object | ||
| 1851 | XSAVE_OBJECT (Lisp_Object obj, int n) | ||
| 1852 | { | ||
| 1853 | eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT); | ||
| 1854 | return XSAVE_VALUE (obj)->data[n].object; | ||
| 1855 | } | ||
| 1856 | |||
| 1862 | #define AUTOLOADP(x) (CONSP (x) && EQ (Qautoload, XCAR (x))) | 1857 | #define AUTOLOADP(x) (CONSP (x) && EQ (Qautoload, XCAR (x))) |
| 1863 | 1858 | ||
| 1864 | #define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int) | 1859 | #define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int) |
| @@ -2570,7 +2565,7 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 2570 | LISP_INLINE void | 2565 | LISP_INLINE void |
| 2571 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) | 2566 | vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) |
| 2572 | { | 2567 | { |
| 2573 | eassert (offset >= 0 && count >= 0 && offset + count <= ASIZE (v)); | 2568 | eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); |
| 2574 | memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); | 2569 | memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); |
| 2575 | } | 2570 | } |
| 2576 | 2571 | ||
| @@ -3781,11 +3776,6 @@ extern void syms_of_xml (void); | |||
| 3781 | extern void xml_cleanup_parser (void); | 3776 | extern void xml_cleanup_parser (void); |
| 3782 | #endif | 3777 | #endif |
| 3783 | 3778 | ||
| 3784 | #ifdef HAVE_MENUS | ||
| 3785 | /* Defined in (x|w32)fns.c, nsfns.m... */ | ||
| 3786 | extern int have_menus_p (void); | ||
| 3787 | #endif | ||
| 3788 | |||
| 3789 | #ifdef HAVE_DBUS | 3779 | #ifdef HAVE_DBUS |
| 3790 | /* Defined in dbusbind.c. */ | 3780 | /* Defined in dbusbind.c. */ |
| 3791 | void syms_of_dbusbind (void); | 3781 | void syms_of_dbusbind (void); |
diff --git a/src/lread.c b/src/lread.c index d7a16f813c8..8e623e838c7 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2636,7 +2636,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2636 | nskip--; | 2636 | nskip--; |
| 2637 | else | 2637 | else |
| 2638 | UNREAD (c); | 2638 | UNREAD (c); |
| 2639 | 2639 | ||
| 2640 | if (load_force_doc_strings | 2640 | if (load_force_doc_strings |
| 2641 | && (FROM_FILE_P (readcharfun))) | 2641 | && (FROM_FILE_P (readcharfun))) |
| 2642 | { | 2642 | { |
| @@ -2731,8 +2731,8 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2731 | /* Read a non-negative integer. */ | 2731 | /* Read a non-negative integer. */ |
| 2732 | while (c >= '0' && c <= '9') | 2732 | while (c >= '0' && c <= '9') |
| 2733 | { | 2733 | { |
| 2734 | if (n > MOST_POSITIVE_FIXNUM / 10 | 2734 | if (MOST_POSITIVE_FIXNUM / 10 < n |
| 2735 | || n * 10 + c - '0' > MOST_POSITIVE_FIXNUM) | 2735 | || MOST_POSITIVE_FIXNUM < n * 10 + c - '0') |
| 2736 | n = MOST_POSITIVE_FIXNUM + 1; | 2736 | n = MOST_POSITIVE_FIXNUM + 1; |
| 2737 | else | 2737 | else |
| 2738 | n = n * 10 + c - '0'; | 2738 | n = n * 10 + c - '0'; |
| @@ -2930,7 +2930,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2930 | if (end - p < MAX_MULTIBYTE_LENGTH) | 2930 | if (end - p < MAX_MULTIBYTE_LENGTH) |
| 2931 | { | 2931 | { |
| 2932 | ptrdiff_t offset = p - read_buffer; | 2932 | ptrdiff_t offset = p - read_buffer; |
| 2933 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) | 2933 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) |
| 2934 | memory_full (SIZE_MAX); | 2934 | memory_full (SIZE_MAX); |
| 2935 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 2935 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 2936 | read_buffer_size *= 2; | 2936 | read_buffer_size *= 2; |
| @@ -3064,7 +3064,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3064 | if (end - p < MAX_MULTIBYTE_LENGTH) | 3064 | if (end - p < MAX_MULTIBYTE_LENGTH) |
| 3065 | { | 3065 | { |
| 3066 | ptrdiff_t offset = p - read_buffer; | 3066 | ptrdiff_t offset = p - read_buffer; |
| 3067 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) | 3067 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) |
| 3068 | memory_full (SIZE_MAX); | 3068 | memory_full (SIZE_MAX); |
| 3069 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 3069 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 3070 | read_buffer_size *= 2; | 3070 | read_buffer_size *= 2; |
| @@ -3094,7 +3094,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3094 | if (p == end) | 3094 | if (p == end) |
| 3095 | { | 3095 | { |
| 3096 | ptrdiff_t offset = p - read_buffer; | 3096 | ptrdiff_t offset = p - read_buffer; |
| 3097 | if (read_buffer_size > min (PTRDIFF_MAX, SIZE_MAX) / 2) | 3097 | if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size) |
| 3098 | memory_full (SIZE_MAX); | 3098 | memory_full (SIZE_MAX); |
| 3099 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); | 3099 | read_buffer = xrealloc (read_buffer, read_buffer_size * 2); |
| 3100 | read_buffer_size *= 2; | 3100 | read_buffer_size *= 2; |
diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 93f12900dde..aacc258cd11 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in | |||
| @@ -873,6 +873,7 @@ $(BLD)/filelock.$(O) : \ | |||
| 873 | $(CHARACTER_H) \ | 873 | $(CHARACTER_H) \ |
| 874 | $(CODING_H) \ | 874 | $(CODING_H) \ |
| 875 | $(CONFIG_H) \ | 875 | $(CONFIG_H) \ |
| 876 | $(C_CTYPE_H) \ | ||
| 876 | $(LISP_H) \ | 877 | $(LISP_H) \ |
| 877 | $(SYSTIME_H) | 878 | $(SYSTIME_H) |
| 878 | 879 | ||
| @@ -1398,6 +1399,7 @@ $(BLD)/sysdep.$(O) : \ | |||
| 1398 | $(NT_INC)/netdb.h \ | 1399 | $(NT_INC)/netdb.h \ |
| 1399 | $(NT_INC)/pwd.h \ | 1400 | $(NT_INC)/pwd.h \ |
| 1400 | $(NT_INC)/sys/file.h \ | 1401 | $(NT_INC)/sys/file.h \ |
| 1402 | $(NT_INC)/sys/param.h \ | ||
| 1401 | $(NT_INC)/sys/stat.h \ | 1403 | $(NT_INC)/sys/stat.h \ |
| 1402 | $(NT_INC)/unistd.h \ | 1404 | $(NT_INC)/unistd.h \ |
| 1403 | $(GNU_LIB)/execinfo.h \ | 1405 | $(GNU_LIB)/execinfo.h \ |
diff --git a/src/menu.c b/src/menu.c index ffb5c3bc936..58558d5aedd 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -1085,7 +1085,8 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1085 | #ifdef HAVE_MENUS | 1085 | #ifdef HAVE_MENUS |
| 1086 | { | 1086 | { |
| 1087 | bool get_current_pos_p = 0; | 1087 | bool get_current_pos_p = 0; |
| 1088 | /* FIXME!! check_w32 (); or check_x (); or check_ns (); */ | 1088 | |
| 1089 | check_window_system (SELECTED_FRAME ()); | ||
| 1089 | 1090 | ||
| 1090 | /* Decode the first argument: find the window and the coordinates. */ | 1091 | /* Decode the first argument: find the window and the coordinates. */ |
| 1091 | if (EQ (position, Qt) | 1092 | if (EQ (position, Qt) |
diff --git a/src/minibuf.c b/src/minibuf.c index 56459353714..68c39310f01 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -114,7 +114,7 @@ choose_minibuf_frame (void) | |||
| 114 | /* Under X, we come here with minibuf_window being the | 114 | /* Under X, we come here with minibuf_window being the |
| 115 | minibuffer window of the unused termcap window created in | 115 | minibuffer window of the unused termcap window created in |
| 116 | init_window_once. That window doesn't have a buffer. */ | 116 | init_window_once. That window doesn't have a buffer. */ |
| 117 | buffer = XWINDOW (minibuf_window)->buffer; | 117 | buffer = XWINDOW (minibuf_window)->contents; |
| 118 | if (BUFFERP (buffer)) | 118 | if (BUFFERP (buffer)) |
| 119 | /* Use set_window_buffer instead of Fset_window_buffer (see | 119 | /* Use set_window_buffer instead of Fset_window_buffer (see |
| 120 | discussion of bug#11984, bug#12025, bug#12026). */ | 120 | discussion of bug#11984, bug#12025, bug#12026). */ |
| @@ -251,7 +251,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 251 | { | 251 | { |
| 252 | if (len == size) | 252 | if (len == size) |
| 253 | { | 253 | { |
| 254 | if (size > STRING_BYTES_BOUND / 2) | 254 | if (STRING_BYTES_BOUND / 2 < size) |
| 255 | memory_full (SIZE_MAX); | 255 | memory_full (SIZE_MAX); |
| 256 | size *= 2; | 256 | size *= 2; |
| 257 | line = xrealloc (line, size); | 257 | line = xrealloc (line, size); |
| @@ -844,7 +844,7 @@ read_minibuf_unwind (Lisp_Object data) | |||
| 844 | window = minibuf_window; | 844 | window = minibuf_window; |
| 845 | /* To keep things predictable, in case it matters, let's be in the | 845 | /* To keep things predictable, in case it matters, let's be in the |
| 846 | minibuffer when we reset the relevant variables. */ | 846 | minibuffer when we reset the relevant variables. */ |
| 847 | Fset_buffer (XWINDOW (window)->buffer); | 847 | Fset_buffer (XWINDOW (window)->contents); |
| 848 | 848 | ||
| 849 | /* Restore prompt, etc, from outer minibuffer level. */ | 849 | /* Restore prompt, etc, from outer minibuffer level. */ |
| 850 | minibuf_prompt = Fcar (minibuf_save_list); | 850 | minibuf_prompt = Fcar (minibuf_save_list); |
diff --git a/src/msdos.c b/src/msdos.c index ee47109d5f2..a2bcc06ac17 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -1261,7 +1261,7 @@ IT_update_begin (struct frame *f) | |||
| 1261 | /* If the mouse highlight is in the window that was deleted | 1261 | /* If the mouse highlight is in the window that was deleted |
| 1262 | (e.g., if it was popped by completion), clear highlight | 1262 | (e.g., if it was popped by completion), clear highlight |
| 1263 | unconditionally. */ | 1263 | unconditionally. */ |
| 1264 | if (NILP (w->buffer)) | 1264 | if (NILP (w->contents)) |
| 1265 | hlinfo->mouse_face_window = Qnil; | 1265 | hlinfo->mouse_face_window = Qnil; |
| 1266 | else | 1266 | else |
| 1267 | { | 1267 | { |
| @@ -1271,7 +1271,7 @@ IT_update_begin (struct frame *f) | |||
| 1271 | break; | 1271 | break; |
| 1272 | } | 1272 | } |
| 1273 | 1273 | ||
| 1274 | if (NILP (w->buffer) || i < w->desired_matrix->nrows) | 1274 | if (NILP (w->contents) || i < w->desired_matrix->nrows) |
| 1275 | clear_mouse_face (hlinfo); | 1275 | clear_mouse_face (hlinfo); |
| 1276 | } | 1276 | } |
| 1277 | } | 1277 | } |
| @@ -1321,7 +1321,7 @@ IT_frame_up_to_date (struct frame *f) | |||
| 1321 | new_cursor = frame_desired_cursor; | 1321 | new_cursor = frame_desired_cursor; |
| 1322 | else | 1322 | else |
| 1323 | { | 1323 | { |
| 1324 | struct buffer *b = XBUFFER (sw->buffer); | 1324 | struct buffer *b = XBUFFER (sw->contents); |
| 1325 | 1325 | ||
| 1326 | if (EQ (BVAR (b,cursor_type), Qt)) | 1326 | if (EQ (BVAR (b,cursor_type), Qt)) |
| 1327 | new_cursor = frame_desired_cursor; | 1327 | new_cursor = frame_desired_cursor; |
| @@ -1920,7 +1920,7 @@ dos_get_saved_screen (char **screen, int *rows, int *cols) | |||
| 1920 | 1920 | ||
| 1921 | /* We are not X, but we can emulate it well enough for our needs... */ | 1921 | /* We are not X, but we can emulate it well enough for our needs... */ |
| 1922 | void | 1922 | void |
| 1923 | check_x (void) | 1923 | check_window_system (void) |
| 1924 | { | 1924 | { |
| 1925 | if (! FRAME_MSDOS_P (SELECTED_FRAME ())) | 1925 | if (! FRAME_MSDOS_P (SELECTED_FRAME ())) |
| 1926 | error ("Not running under a window system"); | 1926 | error ("Not running under a window system"); |
| @@ -2983,11 +2983,6 @@ IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help) | |||
| 2983 | 2983 | ||
| 2984 | /* --------------------------- X Menu emulation ---------------------- */ | 2984 | /* --------------------------- X Menu emulation ---------------------- */ |
| 2985 | 2985 | ||
| 2986 | /* Report availability of menus. */ | ||
| 2987 | |||
| 2988 | int | ||
| 2989 | have_menus_p (void) { return 1; } | ||
| 2990 | |||
| 2991 | /* Create a brand new menu structure. */ | 2986 | /* Create a brand new menu structure. */ |
| 2992 | 2987 | ||
| 2993 | XMenu * | 2988 | XMenu * |
diff --git a/src/nsfns.m b/src/nsfns.m index 9c3051a8c6a..a483f847dec 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -107,43 +107,6 @@ static ptrdiff_t image_cache_refcount; | |||
| 107 | 107 | ||
| 108 | ========================================================================== */ | 108 | ========================================================================== */ |
| 109 | 109 | ||
| 110 | |||
| 111 | void | ||
| 112 | check_ns (void) | ||
| 113 | { | ||
| 114 | if (NSApp == nil) | ||
| 115 | error ("OpenStep is not in use or not initialized"); | ||
| 116 | } | ||
| 117 | |||
| 118 | |||
| 119 | /* Nonzero if we can use mouse menus. */ | ||
| 120 | int | ||
| 121 | have_menus_p (void) | ||
| 122 | { | ||
| 123 | return NSApp != nil; | ||
| 124 | } | ||
| 125 | |||
| 126 | |||
| 127 | /* Extract a frame as a FRAME_PTR, defaulting to the selected frame | ||
| 128 | and checking validity for NS. */ | ||
| 129 | static FRAME_PTR | ||
| 130 | check_ns_frame (Lisp_Object frame) | ||
| 131 | { | ||
| 132 | FRAME_PTR f; | ||
| 133 | |||
| 134 | if (NILP (frame)) | ||
| 135 | f = SELECTED_FRAME (); | ||
| 136 | else | ||
| 137 | { | ||
| 138 | CHECK_LIVE_FRAME (frame); | ||
| 139 | f = XFRAME (frame); | ||
| 140 | } | ||
| 141 | if (! FRAME_NS_P (f)) | ||
| 142 | error ("non-Nextstep frame used"); | ||
| 143 | return f; | ||
| 144 | } | ||
| 145 | |||
| 146 | |||
| 147 | /* Let the user specify an Nextstep display with a frame. | 110 | /* Let the user specify an Nextstep display with a frame. |
| 148 | nil stands for the selected frame--or, if that is not an Nextstep frame, | 111 | nil stands for the selected frame--or, if that is not an Nextstep frame, |
| 149 | the first Nextstep display on the list. */ | 112 | the first Nextstep display on the list. */ |
| @@ -619,7 +582,7 @@ ns_set_name_as_filename (struct frame *f) | |||
| 619 | { | 582 | { |
| 620 | NSView *view; | 583 | NSView *view; |
| 621 | Lisp_Object name, filename; | 584 | Lisp_Object name, filename; |
| 622 | Lisp_Object buf = XWINDOW (f->selected_window)->buffer; | 585 | Lisp_Object buf = XWINDOW (f->selected_window)->contents; |
| 623 | const char *title; | 586 | const char *title; |
| 624 | NSAutoreleasePool *pool; | 587 | NSAutoreleasePool *pool; |
| 625 | struct gcpro gcpro1; | 588 | struct gcpro gcpro1; |
| @@ -1145,8 +1108,6 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1145 | Lisp_Object tfont, tfontsize; | 1108 | Lisp_Object tfont, tfontsize; |
| 1146 | static int desc_ctr = 1; | 1109 | static int desc_ctr = 1; |
| 1147 | 1110 | ||
| 1148 | check_ns (); | ||
| 1149 | |||
| 1150 | /* x_get_arg modifies parms. */ | 1111 | /* x_get_arg modifies parms. */ |
| 1151 | parms = Fcopy_alist (parms); | 1112 | parms = Fcopy_alist (parms); |
| 1152 | 1113 | ||
| @@ -1418,7 +1379,7 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, | |||
| 1418 | FRAME nil means use the selected frame. */) | 1379 | FRAME nil means use the selected frame. */) |
| 1419 | (Lisp_Object frame) | 1380 | (Lisp_Object frame) |
| 1420 | { | 1381 | { |
| 1421 | struct frame *f = check_ns_frame (frame); | 1382 | struct frame *f = decode_window_system_frame (frame); |
| 1422 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); | 1383 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); |
| 1423 | 1384 | ||
| 1424 | if (dpyinfo->x_focus_frame != f) | 1385 | if (dpyinfo->x_focus_frame != f) |
| @@ -1439,18 +1400,8 @@ DEFUN ("ns-popup-font-panel", Fns_popup_font_panel, Sns_popup_font_panel, | |||
| 1439 | doc: /* Pop up the font panel. */) | 1400 | doc: /* Pop up the font panel. */) |
| 1440 | (Lisp_Object frame) | 1401 | (Lisp_Object frame) |
| 1441 | { | 1402 | { |
| 1442 | id fm; | 1403 | struct frame *f = decode_window_system_frame (frame); |
| 1443 | struct frame *f; | 1404 | id fm = [NSFontManager sharedFontManager]; |
| 1444 | |||
| 1445 | check_ns (); | ||
| 1446 | fm = [NSFontManager sharedFontManager]; | ||
| 1447 | if (NILP (frame)) | ||
| 1448 | f = SELECTED_FRAME (); | ||
| 1449 | else | ||
| 1450 | { | ||
| 1451 | CHECK_FRAME (frame); | ||
| 1452 | f = XFRAME (frame); | ||
| 1453 | } | ||
| 1454 | 1405 | ||
| 1455 | [fm setSelectedFont: ((struct nsfont_info *)f->output_data.ns->font)->nsfont | 1406 | [fm setSelectedFont: ((struct nsfont_info *)f->output_data.ns->font)->nsfont |
| 1456 | isMultiple: NO]; | 1407 | isMultiple: NO]; |
| @@ -1464,17 +1415,7 @@ DEFUN ("ns-popup-color-panel", Fns_popup_color_panel, Sns_popup_color_panel, | |||
| 1464 | doc: /* Pop up the color panel. */) | 1415 | doc: /* Pop up the color panel. */) |
| 1465 | (Lisp_Object frame) | 1416 | (Lisp_Object frame) |
| 1466 | { | 1417 | { |
| 1467 | struct frame *f; | 1418 | check_window_system (NULL); |
| 1468 | |||
| 1469 | check_ns (); | ||
| 1470 | if (NILP (frame)) | ||
| 1471 | f = SELECTED_FRAME (); | ||
| 1472 | else | ||
| 1473 | { | ||
| 1474 | CHECK_FRAME (frame); | ||
| 1475 | f = XFRAME (frame); | ||
| 1476 | } | ||
| 1477 | |||
| 1478 | [NSApp orderFrontColorPanel: NSApp]; | 1419 | [NSApp orderFrontColorPanel: NSApp]; |
| 1479 | return Qnil; | 1420 | return Qnil; |
| 1480 | } | 1421 | } |
| @@ -1503,7 +1444,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories. */) | |||
| 1503 | NSString *initS = NILP (init) || !STRINGP (init) ? nil : | 1444 | NSString *initS = NILP (init) || !STRINGP (init) ? nil : |
| 1504 | [NSString stringWithUTF8String: SSDATA (init)]; | 1445 | [NSString stringWithUTF8String: SSDATA (init)]; |
| 1505 | 1446 | ||
| 1506 | check_ns (); | 1447 | check_window_system (NULL); |
| 1507 | 1448 | ||
| 1508 | if (fileDelegate == nil) | 1449 | if (fileDelegate == nil) |
| 1509 | fileDelegate = [EmacsFileDelegate new]; | 1450 | fileDelegate = [EmacsFileDelegate new]; |
| @@ -1594,11 +1535,10 @@ If OWNER is nil, Emacs is assumed. */) | |||
| 1594 | { | 1535 | { |
| 1595 | const char *value; | 1536 | const char *value; |
| 1596 | 1537 | ||
| 1597 | check_ns (); | 1538 | check_window_system (NULL); |
| 1598 | if (NILP (owner)) | 1539 | if (NILP (owner)) |
| 1599 | owner = build_string([ns_app_name UTF8String]); | 1540 | owner = build_string([ns_app_name UTF8String]); |
| 1600 | CHECK_STRING (name); | 1541 | CHECK_STRING (name); |
| 1601 | /*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SSDATA (name)); */ | ||
| 1602 | 1542 | ||
| 1603 | value = ns_get_defaults_value (SSDATA (name)); | 1543 | value = ns_get_defaults_value (SSDATA (name)); |
| 1604 | 1544 | ||
| @@ -1614,7 +1554,7 @@ If OWNER is nil, Emacs is assumed. | |||
| 1614 | If VALUE is nil, the default is removed. */) | 1554 | If VALUE is nil, the default is removed. */) |
| 1615 | (Lisp_Object owner, Lisp_Object name, Lisp_Object value) | 1555 | (Lisp_Object owner, Lisp_Object name, Lisp_Object value) |
| 1616 | { | 1556 | { |
| 1617 | check_ns (); | 1557 | check_window_system (NULL); |
| 1618 | if (NILP (owner)) | 1558 | if (NILP (owner)) |
| 1619 | owner = build_string ([ns_app_name UTF8String]); | 1559 | owner = build_string ([ns_app_name UTF8String]); |
| 1620 | CHECK_STRING (name); | 1560 | CHECK_STRING (name); |
| @@ -1642,7 +1582,7 @@ DEFUN ("x-server-max-request-size", Fx_server_max_request_size, | |||
| 1642 | doc: /* This function is a no-op. It is only present for completeness. */) | 1582 | doc: /* This function is a no-op. It is only present for completeness. */) |
| 1643 | (Lisp_Object display) | 1583 | (Lisp_Object display) |
| 1644 | { | 1584 | { |
| 1645 | check_ns (); | 1585 | check_ns_display_info (display); |
| 1646 | /* This function has no real equivalent under NeXTstep. Return nil to | 1586 | /* This function has no real equivalent under NeXTstep. Return nil to |
| 1647 | indicate this. */ | 1587 | indicate this. */ |
| 1648 | return Qnil; | 1588 | return Qnil; |
| @@ -1692,7 +1632,7 @@ If omitted or nil, the selected frame's display is used. */) | |||
| 1692 | { | 1632 | { |
| 1693 | int num; | 1633 | int num; |
| 1694 | 1634 | ||
| 1695 | check_ns (); | 1635 | check_ns_display_info (display); |
| 1696 | num = [[NSScreen screens] count]; | 1636 | num = [[NSScreen screens] count]; |
| 1697 | 1637 | ||
| 1698 | return (num != 0) ? make_number (num) : Qnil; | 1638 | return (num != 0) ? make_number (num) : Qnil; |
| @@ -1706,7 +1646,7 @@ DISPLAY should be a frame, the display name as a string, or a terminal ID. | |||
| 1706 | If omitted or nil, the selected frame's display is used. */) | 1646 | If omitted or nil, the selected frame's display is used. */) |
| 1707 | (Lisp_Object display) | 1647 | (Lisp_Object display) |
| 1708 | { | 1648 | { |
| 1709 | check_ns (); | 1649 | check_ns_display_info (display); |
| 1710 | return make_number ((int) | 1650 | return make_number ((int) |
| 1711 | ([ns_get_screen (display) frame].size.height/(92.0/25.4))); | 1651 | ([ns_get_screen (display) frame].size.height/(92.0/25.4))); |
| 1712 | } | 1652 | } |
| @@ -1719,7 +1659,7 @@ DISPLAY should be a frame, the display name as a string, or a terminal ID. | |||
| 1719 | If omitted or nil, the selected frame's display is used. */) | 1659 | If omitted or nil, the selected frame's display is used. */) |
| 1720 | (Lisp_Object display) | 1660 | (Lisp_Object display) |
| 1721 | { | 1661 | { |
| 1722 | check_ns (); | 1662 | check_ns_display_info (display); |
| 1723 | return make_number ((int) | 1663 | return make_number ((int) |
| 1724 | ([ns_get_screen (display) frame].size.width/(92.0/25.4))); | 1664 | ([ns_get_screen (display) frame].size.width/(92.0/25.4))); |
| 1725 | } | 1665 | } |
| @@ -1733,7 +1673,7 @@ DISPLAY should be a frame, the display name as a string, or a terminal ID. | |||
| 1733 | If omitted or nil, the selected frame's display is used. */) | 1673 | If omitted or nil, the selected frame's display is used. */) |
| 1734 | (Lisp_Object display) | 1674 | (Lisp_Object display) |
| 1735 | { | 1675 | { |
| 1736 | check_ns (); | 1676 | check_ns_display_info (display); |
| 1737 | switch ([ns_get_window (display) backingType]) | 1677 | switch ([ns_get_window (display) backingType]) |
| 1738 | { | 1678 | { |
| 1739 | case NSBackingStoreBuffered: | 1679 | case NSBackingStoreBuffered: |
| @@ -1759,7 +1699,8 @@ If omitted or nil, the selected frame's display is used. */) | |||
| 1759 | (Lisp_Object display) | 1699 | (Lisp_Object display) |
| 1760 | { | 1700 | { |
| 1761 | NSWindowDepth depth; | 1701 | NSWindowDepth depth; |
| 1762 | check_ns (); | 1702 | |
| 1703 | check_ns_display_info (display); | ||
| 1763 | depth = [ns_get_screen (display) depth]; | 1704 | depth = [ns_get_screen (display) depth]; |
| 1764 | 1705 | ||
| 1765 | if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)) | 1706 | if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)) |
| @@ -1786,7 +1727,7 @@ DISPLAY should be a frame, the display name as a string, or a terminal ID. | |||
| 1786 | If omitted or nil, the selected frame's display is used. */) | 1727 | If omitted or nil, the selected frame's display is used. */) |
| 1787 | (Lisp_Object display) | 1728 | (Lisp_Object display) |
| 1788 | { | 1729 | { |
| 1789 | check_ns (); | 1730 | check_ns_display_info (display); |
| 1790 | switch ([ns_get_window (display) backingType]) | 1731 | switch ([ns_get_window (display) backingType]) |
| 1791 | { | 1732 | { |
| 1792 | case NSBackingStoreBuffered: | 1733 | case NSBackingStoreBuffered: |
| @@ -1836,11 +1777,10 @@ terminate Emacs if we can't open the connection. | |||
| 1836 | DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, | 1777 | DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, |
| 1837 | 1, 1, 0, | 1778 | 1, 1, 0, |
| 1838 | doc: /* Close the connection to the current Nextstep display server. | 1779 | doc: /* Close the connection to the current Nextstep display server. |
| 1839 | The argument DISPLAY is currently ignored. */) | 1780 | DISPLAY should be a frame, the display name as a string, or a terminal ID. */) |
| 1840 | (Lisp_Object display) | 1781 | (Lisp_Object display) |
| 1841 | { | 1782 | { |
| 1842 | check_ns (); | 1783 | check_ns_display_info (display); |
| 1843 | /*ns_delete_terminal (dpyinfo->terminal); */ | ||
| 1844 | [NSApp terminate: NSApp]; | 1784 | [NSApp terminate: NSApp]; |
| 1845 | return Qnil; | 1785 | return Qnil; |
| 1846 | } | 1786 | } |
| @@ -1865,7 +1805,7 @@ DEFUN ("ns-hide-others", Fns_hide_others, Sns_hide_others, | |||
| 1865 | doc: /* Hides all applications other than Emacs. */) | 1805 | doc: /* Hides all applications other than Emacs. */) |
| 1866 | (void) | 1806 | (void) |
| 1867 | { | 1807 | { |
| 1868 | check_ns (); | 1808 | check_window_system (NULL); |
| 1869 | [NSApp hideOtherApplications: NSApp]; | 1809 | [NSApp hideOtherApplications: NSApp]; |
| 1870 | return Qnil; | 1810 | return Qnil; |
| 1871 | } | 1811 | } |
| @@ -1878,7 +1818,7 @@ If ON is equal to `activate', Emacs is unhidden and becomes | |||
| 1878 | the active application. */) | 1818 | the active application. */) |
| 1879 | (Lisp_Object on) | 1819 | (Lisp_Object on) |
| 1880 | { | 1820 | { |
| 1881 | check_ns (); | 1821 | check_window_system (NULL); |
| 1882 | if (EQ (on, intern ("activate"))) | 1822 | if (EQ (on, intern ("activate"))) |
| 1883 | { | 1823 | { |
| 1884 | [NSApp unhide: NSApp]; | 1824 | [NSApp unhide: NSApp]; |
| @@ -1897,7 +1837,7 @@ DEFUN ("ns-emacs-info-panel", Fns_emacs_info_panel, Sns_emacs_info_panel, | |||
| 1897 | doc: /* Shows the 'Info' or 'About' panel for Emacs. */) | 1837 | doc: /* Shows the 'Info' or 'About' panel for Emacs. */) |
| 1898 | (void) | 1838 | (void) |
| 1899 | { | 1839 | { |
| 1900 | check_ns (); | 1840 | check_window_system (NULL); |
| 1901 | [NSApp orderFrontStandardAboutPanel: nil]; | 1841 | [NSApp orderFrontStandardAboutPanel: nil]; |
| 1902 | return Qnil; | 1842 | return Qnil; |
| 1903 | } | 1843 | } |
| @@ -1975,7 +1915,7 @@ DEFUN ("ns-list-services", Fns_list_services, Sns_list_services, 0, 0, 0, | |||
| 1975 | NSMenu *svcs; | 1915 | NSMenu *svcs; |
| 1976 | id delegate; | 1916 | id delegate; |
| 1977 | 1917 | ||
| 1978 | check_ns (); | 1918 | check_window_system (NULL); |
| 1979 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; | 1919 | svcs = [[NSMenu alloc] initWithTitle: @"Services"]; |
| 1980 | [NSApp setServicesMenu: svcs]; | 1920 | [NSApp setServicesMenu: svcs]; |
| 1981 | [NSApp registerServicesMenuSendTypes: ns_send_types | 1921 | [NSApp registerServicesMenuSendTypes: ns_send_types |
| @@ -2028,7 +1968,7 @@ there was no result. */) | |||
| 2028 | char *utfStr; | 1968 | char *utfStr; |
| 2029 | 1969 | ||
| 2030 | CHECK_STRING (service); | 1970 | CHECK_STRING (service); |
| 2031 | check_ns (); | 1971 | check_window_system (NULL); |
| 2032 | 1972 | ||
| 2033 | utfStr = SSDATA (service); | 1973 | utfStr = SSDATA (service); |
| 2034 | svcName = [NSString stringWithUTF8String: utfStr]; | 1974 | svcName = [NSString stringWithUTF8String: utfStr]; |
| @@ -2152,7 +2092,7 @@ In case the execution fails, an error is signaled. */) | |||
| 2152 | NSEvent *nxev; | 2092 | NSEvent *nxev; |
| 2153 | 2093 | ||
| 2154 | CHECK_STRING (script); | 2094 | CHECK_STRING (script); |
| 2155 | check_ns (); | 2095 | check_window_system (NULL); |
| 2156 | 2096 | ||
| 2157 | block_input (); | 2097 | block_input (); |
| 2158 | 2098 | ||
| @@ -2201,15 +2141,6 @@ In case the execution fails, an error is signaled. */) | |||
| 2201 | 2141 | ||
| 2202 | ========================================================================== */ | 2142 | ========================================================================== */ |
| 2203 | 2143 | ||
| 2204 | |||
| 2205 | /* called from image.c */ | ||
| 2206 | FRAME_PTR | ||
| 2207 | check_x_frame (Lisp_Object frame) | ||
| 2208 | { | ||
| 2209 | return check_ns_frame (frame); | ||
| 2210 | } | ||
| 2211 | |||
| 2212 | |||
| 2213 | /* called from frame.c */ | 2144 | /* called from frame.c */ |
| 2214 | struct ns_display_info * | 2145 | struct ns_display_info * |
| 2215 | check_x_display_info (Lisp_Object frame) | 2146 | check_x_display_info (Lisp_Object frame) |
| @@ -2235,7 +2166,7 @@ x_get_string_resource (XrmDatabase rdb, char *name, char *class) | |||
| 2235 | /* remove appname prefix; TODO: allow for !="Emacs" */ | 2166 | /* remove appname prefix; TODO: allow for !="Emacs" */ |
| 2236 | char *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0); | 2167 | char *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0); |
| 2237 | const char *res; | 2168 | const char *res; |
| 2238 | check_ns (); | 2169 | check_window_system (NULL); |
| 2239 | 2170 | ||
| 2240 | if (inhibit_x_resources) | 2171 | if (inhibit_x_resources) |
| 2241 | /* --quick was passed, so this is a no-op. */ | 2172 | /* --quick was passed, so this is a no-op. */ |
| @@ -2305,7 +2236,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, | |||
| 2305 | (Lisp_Object color, Lisp_Object frame) | 2236 | (Lisp_Object color, Lisp_Object frame) |
| 2306 | { | 2237 | { |
| 2307 | NSColor * col; | 2238 | NSColor * col; |
| 2308 | check_ns (); | 2239 | check_window_system (NULL); |
| 2309 | return ns_lisp_to_color (color, &col) ? Qnil : Qt; | 2240 | return ns_lisp_to_color (color, &col) ? Qnil : Qt; |
| 2310 | } | 2241 | } |
| 2311 | 2242 | ||
| @@ -2317,7 +2248,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | |||
| 2317 | NSColor * col; | 2248 | NSColor * col; |
| 2318 | CGFloat red, green, blue, alpha; | 2249 | CGFloat red, green, blue, alpha; |
| 2319 | 2250 | ||
| 2320 | check_ns (); | 2251 | check_window_system (NULL); |
| 2321 | CHECK_STRING (color); | 2252 | CHECK_STRING (color); |
| 2322 | 2253 | ||
| 2323 | if (ns_lisp_to_color (color, &col)) | 2254 | if (ns_lisp_to_color (color, &col)) |
| @@ -2336,7 +2267,8 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, | |||
| 2336 | { | 2267 | { |
| 2337 | NSWindowDepth depth; | 2268 | NSWindowDepth depth; |
| 2338 | NSString *colorSpace; | 2269 | NSString *colorSpace; |
| 2339 | check_ns (); | 2270 | |
| 2271 | check_ns_display_info (display); | ||
| 2340 | depth = [ns_get_screen (display) depth]; | 2272 | depth = [ns_get_screen (display) depth]; |
| 2341 | colorSpace = NSColorSpaceFromDepth (depth); | 2273 | colorSpace = NSColorSpaceFromDepth (depth); |
| 2342 | 2274 | ||
| @@ -2356,7 +2288,8 @@ If omitted or nil, that stands for the selected frame's display. */) | |||
| 2356 | (Lisp_Object display) | 2288 | (Lisp_Object display) |
| 2357 | { | 2289 | { |
| 2358 | NSWindowDepth depth; | 2290 | NSWindowDepth depth; |
| 2359 | check_ns (); | 2291 | |
| 2292 | check_ns_display_info (display); | ||
| 2360 | depth = [ns_get_screen (display) depth]; | 2293 | depth = [ns_get_screen (display) depth]; |
| 2361 | 2294 | ||
| 2362 | return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil; | 2295 | return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil; |
| @@ -2371,7 +2304,7 @@ DISPLAY should be either a frame, a display name (a string), or terminal ID. | |||
| 2371 | If omitted or nil, that stands for the selected frame's display. */) | 2304 | If omitted or nil, that stands for the selected frame's display. */) |
| 2372 | (Lisp_Object display) | 2305 | (Lisp_Object display) |
| 2373 | { | 2306 | { |
| 2374 | check_ns (); | 2307 | check_ns_display_info (display); |
| 2375 | return make_number ((int) [ns_get_screen (display) frame].size.width); | 2308 | return make_number ((int) [ns_get_screen (display) frame].size.width); |
| 2376 | } | 2309 | } |
| 2377 | 2310 | ||
| @@ -2384,7 +2317,7 @@ DISPLAY should be either a frame, a display name (a string), or terminal ID. | |||
| 2384 | If omitted or nil, that stands for the selected frame's display. */) | 2317 | If omitted or nil, that stands for the selected frame's display. */) |
| 2385 | (Lisp_Object display) | 2318 | (Lisp_Object display) |
| 2386 | { | 2319 | { |
| 2387 | check_ns (); | 2320 | check_ns_display_info (display); |
| 2388 | return make_number ((int) [ns_get_screen (display) frame].size.height); | 2321 | return make_number ((int) [ns_get_screen (display) frame].size.height); |
| 2389 | } | 2322 | } |
| 2390 | 2323 | ||
| @@ -2404,7 +2337,7 @@ that stands for the selected frame's display. */) | |||
| 2404 | NSScreen *screen; | 2337 | NSScreen *screen; |
| 2405 | NSRect vScreen; | 2338 | NSRect vScreen; |
| 2406 | 2339 | ||
| 2407 | check_ns (); | 2340 | check_ns_display_info (display); |
| 2408 | screen = ns_get_screen (display); | 2341 | screen = ns_get_screen (display); |
| 2409 | if (!screen) | 2342 | if (!screen) |
| 2410 | return Qnil; | 2343 | return Qnil; |
| @@ -2428,7 +2361,7 @@ DISPLAY should be either a frame, a display name (a string), or terminal ID. | |||
| 2428 | If omitted or nil, that stands for the selected frame's display. */) | 2361 | If omitted or nil, that stands for the selected frame's display. */) |
| 2429 | (Lisp_Object display) | 2362 | (Lisp_Object display) |
| 2430 | { | 2363 | { |
| 2431 | check_ns (); | 2364 | check_ns_display_info (display); |
| 2432 | return make_number | 2365 | return make_number |
| 2433 | (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth])); | 2366 | (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth])); |
| 2434 | } | 2367 | } |
| @@ -2442,10 +2375,7 @@ DISPLAY should be either a frame, a display name (a string), or terminal ID. | |||
| 2442 | If omitted or nil, that stands for the selected frame's display. */) | 2375 | If omitted or nil, that stands for the selected frame's display. */) |
| 2443 | (Lisp_Object display) | 2376 | (Lisp_Object display) |
| 2444 | { | 2377 | { |
| 2445 | struct ns_display_info *dpyinfo; | 2378 | struct ns_display_info *dpyinfo = check_ns_display_info (display); |
| 2446 | check_ns (); | ||
| 2447 | |||
| 2448 | dpyinfo = check_ns_display_info (display); | ||
| 2449 | /* We force 24+ bit depths to 24-bit to prevent an overflow. */ | 2379 | /* We force 24+ bit depths to 24-bit to prevent an overflow. */ |
| 2450 | return make_number (1 << min (dpyinfo->n_planes, 24)); | 2380 | return make_number (1 << min (dpyinfo->n_planes, 24)); |
| 2451 | } | 2381 | } |
| @@ -2558,7 +2488,7 @@ Text larger than the specified size is clipped. */) | |||
| 2558 | 2488 | ||
| 2559 | CHECK_STRING (string); | 2489 | CHECK_STRING (string); |
| 2560 | str = SSDATA (string); | 2490 | str = SSDATA (string); |
| 2561 | f = check_x_frame (frame); | 2491 | f = decode_window_system_frame (frame); |
| 2562 | if (NILP (timeout)) | 2492 | if (NILP (timeout)) |
| 2563 | timeout = make_number (5); | 2493 | timeout = make_number (5); |
| 2564 | else | 2494 | else |
| @@ -2787,9 +2717,6 @@ be used as the image of the icon representing the frame. */); | |||
| 2787 | defsubr (&Sx_show_tip); | 2717 | defsubr (&Sx_show_tip); |
| 2788 | defsubr (&Sx_hide_tip); | 2718 | defsubr (&Sx_hide_tip); |
| 2789 | 2719 | ||
| 2790 | /* used only in fontset.c */ | ||
| 2791 | check_window_system_func = check_ns; | ||
| 2792 | |||
| 2793 | as_status = 0; | 2720 | as_status = 0; |
| 2794 | as_script = Qnil; | 2721 | as_script = Qnil; |
| 2795 | as_result = 0; | 2722 | as_result = 0; |
diff --git a/src/nsmenu.m b/src/nsmenu.m index 22ff4dd0b53..648b568d180 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -88,14 +88,6 @@ static int trackingMenu; | |||
| 88 | ========================================================================== */ | 88 | ========================================================================== */ |
| 89 | 89 | ||
| 90 | 90 | ||
| 91 | /* FIXME: not currently used, but should normalize with other terms. */ | ||
| 92 | void | ||
| 93 | x_activate_menubar (struct frame *f) | ||
| 94 | { | ||
| 95 | fprintf (stderr, "XXX: Received x_activate_menubar event.\n"); | ||
| 96 | } | ||
| 97 | |||
| 98 | |||
| 99 | /* Supposed to discard menubar and free storage. Since we share the | 91 | /* Supposed to discard menubar and free storage. Since we share the |
| 100 | menubar among frames and update its context for the focused window, | 92 | menubar among frames and update its context for the focused window, |
| 101 | there is nothing to do here. */ | 93 | there is nothing to do here. */ |
| @@ -138,7 +130,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 138 | long t; | 130 | long t; |
| 139 | #endif | 131 | #endif |
| 140 | 132 | ||
| 141 | NSTRACE (set_frame_menubar); | 133 | NSTRACE (ns_update_menubar); |
| 142 | 134 | ||
| 143 | if (f != SELECTED_FRAME ()) | 135 | if (f != SELECTED_FRAME ()) |
| 144 | return; | 136 | return; |
| @@ -191,7 +183,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) | |||
| 191 | = alloca (previous_menu_items_used * sizeof *previous_items); | 183 | = alloca (previous_menu_items_used * sizeof *previous_items); |
| 192 | 184 | ||
| 193 | /* lisp preliminaries */ | 185 | /* lisp preliminaries */ |
| 194 | buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; | 186 | buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents; |
| 195 | specbind (Qinhibit_quit, Qt); | 187 | specbind (Qinhibit_quit, Qt); |
| 196 | specbind (Qdebug_on_next_call, Qnil); | 188 | specbind (Qdebug_on_next_call, Qnil); |
| 197 | record_unwind_save_match_data (); | 189 | record_unwind_save_match_data (); |
| @@ -512,6 +504,29 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | |||
| 512 | ns_update_menubar (f, deep_p, nil); | 504 | ns_update_menubar (f, deep_p, nil); |
| 513 | } | 505 | } |
| 514 | 506 | ||
| 507 | void | ||
| 508 | x_activate_menubar (struct frame *f) | ||
| 509 | { | ||
| 510 | NSArray *a = [[NSApp mainMenu] itemArray]; | ||
| 511 | /* Update each submenu separately so ns_update_menubar doesn't reset | ||
| 512 | the delegate. */ | ||
| 513 | int i = 0; | ||
| 514 | while (i < [a count]) | ||
| 515 | { | ||
| 516 | EmacsMenu *menu = (EmacsMenu *)[[a objectAtIndex:i] submenu]; | ||
| 517 | const char *title = [[menu title] UTF8String]; | ||
| 518 | if (strcmp (title, ns_get_pending_menu_title ()) == 0) | ||
| 519 | { | ||
| 520 | ns_update_menubar (f, true, menu); | ||
| 521 | break; | ||
| 522 | } | ||
| 523 | ++i; | ||
| 524 | } | ||
| 525 | ns_check_pending_open_menu (); | ||
| 526 | } | ||
| 527 | |||
| 528 | |||
| 529 | |||
| 515 | 530 | ||
| 516 | /* ========================================================================== | 531 | /* ========================================================================== |
| 517 | 532 | ||
| @@ -564,6 +579,14 @@ extern NSString *NSMenuDidBeginTrackingNotification; | |||
| 564 | trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification | 579 | trackingMenu = ([notification name] == NSMenuDidBeginTrackingNotification |
| 565 | ? 1 : 0); | 580 | ? 1 : 0); |
| 566 | } | 581 | } |
| 582 | |||
| 583 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | ||
| 584 | - (void)menuWillOpen:(NSMenu *)menu | ||
| 585 | { | ||
| 586 | ns_check_menu_open (menu); | ||
| 587 | } | ||
| 588 | #endif | ||
| 589 | |||
| 567 | #endif | 590 | #endif |
| 568 | 591 | ||
| 569 | /* delegate method called when a submenu is being opened: run a 'deep' call | 592 | /* delegate method called when a submenu is being opened: run a 'deep' call |
| @@ -591,7 +614,12 @@ extern NSString *NSMenuDidBeginTrackingNotification; | |||
| 591 | if (trackingMenu == 0) | 614 | if (trackingMenu == 0) |
| 592 | return; | 615 | return; |
| 593 | /*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */ | 616 | /*fprintf (stderr, "Updating menu '%s'\n", [[self title] UTF8String]); NSLog (@"%@\n", event); */ |
| 594 | ns_update_menubar (frame, 1, self); | 617 | #if ! defined(NS_IMPL_COCOA) || \ |
| 618 | MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 | ||
| 619 | /* Don't know how to do this for anything other than OSX >= 10.5 | ||
| 620 | This is wrong, as it might run Lisp code in the event loop. */ | ||
| 621 | ns_update_menubar (frame, true, self); | ||
| 622 | #endif | ||
| 595 | } | 623 | } |
| 596 | 624 | ||
| 597 | 625 | ||
| @@ -1300,6 +1328,7 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 1300 | wr.size = [textField frame].size; | 1328 | wr.size = [textField frame].size; |
| 1301 | 1329 | ||
| 1302 | [win setFrame: wr display: YES]; | 1330 | [win setFrame: wr display: YES]; |
| 1331 | [win setLevel: NSPopUpMenuWindowLevel]; | ||
| 1303 | [win orderFront: self]; | 1332 | [win orderFront: self]; |
| 1304 | [win display]; | 1333 | [win display]; |
| 1305 | timer = [NSTimer scheduledTimerWithTimeInterval: (float)seconds target: self | 1334 | timer = [NSTimer scheduledTimerWithTimeInterval: (float)seconds target: self |
| @@ -1380,8 +1409,6 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1380 | 1409 | ||
| 1381 | NSTRACE (x-popup-dialog); | 1410 | NSTRACE (x-popup-dialog); |
| 1382 | 1411 | ||
| 1383 | check_ns (); | ||
| 1384 | |||
| 1385 | isQ = NILP (header); | 1412 | isQ = NILP (header); |
| 1386 | 1413 | ||
| 1387 | if (EQ (position, Qt) | 1414 | if (EQ (position, Qt) |
| @@ -1419,6 +1446,8 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1419 | else | 1446 | else |
| 1420 | CHECK_WINDOW (window); | 1447 | CHECK_WINDOW (window); |
| 1421 | 1448 | ||
| 1449 | check_window_system (f); | ||
| 1450 | |||
| 1422 | p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2; | 1451 | p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2; |
| 1423 | p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2; | 1452 | p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2; |
| 1424 | 1453 | ||
diff --git a/src/nsselect.m b/src/nsselect.m index 49380f87945..bb9eacd23cd 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -354,8 +354,7 @@ On Nextstep, FRAME is unused. */) | |||
| 354 | Lisp_Object successful_p = Qnil, rest; | 354 | Lisp_Object successful_p = Qnil, rest; |
| 355 | Lisp_Object target_symbol, data; | 355 | Lisp_Object target_symbol, data; |
| 356 | 356 | ||
| 357 | 357 | check_window_system (NULL); | |
| 358 | check_ns (); | ||
| 359 | CHECK_SYMBOL (selection); | 358 | CHECK_SYMBOL (selection); |
| 360 | if (NILP (value)) | 359 | if (NILP (value)) |
| 361 | error ("selection value may not be nil."); | 360 | error ("selection value may not be nil."); |
| @@ -409,7 +408,7 @@ On MS-DOS, all this does is return non-nil if we own the selection. */) | |||
| 409 | (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) | 408 | (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) |
| 410 | { | 409 | { |
| 411 | id pb; | 410 | id pb; |
| 412 | check_ns (); | 411 | check_window_system (NULL); |
| 413 | CHECK_SYMBOL (selection); | 412 | CHECK_SYMBOL (selection); |
| 414 | if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil; | 413 | if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil; |
| 415 | 414 | ||
| @@ -436,7 +435,7 @@ On Nextstep, TERMINAL is unused. */) | |||
| 436 | id pb; | 435 | id pb; |
| 437 | NSArray *types; | 436 | NSArray *types; |
| 438 | 437 | ||
| 439 | check_ns (); | 438 | check_window_system (NULL); |
| 440 | CHECK_SYMBOL (selection); | 439 | CHECK_SYMBOL (selection); |
| 441 | if (EQ (selection, Qnil)) selection = QPRIMARY; | 440 | if (EQ (selection, Qnil)) selection = QPRIMARY; |
| 442 | if (EQ (selection, Qt)) selection = QSECONDARY; | 441 | if (EQ (selection, Qt)) selection = QSECONDARY; |
| @@ -464,7 +463,7 @@ frame's display, or the first available X display. | |||
| 464 | On Nextstep, TERMINAL is unused. */) | 463 | On Nextstep, TERMINAL is unused. */) |
| 465 | (Lisp_Object selection, Lisp_Object terminal) | 464 | (Lisp_Object selection, Lisp_Object terminal) |
| 466 | { | 465 | { |
| 467 | check_ns (); | 466 | check_window_system (NULL); |
| 468 | CHECK_SYMBOL (selection); | 467 | CHECK_SYMBOL (selection); |
| 469 | if (EQ (selection, Qnil)) selection = QPRIMARY; | 468 | if (EQ (selection, Qnil)) selection = QPRIMARY; |
| 470 | if (EQ (selection, Qt)) selection = QSECONDARY; | 469 | if (EQ (selection, Qt)) selection = QSECONDARY; |
| @@ -492,7 +491,7 @@ On Nextstep, TIME-STAMP and TERMINAL are unused. */) | |||
| 492 | { | 491 | { |
| 493 | Lisp_Object val; | 492 | Lisp_Object val; |
| 494 | 493 | ||
| 495 | check_ns (); | 494 | check_window_system (NULL); |
| 496 | CHECK_SYMBOL (selection_name); | 495 | CHECK_SYMBOL (selection_name); |
| 497 | CHECK_SYMBOL (target_type); | 496 | CHECK_SYMBOL (target_type); |
| 498 | val = ns_get_local_selection (selection_name, target_type); | 497 | val = ns_get_local_selection (selection_name, target_type); |
| @@ -516,7 +515,7 @@ SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. */) | |||
| 516 | (Lisp_Object selection) | 515 | (Lisp_Object selection) |
| 517 | { | 516 | { |
| 518 | id pb; | 517 | id pb; |
| 519 | check_ns (); | 518 | check_window_system (NULL); |
| 520 | pb = ns_symbol_to_pb (selection); | 519 | pb = ns_symbol_to_pb (selection); |
| 521 | return pb != nil ? ns_string_from_pasteboard (pb) : Qnil; | 520 | return pb != nil ? ns_string_from_pasteboard (pb) : Qnil; |
| 522 | } | 521 | } |
| @@ -529,7 +528,7 @@ SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. */) | |||
| 529 | (Lisp_Object selection, Lisp_Object string) | 528 | (Lisp_Object selection, Lisp_Object string) |
| 530 | { | 529 | { |
| 531 | id pb; | 530 | id pb; |
| 532 | check_ns (); | 531 | check_window_system (NULL); |
| 533 | pb = ns_symbol_to_pb (selection); | 532 | pb = ns_symbol_to_pb (selection); |
| 534 | if (pb != nil) ns_string_to_pasteboard (pb, string); | 533 | if (pb != nil) ns_string_to_pasteboard (pb, string); |
| 535 | return Qnil; | 534 | return Qnil; |
diff --git a/src/nsterm.h b/src/nsterm.h index 6bd04b96684..07cfc2e022e 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -577,8 +577,6 @@ extern Lisp_Object ns_display_name_list; | |||
| 577 | extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name); | 577 | extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name); |
| 578 | 578 | ||
| 579 | struct ns_display_info *check_x_display_info (Lisp_Object frame); | 579 | struct ns_display_info *check_x_display_info (Lisp_Object frame); |
| 580 | FRAME_PTR check_x_frame (Lisp_Object frame); | ||
| 581 | |||
| 582 | 580 | ||
| 583 | struct ns_output | 581 | struct ns_output |
| 584 | { | 582 | { |
| @@ -764,7 +762,6 @@ extern void ns_clear_frame (struct frame *f); | |||
| 764 | 762 | ||
| 765 | extern const char *ns_xlfd_to_fontname (const char *xlfd); | 763 | extern const char *ns_xlfd_to_fontname (const char *xlfd); |
| 766 | 764 | ||
| 767 | extern void check_ns (void); | ||
| 768 | extern Lisp_Object ns_map_event_to_object (void); | 765 | extern Lisp_Object ns_map_event_to_object (void); |
| 769 | #ifdef __OBJC__ | 766 | #ifdef __OBJC__ |
| 770 | extern Lisp_Object ns_string_from_pasteboard (id pb); | 767 | extern Lisp_Object ns_string_from_pasteboard (id pb); |
| @@ -792,6 +789,9 @@ extern int ns_lisp_to_color (Lisp_Object color, NSColor **col); | |||
| 792 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); | 789 | extern NSColor *ns_lookup_indexed_color (unsigned long idx, struct frame *f); |
| 793 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); | 790 | extern unsigned long ns_index_color (NSColor *color, struct frame *f); |
| 794 | extern void ns_free_indexed_color (unsigned long idx, struct frame *f); | 791 | extern void ns_free_indexed_color (unsigned long idx, struct frame *f); |
| 792 | extern const char *ns_get_pending_menu_title (); | ||
| 793 | extern void ns_check_menu_open (NSMenu *menu); | ||
| 794 | extern void ns_check_pending_open_menu (); | ||
| 795 | #endif | 795 | #endif |
| 796 | 796 | ||
| 797 | /* C access to ObjC functionality */ | 797 | /* C access to ObjC functionality */ |
diff --git a/src/nsterm.m b/src/nsterm.m index 40e506eab27..f5b48ee4b11 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -228,6 +228,25 @@ static struct { | |||
| 228 | NULL, 0, 0 | 228 | NULL, 0, 0 |
| 229 | }; | 229 | }; |
| 230 | 230 | ||
| 231 | /* | ||
| 232 | * State for pending menu activation: | ||
| 233 | * MENU_NONE Normal state | ||
| 234 | * MENU_PENDING A menu has been clicked on, but has been canceled so we can | ||
| 235 | * run lisp to update the menu. | ||
| 236 | * MENU_OPENING Menu is up to date, and the click event is redone so the menu | ||
| 237 | * will open. | ||
| 238 | */ | ||
| 239 | #define MENU_NONE 0 | ||
| 240 | #define MENU_PENDING 1 | ||
| 241 | #define MENU_OPENING 2 | ||
| 242 | static int menu_will_open_state = MENU_NONE; | ||
| 243 | |||
| 244 | /* Saved position for menu click. */ | ||
| 245 | static CGPoint menu_mouse_point; | ||
| 246 | |||
| 247 | /* Title for the menu to open. */ | ||
| 248 | static char *menu_pending_title = 0; | ||
| 249 | |||
| 231 | /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ | 250 | /* Convert modifiers in a NeXTstep event to emacs style modifiers. */ |
| 232 | #define NS_FUNCTION_KEY_MASK 0x800000 | 251 | #define NS_FUNCTION_KEY_MASK 0x800000 |
| 233 | #define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) | 252 | #define NSLeftControlKeyMask (0x000001 | NSControlKeyMask) |
| @@ -993,8 +1012,9 @@ ns_raise_frame (struct frame *f) | |||
| 993 | Bring window to foreground and make it active | 1012 | Bring window to foreground and make it active |
| 994 | -------------------------------------------------------------------------- */ | 1013 | -------------------------------------------------------------------------- */ |
| 995 | { | 1014 | { |
| 996 | NSView *view = FRAME_NS_VIEW (f); | 1015 | NSView *view; |
| 997 | check_ns (); | 1016 | check_window_system (f); |
| 1017 | view = FRAME_NS_VIEW (f); | ||
| 998 | block_input (); | 1018 | block_input (); |
| 999 | if (FRAME_VISIBLE_P (f)) | 1019 | if (FRAME_VISIBLE_P (f)) |
| 1000 | [[view window] makeKeyAndOrderFront: NSApp]; | 1020 | [[view window] makeKeyAndOrderFront: NSApp]; |
| @@ -1008,8 +1028,9 @@ ns_lower_frame (struct frame *f) | |||
| 1008 | Send window to back | 1028 | Send window to back |
| 1009 | -------------------------------------------------------------------------- */ | 1029 | -------------------------------------------------------------------------- */ |
| 1010 | { | 1030 | { |
| 1011 | NSView *view = FRAME_NS_VIEW (f); | 1031 | NSView *view; |
| 1012 | check_ns (); | 1032 | check_window_system (f); |
| 1033 | view = FRAME_NS_VIEW (f); | ||
| 1013 | block_input (); | 1034 | block_input (); |
| 1014 | [[view window] orderBack: NSApp]; | 1035 | [[view window] orderBack: NSApp]; |
| 1015 | unblock_input (); | 1036 | unblock_input (); |
| @@ -1112,9 +1133,10 @@ x_make_frame_invisible (struct frame *f) | |||
| 1112 | External: Hide the window (X11 semantics) | 1133 | External: Hide the window (X11 semantics) |
| 1113 | -------------------------------------------------------------------------- */ | 1134 | -------------------------------------------------------------------------- */ |
| 1114 | { | 1135 | { |
| 1115 | NSView * view = FRAME_NS_VIEW (f); | 1136 | NSView *view; |
| 1116 | NSTRACE (x_make_frame_invisible); | 1137 | NSTRACE (x_make_frame_invisible); |
| 1117 | check_ns (); | 1138 | check_window_system (f); |
| 1139 | view = FRAME_NS_VIEW (f); | ||
| 1118 | [[view window] orderOut: NSApp]; | 1140 | [[view window] orderOut: NSApp]; |
| 1119 | SET_FRAME_VISIBLE (f, 0); | 1141 | SET_FRAME_VISIBLE (f, 0); |
| 1120 | SET_FRAME_ICONIFIED (f, 0); | 1142 | SET_FRAME_ICONIFIED (f, 0); |
| @@ -1127,10 +1149,13 @@ x_iconify_frame (struct frame *f) | |||
| 1127 | External: Iconify window | 1149 | External: Iconify window |
| 1128 | -------------------------------------------------------------------------- */ | 1150 | -------------------------------------------------------------------------- */ |
| 1129 | { | 1151 | { |
| 1130 | NSView * view = FRAME_NS_VIEW (f); | 1152 | NSView *view; |
| 1131 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); | 1153 | struct ns_display_info *dpyinfo; |
| 1154 | |||
| 1132 | NSTRACE (x_iconify_frame); | 1155 | NSTRACE (x_iconify_frame); |
| 1133 | check_ns (); | 1156 | check_window_system (f); |
| 1157 | view = FRAME_NS_VIEW (f); | ||
| 1158 | dpyinfo = FRAME_NS_DISPLAY_INFO (f); | ||
| 1134 | 1159 | ||
| 1135 | if (dpyinfo->x_highlight_frame == f) | 1160 | if (dpyinfo->x_highlight_frame == f) |
| 1136 | dpyinfo->x_highlight_frame = 0; | 1161 | dpyinfo->x_highlight_frame = 0; |
| @@ -1155,11 +1180,15 @@ x_iconify_frame (struct frame *f) | |||
| 1155 | void | 1180 | void |
| 1156 | x_free_frame_resources (struct frame *f) | 1181 | x_free_frame_resources (struct frame *f) |
| 1157 | { | 1182 | { |
| 1158 | NSView *view = FRAME_NS_VIEW (f); | 1183 | NSView *view; |
| 1159 | struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); | 1184 | struct ns_display_info *dpyinfo; |
| 1160 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 1185 | Mouse_HLInfo *hlinfo; |
| 1186 | |||
| 1161 | NSTRACE (x_free_frame_resources); | 1187 | NSTRACE (x_free_frame_resources); |
| 1162 | check_ns (); | 1188 | check_window_system (f); |
| 1189 | view = FRAME_NS_VIEW (f); | ||
| 1190 | dpyinfo = FRAME_NS_DISPLAY_INFO (f); | ||
| 1191 | hlinfo = MOUSE_HL_INFO (f); | ||
| 1163 | 1192 | ||
| 1164 | [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ | 1193 | [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ |
| 1165 | 1194 | ||
| @@ -1200,7 +1229,7 @@ x_destroy_window (struct frame *f) | |||
| 1200 | -------------------------------------------------------------------------- */ | 1229 | -------------------------------------------------------------------------- */ |
| 1201 | { | 1230 | { |
| 1202 | NSTRACE (x_destroy_window); | 1231 | NSTRACE (x_destroy_window); |
| 1203 | check_ns (); | 1232 | check_window_system (f); |
| 1204 | x_free_frame_resources (f); | 1233 | x_free_frame_resources (f); |
| 1205 | ns_window_num--; | 1234 | ns_window_num--; |
| 1206 | } | 1235 | } |
| @@ -1854,7 +1883,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 1854 | f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame | 1883 | f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame |
| 1855 | : SELECTED_FRAME (); | 1884 | : SELECTED_FRAME (); |
| 1856 | 1885 | ||
| 1857 | if (f && f->output_data.ns) /* TODO: 2nd check no longer needed? */ | 1886 | if (f && FRAME_NS_P (f)) |
| 1858 | { | 1887 | { |
| 1859 | view = FRAME_NS_VIEW (*fp); | 1888 | view = FRAME_NS_VIEW (*fp); |
| 1860 | 1889 | ||
| @@ -3388,6 +3417,77 @@ check_native_fs () | |||
| 3388 | } | 3417 | } |
| 3389 | #endif | 3418 | #endif |
| 3390 | 3419 | ||
| 3420 | const char * | ||
| 3421 | ns_get_pending_menu_title () | ||
| 3422 | { | ||
| 3423 | return menu_pending_title; | ||
| 3424 | } | ||
| 3425 | |||
| 3426 | /* Check if menu open should be cancelled or continued as normal. */ | ||
| 3427 | void | ||
| 3428 | ns_check_menu_open (NSMenu *menu) | ||
| 3429 | { | ||
| 3430 | /* GNUStep and OSX <= 10.4 does not have cancelTracking. */ | ||
| 3431 | #if defined(NS_IMPL_COCOA) && \ | ||
| 3432 | MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 | ||
| 3433 | |||
| 3434 | /* Click in menu bar? */ | ||
| 3435 | NSArray *a = [[NSApp mainMenu] itemArray]; | ||
| 3436 | int i; | ||
| 3437 | BOOL found = NO; | ||
| 3438 | for (i = 0; ! found && i < [a count]; i++) | ||
| 3439 | found = menu == [[a objectAtIndex:i] submenu]; | ||
| 3440 | if (found) | ||
| 3441 | { | ||
| 3442 | if (menu_will_open_state == MENU_NONE && emacs_event) | ||
| 3443 | { | ||
| 3444 | NSEvent *theEvent = [NSApp currentEvent]; | ||
| 3445 | struct frame *emacsframe = SELECTED_FRAME (); | ||
| 3446 | |||
| 3447 | [menu cancelTracking]; | ||
| 3448 | menu_will_open_state = MENU_PENDING; | ||
| 3449 | emacs_event->kind = MENU_BAR_ACTIVATE_EVENT; | ||
| 3450 | EV_TRAILER (theEvent); | ||
| 3451 | |||
| 3452 | CGEventRef ourEvent = CGEventCreate (NULL); | ||
| 3453 | menu_mouse_point = CGEventGetLocation (ourEvent); | ||
| 3454 | CFRelease (ourEvent); | ||
| 3455 | xfree (menu_pending_title); | ||
| 3456 | menu_pending_title = xstrdup ([[menu title] UTF8String]); | ||
| 3457 | } | ||
| 3458 | else if (menu_will_open_state == MENU_OPENING) | ||
| 3459 | { | ||
| 3460 | menu_will_open_state = MENU_NONE; | ||
| 3461 | } | ||
| 3462 | } | ||
| 3463 | #endif | ||
| 3464 | } | ||
| 3465 | |||
| 3466 | /* Redo saved menu click if state is MENU_PENDING. */ | ||
| 3467 | void | ||
| 3468 | ns_check_pending_open_menu () | ||
| 3469 | { | ||
| 3470 | #ifdef NS_IMPL_COCOA | ||
| 3471 | if (menu_will_open_state == MENU_PENDING) | ||
| 3472 | { | ||
| 3473 | CGEventSourceRef source | ||
| 3474 | = CGEventSourceCreate (kCGEventSourceStateHIDSystemState); | ||
| 3475 | |||
| 3476 | CGEventRef event = CGEventCreateMouseEvent (source, | ||
| 3477 | kCGEventLeftMouseDown, | ||
| 3478 | menu_mouse_point, | ||
| 3479 | kCGMouseButtonLeft); | ||
| 3480 | CGEventSetType (event, kCGEventLeftMouseDown); | ||
| 3481 | CGEventPost (kCGHIDEventTap, event); | ||
| 3482 | CFRelease (event); | ||
| 3483 | CFRelease (source); | ||
| 3484 | |||
| 3485 | menu_will_open_state = MENU_OPENING; | ||
| 3486 | } | ||
| 3487 | #endif | ||
| 3488 | } | ||
| 3489 | |||
| 3490 | |||
| 3391 | static int | 3491 | static int |
| 3392 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) | 3492 | ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) |
| 3393 | /* -------------------------------------------------------------------------- | 3493 | /* -------------------------------------------------------------------------- |
| @@ -6532,7 +6632,7 @@ not_in_argv (NSString *arg) | |||
| 6532 | { | 6632 | { |
| 6533 | Lisp_Object str = Qnil; | 6633 | Lisp_Object str = Qnil; |
| 6534 | struct frame *f = SELECTED_FRAME (); | 6634 | struct frame *f = SELECTED_FRAME (); |
| 6535 | struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer); | 6635 | struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->contents); |
| 6536 | 6636 | ||
| 6537 | if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) | 6637 | if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) |
| 6538 | return NSAccessibilityTextFieldRole; | 6638 | return NSAccessibilityTextFieldRole; |
diff --git a/src/print.c b/src/print.c index 8498a758a21..eb1f9cba82d 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1778,10 +1778,10 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1778 | strout ("#<window ", -1, -1, printcharfun); | 1778 | strout ("#<window ", -1, -1, printcharfun); |
| 1779 | len = sprintf (buf, "%p", XWINDOW (obj)); | 1779 | len = sprintf (buf, "%p", XWINDOW (obj)); |
| 1780 | strout (buf, len, len, printcharfun); | 1780 | strout (buf, len, len, printcharfun); |
| 1781 | if (!NILP (XWINDOW (obj)->buffer)) | 1781 | if (BUFFERP (XWINDOW (obj)->contents)) |
| 1782 | { | 1782 | { |
| 1783 | strout (" on ", -1, -1, printcharfun); | 1783 | strout (" on ", -1, -1, printcharfun); |
| 1784 | print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), | 1784 | print_string (BVAR (XBUFFER (XWINDOW (obj)->contents), name), |
| 1785 | printcharfun); | 1785 | printcharfun); |
| 1786 | } | 1786 | } |
| 1787 | PRINTCHAR ('>'); | 1787 | PRINTCHAR ('>'); |
diff --git a/src/process.c b/src/process.c index 6a14a536707..911a30bc808 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4236,7 +4236,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4236 | time_limit = 0; | 4236 | time_limit = 0; |
| 4237 | nsecs = -1; | 4237 | nsecs = -1; |
| 4238 | } | 4238 | } |
| 4239 | else if (time_limit > TYPE_MAXIMUM (time_t)) | 4239 | else if (TYPE_MAXIMUM (time_t) < time_limit) |
| 4240 | time_limit = TYPE_MAXIMUM (time_t); | 4240 | time_limit = TYPE_MAXIMUM (time_t); |
| 4241 | 4241 | ||
| 4242 | /* Since we may need to wait several times, | 4242 | /* Since we may need to wait several times, |
diff --git a/src/search.c b/src/search.c index ece346ecd06..ea36133deb7 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -2533,9 +2533,9 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2533 | bool str_multibyte = STRING_MULTIBYTE (newtext); | 2533 | bool str_multibyte = STRING_MULTIBYTE (newtext); |
| 2534 | bool really_changed = 0; | 2534 | bool really_changed = 0; |
| 2535 | 2535 | ||
| 2536 | substed_alloc_size = (length > (STRING_BYTES_BOUND - 100) / 2 | 2536 | substed_alloc_size = (length <= (STRING_BYTES_BOUND - 100) / 2 |
| 2537 | ? STRING_BYTES_BOUND | 2537 | ? length * 2 + 100 |
| 2538 | : length * 2 + 100); | 2538 | : STRING_BYTES_BOUND); |
| 2539 | substed = xmalloc (substed_alloc_size); | 2539 | substed = xmalloc (substed_alloc_size); |
| 2540 | substed_len = 0; | 2540 | substed_len = 0; |
| 2541 | 2541 | ||
diff --git a/src/textprop.c b/src/textprop.c index 2b454485370..cc364d5a38c 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -597,8 +597,9 @@ get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop, | |||
| 597 | 597 | ||
| 598 | if (WINDOWP (object)) | 598 | if (WINDOWP (object)) |
| 599 | { | 599 | { |
| 600 | CHECK_LIVE_WINDOW (object); | ||
| 600 | w = XWINDOW (object); | 601 | w = XWINDOW (object); |
| 601 | object = w->buffer; | 602 | object = w->contents; |
| 602 | } | 603 | } |
| 603 | if (BUFFERP (object)) | 604 | if (BUFFERP (object)) |
| 604 | { | 605 | { |
diff --git a/src/w32fns.c b/src/w32fns.c index 88141893445..5d3a78f8b95 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -95,10 +95,6 @@ static HWND hourglass_hwnd = NULL; | |||
| 95 | #define IDC_HAND MAKEINTRESOURCE(32649) | 95 | #define IDC_HAND MAKEINTRESOURCE(32649) |
| 96 | #endif | 96 | #endif |
| 97 | 97 | ||
| 98 | /* Nonzero if using Windows. */ | ||
| 99 | |||
| 100 | static int w32_in_use; | ||
| 101 | |||
| 102 | Lisp_Object Qsuppress_icon; | 98 | Lisp_Object Qsuppress_icon; |
| 103 | Lisp_Object Qundefined_color; | 99 | Lisp_Object Qundefined_color; |
| 104 | Lisp_Object Qcancel_timer; | 100 | Lisp_Object Qcancel_timer; |
| @@ -239,37 +235,6 @@ HINSTANCE hinst = NULL; | |||
| 239 | static unsigned int sound_type = 0xFFFFFFFF; | 235 | static unsigned int sound_type = 0xFFFFFFFF; |
| 240 | #define MB_EMACS_SILENT (0xFFFFFFFF - 1) | 236 | #define MB_EMACS_SILENT (0xFFFFFFFF - 1) |
| 241 | 237 | ||
| 242 | |||
| 243 | /* Error if we are not connected to MS-Windows. */ | ||
| 244 | void | ||
| 245 | check_w32 (void) | ||
| 246 | { | ||
| 247 | if (! w32_in_use) | ||
| 248 | error ("MS-Windows not in use or not initialized"); | ||
| 249 | } | ||
| 250 | |||
| 251 | /* Nonzero if we can use mouse menus. | ||
| 252 | You should not call this unless HAVE_MENUS is defined. */ | ||
| 253 | |||
| 254 | int | ||
| 255 | have_menus_p (void) | ||
| 256 | { | ||
| 257 | return w32_in_use; | ||
| 258 | } | ||
| 259 | |||
| 260 | /* Extract a frame as a FRAME_PTR, defaulting to the selected frame | ||
| 261 | and checking validity for W32. */ | ||
| 262 | |||
| 263 | FRAME_PTR | ||
| 264 | check_x_frame (Lisp_Object frame) | ||
| 265 | { | ||
| 266 | struct frame *f = decode_live_frame (frame); | ||
| 267 | |||
| 268 | if (! FRAME_W32_P (f)) | ||
| 269 | error ("Non-W32 frame used"); | ||
| 270 | return f; | ||
| 271 | } | ||
| 272 | |||
| 273 | /* Let the user specify a display with a frame. | 238 | /* Let the user specify a display with a frame. |
| 274 | nil stands for the selected frame--or, if that is not a w32 frame, | 239 | nil stands for the selected frame--or, if that is not a w32 frame, |
| 275 | the first display on the list. */ | 240 | the first display on the list. */ |
| @@ -3155,8 +3120,26 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |||
| 3155 | form.ptCurrentPos.y = w32_system_caret_y; | 3120 | form.ptCurrentPos.y = w32_system_caret_y; |
| 3156 | 3121 | ||
| 3157 | form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); | 3122 | form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); |
| 3123 | |||
| 3124 | #ifdef ENABLE_CHECKING | ||
| 3125 | /* Temporary code to catch crashes in computing form.rcArea.top. */ | ||
| 3126 | { | ||
| 3127 | int wmbp = WINDOW_MENU_BAR_P (w); | ||
| 3128 | int wtbp = WINDOW_TOOL_BAR_P (w); | ||
| 3129 | struct frame *wf = WINDOW_XFRAME (w); | ||
| 3130 | int fibw = FRAME_INTERNAL_BORDER_WIDTH (wf); | ||
| 3131 | int wtel = WINDOW_TOP_EDGE_LINE (w); | ||
| 3132 | int wflh = FRAME_LINE_HEIGHT (wf); | ||
| 3133 | int wwhlp= WINDOW_WANTS_HEADER_LINE_P (w); | ||
| 3134 | int chlh = CURRENT_HEADER_LINE_HEIGHT (w); | ||
| 3135 | int whlh = (wwhlp ? chlh : 0); | ||
| 3136 | |||
| 3137 | form.rcArea.top = ((wmbp || wtbp) ? 0 : fibw) + wtel * wflh + whlh; | ||
| 3138 | } | ||
| 3139 | #else | ||
| 3158 | form.rcArea.top = (WINDOW_TOP_EDGE_Y (w) | 3140 | form.rcArea.top = (WINDOW_TOP_EDGE_Y (w) |
| 3159 | + WINDOW_HEADER_LINE_HEIGHT (w)); | 3141 | + WINDOW_HEADER_LINE_HEIGHT (w)); |
| 3142 | #endif | ||
| 3160 | form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) | 3143 | form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) |
| 3161 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | 3144 | - WINDOW_RIGHT_MARGIN_WIDTH (w) |
| 3162 | - WINDOW_RIGHT_FRINGE_WIDTH (w)); | 3145 | - WINDOW_RIGHT_FRINGE_WIDTH (w)); |
| @@ -4549,7 +4532,7 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, | |||
| 4549 | doc: /* Give FRAME input focus, raising to foreground if necessary. */) | 4532 | doc: /* Give FRAME input focus, raising to foreground if necessary. */) |
| 4550 | (Lisp_Object frame) | 4533 | (Lisp_Object frame) |
| 4551 | { | 4534 | { |
| 4552 | x_focus_on_frame (check_x_frame (frame)); | 4535 | x_focus_on_frame (decode_window_system_frame (frame)); |
| 4553 | return Qnil; | 4536 | return Qnil; |
| 4554 | } | 4537 | } |
| 4555 | 4538 | ||
| @@ -4560,7 +4543,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, | |||
| 4560 | (Lisp_Object color, Lisp_Object frame) | 4543 | (Lisp_Object color, Lisp_Object frame) |
| 4561 | { | 4544 | { |
| 4562 | XColor foo; | 4545 | XColor foo; |
| 4563 | FRAME_PTR f = check_x_frame (frame); | 4546 | FRAME_PTR f = decode_window_system_frame (frame); |
| 4564 | 4547 | ||
| 4565 | CHECK_STRING (color); | 4548 | CHECK_STRING (color); |
| 4566 | 4549 | ||
| @@ -4575,7 +4558,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | |||
| 4575 | (Lisp_Object color, Lisp_Object frame) | 4558 | (Lisp_Object color, Lisp_Object frame) |
| 4576 | { | 4559 | { |
| 4577 | XColor foo; | 4560 | XColor foo; |
| 4578 | FRAME_PTR f = check_x_frame (frame); | 4561 | FRAME_PTR f = decode_window_system_frame (frame); |
| 4579 | 4562 | ||
| 4580 | CHECK_STRING (color); | 4563 | CHECK_STRING (color); |
| 4581 | 4564 | ||
| @@ -4893,7 +4876,6 @@ x_display_info_for_name (Lisp_Object name) | |||
| 4893 | if (dpyinfo == 0) | 4876 | if (dpyinfo == 0) |
| 4894 | error ("Cannot connect to server %s", SDATA (name)); | 4877 | error ("Cannot connect to server %s", SDATA (name)); |
| 4895 | 4878 | ||
| 4896 | w32_in_use = 1; | ||
| 4897 | XSETFASTINT (Vwindow_system_version, w32_major_version); | 4879 | XSETFASTINT (Vwindow_system_version, w32_major_version); |
| 4898 | 4880 | ||
| 4899 | return dpyinfo; | 4881 | return dpyinfo; |
| @@ -4923,7 +4905,7 @@ terminate Emacs if we can't open the connection. | |||
| 4923 | 4905 | ||
| 4924 | /* If initialization has already been done, return now to avoid | 4906 | /* If initialization has already been done, return now to avoid |
| 4925 | overwriting critical parts of one_w32_display_info. */ | 4907 | overwriting critical parts of one_w32_display_info. */ |
| 4926 | if (w32_in_use) | 4908 | if (window_system_available (NULL)) |
| 4927 | return Qnil; | 4909 | return Qnil; |
| 4928 | 4910 | ||
| 4929 | if (! NILP (xrm_string)) | 4911 | if (! NILP (xrm_string)) |
| @@ -4992,8 +4974,6 @@ terminate Emacs if we can't open the connection. | |||
| 4992 | error ("Cannot connect to server %s", SDATA (display)); | 4974 | error ("Cannot connect to server %s", SDATA (display)); |
| 4993 | } | 4975 | } |
| 4994 | 4976 | ||
| 4995 | w32_in_use = 1; | ||
| 4996 | |||
| 4997 | XSETFASTINT (Vwindow_system_version, w32_major_version); | 4977 | XSETFASTINT (Vwindow_system_version, w32_major_version); |
| 4998 | return Qnil; | 4978 | return Qnil; |
| 4999 | } | 4979 | } |
| @@ -5077,7 +5057,7 @@ FRAME. Default is to change on the edit X window. */) | |||
| 5077 | (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, | 5057 | (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, |
| 5078 | Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) | 5058 | Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) |
| 5079 | { | 5059 | { |
| 5080 | struct frame *f = check_x_frame (frame); | 5060 | struct frame *f = decode_window_system_frame (frame); |
| 5081 | Atom prop_atom; | 5061 | Atom prop_atom; |
| 5082 | 5062 | ||
| 5083 | CHECK_STRING (prop); | 5063 | CHECK_STRING (prop); |
| @@ -5103,7 +5083,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property, | |||
| 5103 | FRAME nil or omitted means use the selected frame. Value is PROP. */) | 5083 | FRAME nil or omitted means use the selected frame. Value is PROP. */) |
| 5104 | (Lisp_Object prop, Lisp_Object frame) | 5084 | (Lisp_Object prop, Lisp_Object frame) |
| 5105 | { | 5085 | { |
| 5106 | struct frame *f = check_x_frame (frame); | 5086 | struct frame *f = decode_window_system_frame (frame); |
| 5107 | Atom prop_atom; | 5087 | Atom prop_atom; |
| 5108 | 5088 | ||
| 5109 | CHECK_STRING (prop); | 5089 | CHECK_STRING (prop); |
| @@ -5139,7 +5119,7 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 5139 | (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, | 5119 | (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, |
| 5140 | Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) | 5120 | Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) |
| 5141 | { | 5121 | { |
| 5142 | struct frame *f = check_x_frame (frame); | 5122 | struct frame *f = decode_window_system_frame (frame); |
| 5143 | Atom prop_atom; | 5123 | Atom prop_atom; |
| 5144 | int rc; | 5124 | int rc; |
| 5145 | Lisp_Object prop_value = Qnil; | 5125 | Lisp_Object prop_value = Qnil; |
| @@ -5340,8 +5320,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, | |||
| 5340 | Lisp_Object buffer; | 5320 | Lisp_Object buffer; |
| 5341 | struct buffer *old_buffer; | 5321 | struct buffer *old_buffer; |
| 5342 | 5322 | ||
| 5343 | check_w32 (); | ||
| 5344 | |||
| 5345 | /* Use this general default value to start with until we know if | 5323 | /* Use this general default value to start with until we know if |
| 5346 | this frame has a specified name. */ | 5324 | this frame has a specified name. */ |
| 5347 | Vx_resource_name = Vinvocation_name; | 5325 | Vx_resource_name = Vinvocation_name; |
| @@ -5685,7 +5663,7 @@ Text larger than the specified size is clipped. */) | |||
| 5685 | GCPRO4 (string, parms, frame, timeout); | 5663 | GCPRO4 (string, parms, frame, timeout); |
| 5686 | 5664 | ||
| 5687 | CHECK_STRING (string); | 5665 | CHECK_STRING (string); |
| 5688 | f = check_x_frame (frame); | 5666 | f = decode_window_system_frame (frame); |
| 5689 | if (NILP (timeout)) | 5667 | if (NILP (timeout)) |
| 5690 | timeout = make_number (5); | 5668 | timeout = make_number (5); |
| 5691 | else | 5669 | else |
| @@ -5792,13 +5770,13 @@ Text larger than the specified size is clipped. */) | |||
| 5792 | w->total_lines = 40; | 5770 | w->total_lines = 40; |
| 5793 | } | 5771 | } |
| 5794 | 5772 | ||
| 5795 | FRAME_TOTAL_COLS (f) = XINT (w->total_cols); | 5773 | FRAME_TOTAL_COLS (f) = WINDOW_TOTAL_COLS (w); |
| 5796 | adjust_glyphs (f); | 5774 | adjust_glyphs (f); |
| 5797 | w->pseudo_window_p = 1; | 5775 | w->pseudo_window_p = 1; |
| 5798 | 5776 | ||
| 5799 | /* Display the tooltip text in a temporary buffer. */ | 5777 | /* Display the tooltip text in a temporary buffer. */ |
| 5800 | old_buffer = current_buffer; | 5778 | old_buffer = current_buffer; |
| 5801 | set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); | 5779 | set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->contents)); |
| 5802 | bset_truncate_lines (current_buffer, Qnil); | 5780 | bset_truncate_lines (current_buffer, Qnil); |
| 5803 | clear_glyph_matrix (w->desired_matrix); | 5781 | clear_glyph_matrix (w->desired_matrix); |
| 5804 | clear_glyph_matrix (w->current_matrix); | 5782 | clear_glyph_matrix (w->current_matrix); |
| @@ -6336,7 +6314,7 @@ screen saver if defined. | |||
| 6336 | If optional parameter FRAME is not specified, use selected frame. */) | 6314 | If optional parameter FRAME is not specified, use selected frame. */) |
| 6337 | (Lisp_Object command, Lisp_Object frame) | 6315 | (Lisp_Object command, Lisp_Object frame) |
| 6338 | { | 6316 | { |
| 6339 | FRAME_PTR f = check_x_frame (frame); | 6317 | FRAME_PTR f = decode_window_system_frame (frame); |
| 6340 | 6318 | ||
| 6341 | CHECK_NUMBER (command); | 6319 | CHECK_NUMBER (command); |
| 6342 | 6320 | ||
| @@ -7294,8 +7272,6 @@ void | |||
| 7294 | syms_of_w32fns (void) | 7272 | syms_of_w32fns (void) |
| 7295 | { | 7273 | { |
| 7296 | globals_of_w32fns (); | 7274 | globals_of_w32fns (); |
| 7297 | /* This is zero if not using MS-Windows. */ | ||
| 7298 | w32_in_use = 0; | ||
| 7299 | track_mouse_window = NULL; | 7275 | track_mouse_window = NULL; |
| 7300 | 7276 | ||
| 7301 | w32_visible_system_caret_hwnd = NULL; | 7277 | w32_visible_system_caret_hwnd = NULL; |
| @@ -7617,8 +7593,6 @@ only be necessary if the default setting causes problems. */); | |||
| 7617 | defsubr (&Sdefault_printer_name); | 7593 | defsubr (&Sdefault_printer_name); |
| 7618 | defsubr (&Sset_message_beep); | 7594 | defsubr (&Sset_message_beep); |
| 7619 | 7595 | ||
| 7620 | check_window_system_func = check_w32; | ||
| 7621 | |||
| 7622 | hourglass_hwnd = NULL; | 7596 | hourglass_hwnd = NULL; |
| 7623 | 7597 | ||
| 7624 | defsubr (&Sx_show_tip); | 7598 | defsubr (&Sx_show_tip); |
diff --git a/src/w32font.c b/src/w32font.c index fb52376b9e1..105daa06365 100644 --- a/src/w32font.c +++ b/src/w32font.c | |||
| @@ -2467,7 +2467,7 @@ If EXCLUDE-PROPORTIONAL is non-nil, exclude proportional fonts | |||
| 2467 | in the font selection dialog. */) | 2467 | in the font selection dialog. */) |
| 2468 | (Lisp_Object frame, Lisp_Object exclude_proportional) | 2468 | (Lisp_Object frame, Lisp_Object exclude_proportional) |
| 2469 | { | 2469 | { |
| 2470 | FRAME_PTR f = check_x_frame (frame); | 2470 | FRAME_PTR f = decode_window_system_frame (frame); |
| 2471 | CHOOSEFONT cf; | 2471 | CHOOSEFONT cf; |
| 2472 | LOGFONT lf; | 2472 | LOGFONT lf; |
| 2473 | TEXTMETRIC tm; | 2473 | TEXTMETRIC tm; |
diff --git a/src/w32menu.c b/src/w32menu.c index 03904cf20b8..346402b7c6b 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -140,8 +140,6 @@ otherwise it is "Question". */) | |||
| 140 | FRAME_PTR f = NULL; | 140 | FRAME_PTR f = NULL; |
| 141 | Lisp_Object window; | 141 | Lisp_Object window; |
| 142 | 142 | ||
| 143 | check_w32 (); | ||
| 144 | |||
| 145 | /* Decode the first argument: find the window or frame to use. */ | 143 | /* Decode the first argument: find the window or frame to use. */ |
| 146 | if (EQ (position, Qt) | 144 | if (EQ (position, Qt) |
| 147 | || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) | 145 | || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) |
| @@ -194,6 +192,8 @@ otherwise it is "Question". */) | |||
| 194 | but I don't want to make one now. */ | 192 | but I don't want to make one now. */ |
| 195 | CHECK_WINDOW (window); | 193 | CHECK_WINDOW (window); |
| 196 | 194 | ||
| 195 | check_window_system (f); | ||
| 196 | |||
| 197 | #ifndef HAVE_DIALOGS | 197 | #ifndef HAVE_DIALOGS |
| 198 | 198 | ||
| 199 | { | 199 | { |
| @@ -396,7 +396,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) | |||
| 396 | if (! menubar_widget) | 396 | if (! menubar_widget) |
| 397 | previous_menu_items_used = 0; | 397 | previous_menu_items_used = 0; |
| 398 | 398 | ||
| 399 | buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; | 399 | buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents; |
| 400 | specbind (Qinhibit_quit, Qt); | 400 | specbind (Qinhibit_quit, Qt); |
| 401 | /* Don't let the debugger step into this code | 401 | /* Don't let the debugger step into this code |
| 402 | because it is not reentrant. */ | 402 | because it is not reentrant. */ |
diff --git a/src/w32term.c b/src/w32term.c index 5f7952c2ec2..d249d6e3252 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5694,7 +5694,7 @@ w32fullscreen_hook (FRAME_PTR f) | |||
| 5694 | /* Need to send SC_RESTORE to the window, in case we are | 5694 | /* Need to send SC_RESTORE to the window, in case we are |
| 5695 | resizing from FULLSCREEN_MAXIMIZED. Otherwise, the mouse | 5695 | resizing from FULLSCREEN_MAXIMIZED. Otherwise, the mouse |
| 5696 | resize hints will not be shown by the window manager when the | 5696 | resize hints will not be shown by the window manager when the |
| 5697 | mouse pointer hovers over the window edges, becaise the WM | 5697 | mouse pointer hovers over the window edges, because the WM |
| 5698 | will still think the window is maximized. */ | 5698 | will still think the window is maximized. */ |
| 5699 | if (f->want_fullscreen != FULLSCREEN_BOTH) | 5699 | if (f->want_fullscreen != FULLSCREEN_BOTH) |
| 5700 | SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0); | 5700 | SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_RESTORE, 0); |
diff --git a/src/w32term.h b/src/w32term.h index b319f0ca592..9bb37b31ef5 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -203,7 +203,6 @@ extern void x_focus_on_frame (struct frame *f); | |||
| 203 | 203 | ||
| 204 | extern struct w32_display_info *w32_term_init (Lisp_Object, | 204 | extern struct w32_display_info *w32_term_init (Lisp_Object, |
| 205 | char *, char *); | 205 | char *, char *); |
| 206 | extern void check_w32 (void); | ||
| 207 | extern int w32_defined_color (FRAME_PTR f, const char *color, | 206 | extern int w32_defined_color (FRAME_PTR f, const char *color, |
| 208 | XColor *color_def, int alloc); | 207 | XColor *color_def, int alloc); |
| 209 | extern void x_set_window_size (struct frame *f, int change_grav, | 208 | extern void x_set_window_size (struct frame *f, int change_grav, |
| @@ -740,7 +739,6 @@ struct image; | |||
| 740 | struct face; | 739 | struct face; |
| 741 | 740 | ||
| 742 | XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *); | 741 | XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *); |
| 743 | struct frame * check_x_frame (Lisp_Object); | ||
| 744 | 742 | ||
| 745 | typedef DWORD (WINAPI * ClipboardSequence_Proc) (void); | 743 | typedef DWORD (WINAPI * ClipboardSequence_Proc) (void); |
| 746 | typedef BOOL (WINAPI * AppendMenuW_Proc) ( | 744 | typedef BOOL (WINAPI * AppendMenuW_Proc) ( |
diff --git a/src/window.c b/src/window.c index a2e6a5a0602..77604f4ee19 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -148,11 +148,6 @@ wset_display_table (struct window *w, Lisp_Object val) | |||
| 148 | w->display_table = val; | 148 | w->display_table = val; |
| 149 | } | 149 | } |
| 150 | static void | 150 | static void |
| 151 | wset_hchild (struct window *w, Lisp_Object val) | ||
| 152 | { | ||
| 153 | w->hchild = val; | ||
| 154 | } | ||
| 155 | static void | ||
| 156 | wset_left_fringe_width (struct window *w, Lisp_Object val) | 151 | wset_left_fringe_width (struct window *w, Lisp_Object val) |
| 157 | { | 152 | { |
| 158 | w->left_fringe_width = val; | 153 | w->left_fringe_width = val; |
| @@ -218,11 +213,6 @@ wset_temslot (struct window *w, Lisp_Object val) | |||
| 218 | w->temslot = val; | 213 | w->temslot = val; |
| 219 | } | 214 | } |
| 220 | static void | 215 | static void |
| 221 | wset_vchild (struct window *w, Lisp_Object val) | ||
| 222 | { | ||
| 223 | w->vchild = val; | ||
| 224 | } | ||
| 225 | static void | ||
| 226 | wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) | 216 | wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) |
| 227 | { | 217 | { |
| 228 | w->vertical_scroll_bar_type = val; | 218 | w->vertical_scroll_bar_type = val; |
| @@ -232,6 +222,18 @@ wset_window_parameters (struct window *w, Lisp_Object val) | |||
| 232 | { | 222 | { |
| 233 | w->window_parameters = val; | 223 | w->window_parameters = val; |
| 234 | } | 224 | } |
| 225 | static void | ||
| 226 | wset_combination (struct window *w, bool horflag, Lisp_Object val) | ||
| 227 | { | ||
| 228 | /* Since leaf windows never becomes non-leaf, there should | ||
| 229 | be no buffer and markers in start and pointm fields of W. */ | ||
| 230 | eassert (!BUFFERP (w->contents) && NILP (w->start) && NILP (w->pointm)); | ||
| 231 | w->contents = val; | ||
| 232 | /* When an internal window is deleted and VAL is nil, HORFLAG | ||
| 233 | is meaningless. */ | ||
| 234 | if (!NILP (val)) | ||
| 235 | w->horizontal = horflag; | ||
| 236 | } | ||
| 235 | 237 | ||
| 236 | struct window * | 238 | struct window * |
| 237 | decode_live_window (register Lisp_Object window) | 239 | decode_live_window (register Lisp_Object window) |
| @@ -276,9 +278,9 @@ static void | |||
| 276 | adjust_window_count (struct window *w, int arg) | 278 | adjust_window_count (struct window *w, int arg) |
| 277 | { | 279 | { |
| 278 | eassert (eabs (arg) == 1); | 280 | eassert (eabs (arg) == 1); |
| 279 | if (BUFFERP (w->buffer)) | 281 | if (BUFFERP (w->contents)) |
| 280 | { | 282 | { |
| 281 | struct buffer *b = XBUFFER (w->buffer); | 283 | struct buffer *b = XBUFFER (w->contents); |
| 282 | 284 | ||
| 283 | if (b->base_buffer) | 285 | if (b->base_buffer) |
| 284 | b = b->base_buffer; | 286 | b = b->base_buffer; |
| @@ -297,7 +299,11 @@ void | |||
| 297 | wset_buffer (struct window *w, Lisp_Object val) | 299 | wset_buffer (struct window *w, Lisp_Object val) |
| 298 | { | 300 | { |
| 299 | adjust_window_count (w, -1); | 301 | adjust_window_count (w, -1); |
| 300 | w->buffer = val; | 302 | if (BUFFERP (val)) |
| 303 | /* Make sure that we do not assign the buffer | ||
| 304 | to an internal window. */ | ||
| 305 | eassert (MARKERP (w->start) && MARKERP (w->pointm)); | ||
| 306 | w->contents = val; | ||
| 301 | adjust_window_count (w, 1); | 307 | adjust_window_count (w, 1); |
| 302 | } | 308 | } |
| 303 | 309 | ||
| @@ -395,15 +401,8 @@ the first window of that frame. */) | |||
| 395 | window = XFRAME (frame_or_window)->root_window; | 401 | window = XFRAME (frame_or_window)->root_window; |
| 396 | } | 402 | } |
| 397 | 403 | ||
| 398 | while (NILP (XWINDOW (window)->buffer)) | 404 | while (WINDOWP (XWINDOW (window)->contents)) |
| 399 | { | 405 | window = XWINDOW (window)->contents; |
| 400 | if (! NILP (XWINDOW (window)->hchild)) | ||
| 401 | window = XWINDOW (window)->hchild; | ||
| 402 | else if (! NILP (XWINDOW (window)->vchild)) | ||
| 403 | window = XWINDOW (window)->vchild; | ||
| 404 | else | ||
| 405 | emacs_abort (); | ||
| 406 | } | ||
| 407 | 406 | ||
| 408 | return window; | 407 | return window; |
| 409 | } | 408 | } |
| @@ -490,11 +489,11 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 490 | if (NILP (norecord)) | 489 | if (NILP (norecord)) |
| 491 | { | 490 | { |
| 492 | w->use_time = ++window_select_count; | 491 | w->use_time = ++window_select_count; |
| 493 | record_buffer (w->buffer); | 492 | record_buffer (w->contents); |
| 494 | } | 493 | } |
| 495 | 494 | ||
| 496 | /* Make the selected window's buffer current. */ | 495 | /* Make the selected window's buffer current. */ |
| 497 | Fset_buffer (w->buffer); | 496 | Fset_buffer (w->contents); |
| 498 | 497 | ||
| 499 | if (EQ (window, selected_window) && !inhibit_point_swap) | 498 | if (EQ (window, selected_window) && !inhibit_point_swap) |
| 500 | return window; | 499 | return window; |
| @@ -517,7 +516,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 517 | 516 | ||
| 518 | select_window_1 (window, inhibit_point_swap); | 517 | select_window_1 (window, inhibit_point_swap); |
| 519 | 518 | ||
| 520 | bset_last_selected_window (XBUFFER (w->buffer), window); | 519 | bset_last_selected_window (XBUFFER (w->contents), window); |
| 521 | windows_or_buffers_changed++; | 520 | windows_or_buffers_changed++; |
| 522 | return window; | 521 | return window; |
| 523 | } | 522 | } |
| @@ -534,10 +533,10 @@ select_window_1 (Lisp_Object window, bool inhibit_point_swap) | |||
| 534 | if (!inhibit_point_swap) | 533 | if (!inhibit_point_swap) |
| 535 | { | 534 | { |
| 536 | struct window *ow = XWINDOW (selected_window); | 535 | struct window *ow = XWINDOW (selected_window); |
| 537 | if (! NILP (ow->buffer)) | 536 | if (BUFFERP (ow->contents)) |
| 538 | set_marker_both (ow->pointm, ow->buffer, | 537 | set_marker_both (ow->pointm, ow->contents, |
| 539 | BUF_PT (XBUFFER (ow->buffer)), | 538 | BUF_PT (XBUFFER (ow->contents)), |
| 540 | BUF_PT_BYTE (XBUFFER (ow->buffer))); | 539 | BUF_PT_BYTE (XBUFFER (ow->contents))); |
| 541 | } | 540 | } |
| 542 | 541 | ||
| 543 | selected_window = window; | 542 | selected_window = window; |
| @@ -582,7 +581,8 @@ If WINDOW is omitted or nil, it defaults to the selected window. | |||
| 582 | Return nil for an internal window or a deleted window. */) | 581 | Return nil for an internal window or a deleted window. */) |
| 583 | (Lisp_Object window) | 582 | (Lisp_Object window) |
| 584 | { | 583 | { |
| 585 | return decode_any_window (window)->buffer; | 584 | struct window *w = decode_any_window (window); |
| 585 | return WINDOW_LEAF_P (w) ? w->contents : Qnil; | ||
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, | 588 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, |
| @@ -602,7 +602,8 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 602 | horizontal combination. */) | 602 | horizontal combination. */) |
| 603 | (Lisp_Object window) | 603 | (Lisp_Object window) |
| 604 | { | 604 | { |
| 605 | return decode_valid_window (window)->vchild; | 605 | struct window *w = decode_valid_window (window); |
| 606 | return WINDOW_VERTICAL_COMBINATION_P (w) ? w->contents : Qnil; | ||
| 606 | } | 607 | } |
| 607 | 608 | ||
| 608 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, | 609 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, |
| @@ -613,7 +614,8 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 613 | vertical combination. */) | 614 | vertical combination. */) |
| 614 | (Lisp_Object window) | 615 | (Lisp_Object window) |
| 615 | { | 616 | { |
| 616 | return decode_valid_window (window)->hchild; | 617 | struct window *w = decode_valid_window (window); |
| 618 | return WINDOW_HORIZONTAL_COMBINATION_P (w) ? w->contents : Qnil; | ||
| 617 | } | 619 | } |
| 618 | 620 | ||
| 619 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, | 621 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, |
| @@ -646,9 +648,9 @@ WINDOW are never \(re-)combined with WINDOW's siblings. */) | |||
| 646 | 648 | ||
| 647 | CHECK_VALID_WINDOW (window); | 649 | CHECK_VALID_WINDOW (window); |
| 648 | w = XWINDOW (window); | 650 | w = XWINDOW (window); |
| 649 | if (!NILP (w->buffer)) | 651 | if (WINDOW_LEAF_P (w)) |
| 650 | error ("Combination limit is meaningful for internal windows only"); | 652 | error ("Combination limit is meaningful for internal windows only"); |
| 651 | return XWINDOW (window)->combination_limit; | 653 | return w->combination_limit; |
| 652 | } | 654 | } |
| 653 | 655 | ||
| 654 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, | 656 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, |
| @@ -664,7 +666,7 @@ future use. */) | |||
| 664 | 666 | ||
| 665 | CHECK_VALID_WINDOW (window); | 667 | CHECK_VALID_WINDOW (window); |
| 666 | w = XWINDOW (window); | 668 | w = XWINDOW (window); |
| 667 | if (!NILP (w->buffer)) | 669 | if (WINDOW_LEAF_P (w)) |
| 668 | error ("Combination limit is meaningful for internal windows only"); | 670 | error ("Combination limit is meaningful for internal windows only"); |
| 669 | wset_combination_limit (w, limit); | 671 | wset_combination_limit (w, limit); |
| 670 | return limit; | 672 | return limit; |
| @@ -861,7 +863,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll) | |||
| 861 | 863 | ||
| 862 | /* Prevent redisplay shortcuts when changing the hscroll. */ | 864 | /* Prevent redisplay shortcuts when changing the hscroll. */ |
| 863 | if (w->hscroll != new_hscroll) | 865 | if (w->hscroll != new_hscroll) |
| 864 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 866 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 865 | 867 | ||
| 866 | w->hscroll = new_hscroll; | 868 | w->hscroll = new_hscroll; |
| 867 | return make_number (new_hscroll); | 869 | return make_number (new_hscroll); |
| @@ -1442,7 +1444,7 @@ correct to return the top-level value of `point', outside of any | |||
| 1442 | register struct window *w = decode_live_window (window); | 1444 | register struct window *w = decode_live_window (window); |
| 1443 | 1445 | ||
| 1444 | if (w == XWINDOW (selected_window)) | 1446 | if (w == XWINDOW (selected_window)) |
| 1445 | return make_number (BUF_PT (XBUFFER (w->buffer))); | 1447 | return make_number (BUF_PT (XBUFFER (w->contents))); |
| 1446 | else | 1448 | else |
| 1447 | return Fmarker_position (w->pointm); | 1449 | return Fmarker_position (w->pointm); |
| 1448 | } | 1450 | } |
| @@ -1484,7 +1486,7 @@ if it isn't already recorded. */) | |||
| 1484 | Lisp_Object buf; | 1486 | Lisp_Object buf; |
| 1485 | struct buffer *b; | 1487 | struct buffer *b; |
| 1486 | 1488 | ||
| 1487 | buf = w->buffer; | 1489 | buf = w->contents; |
| 1488 | CHECK_BUFFER (buf); | 1490 | CHECK_BUFFER (buf); |
| 1489 | b = XBUFFER (buf); | 1491 | b = XBUFFER (buf); |
| 1490 | 1492 | ||
| @@ -1547,7 +1549,7 @@ Return POS. */) | |||
| 1547 | 1549 | ||
| 1548 | if (w == XWINDOW (selected_window)) | 1550 | if (w == XWINDOW (selected_window)) |
| 1549 | { | 1551 | { |
| 1550 | if (XBUFFER (w->buffer) == current_buffer) | 1552 | if (XBUFFER (w->contents) == current_buffer) |
| 1551 | Fgoto_char (pos); | 1553 | Fgoto_char (pos); |
| 1552 | else | 1554 | else |
| 1553 | { | 1555 | { |
| @@ -1555,14 +1557,14 @@ Return POS. */) | |||
| 1555 | 1557 | ||
| 1556 | /* ... but here we want to catch type error before buffer change. */ | 1558 | /* ... but here we want to catch type error before buffer change. */ |
| 1557 | CHECK_NUMBER_COERCE_MARKER (pos); | 1559 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1558 | set_buffer_internal (XBUFFER (w->buffer)); | 1560 | set_buffer_internal (XBUFFER (w->contents)); |
| 1559 | Fgoto_char (pos); | 1561 | Fgoto_char (pos); |
| 1560 | set_buffer_internal (old_buffer); | 1562 | set_buffer_internal (old_buffer); |
| 1561 | } | 1563 | } |
| 1562 | } | 1564 | } |
| 1563 | else | 1565 | else |
| 1564 | { | 1566 | { |
| 1565 | set_marker_restricted (w->pointm, pos, w->buffer); | 1567 | set_marker_restricted (w->pointm, pos, w->contents); |
| 1566 | /* We have to make sure that redisplay updates the window to show | 1568 | /* We have to make sure that redisplay updates the window to show |
| 1567 | the new value of point. */ | 1569 | the new value of point. */ |
| 1568 | ++windows_or_buffers_changed; | 1570 | ++windows_or_buffers_changed; |
| @@ -1580,7 +1582,7 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1580 | { | 1582 | { |
| 1581 | register struct window *w = decode_live_window (window); | 1583 | register struct window *w = decode_live_window (window); |
| 1582 | 1584 | ||
| 1583 | set_marker_restricted (w->start, pos, w->buffer); | 1585 | set_marker_restricted (w->start, pos, w->contents); |
| 1584 | /* This is not right, but much easier than doing what is right. */ | 1586 | /* This is not right, but much easier than doing what is right. */ |
| 1585 | w->start_at_line_beg = 0; | 1587 | w->start_at_line_beg = 0; |
| 1586 | if (NILP (noforce)) | 1588 | if (NILP (noforce)) |
| @@ -1624,7 +1626,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1624 | int x, y; | 1626 | int x, y; |
| 1625 | 1627 | ||
| 1626 | w = decode_live_window (window); | 1628 | w = decode_live_window (window); |
| 1627 | buf = XBUFFER (w->buffer); | 1629 | buf = XBUFFER (w->contents); |
| 1628 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1630 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 1629 | 1631 | ||
| 1630 | if (EQ (pos, Qt)) | 1632 | if (EQ (pos, Qt)) |
| @@ -1693,8 +1695,8 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1693 | if (noninteractive || w->pseudo_window_p) | 1695 | if (noninteractive || w->pseudo_window_p) |
| 1694 | return Qnil; | 1696 | return Qnil; |
| 1695 | 1697 | ||
| 1696 | CHECK_BUFFER (w->buffer); | 1698 | CHECK_BUFFER (w->contents); |
| 1697 | b = XBUFFER (w->buffer); | 1699 | b = XBUFFER (w->contents); |
| 1698 | 1700 | ||
| 1699 | /* Fail if current matrix is not up-to-date. */ | 1701 | /* Fail if current matrix is not up-to-date. */ |
| 1700 | if (!w->window_end_valid | 1702 | if (!w->window_end_valid |
| @@ -1920,9 +1922,9 @@ window_display_table (struct window *w) | |||
| 1920 | 1922 | ||
| 1921 | if (DISP_TABLE_P (w->display_table)) | 1923 | if (DISP_TABLE_P (w->display_table)) |
| 1922 | dp = XCHAR_TABLE (w->display_table); | 1924 | dp = XCHAR_TABLE (w->display_table); |
| 1923 | else if (BUFFERP (w->buffer)) | 1925 | else if (BUFFERP (w->contents)) |
| 1924 | { | 1926 | { |
| 1925 | struct buffer *b = XBUFFER (w->buffer); | 1927 | struct buffer *b = XBUFFER (w->contents); |
| 1926 | 1928 | ||
| 1927 | if (DISP_TABLE_P (BVAR (b, display_table))) | 1929 | if (DISP_TABLE_P (BVAR (b, display_table))) |
| 1928 | dp = XCHAR_TABLE (BVAR (b, display_table)); | 1930 | dp = XCHAR_TABLE (BVAR (b, display_table)); |
| @@ -1947,17 +1949,14 @@ WINDOW must be a live window and defaults to the selected one. */) | |||
| 1947 | static void | 1949 | static void |
| 1948 | unshow_buffer (register struct window *w) | 1950 | unshow_buffer (register struct window *w) |
| 1949 | { | 1951 | { |
| 1950 | Lisp_Object buf; | 1952 | Lisp_Object buf = w->contents; |
| 1951 | struct buffer *b; | 1953 | struct buffer *b = XBUFFER (buf); |
| 1952 | 1954 | ||
| 1953 | buf = w->buffer; | 1955 | eassert (b == XMARKER (w->pointm)->buffer); |
| 1954 | b = XBUFFER (buf); | ||
| 1955 | if (b != XMARKER (w->pointm)->buffer) | ||
| 1956 | emacs_abort (); | ||
| 1957 | 1956 | ||
| 1958 | #if 0 | 1957 | #if 0 |
| 1959 | if (w == XWINDOW (selected_window) | 1958 | if (w == XWINDOW (selected_window) |
| 1960 | || ! EQ (buf, XWINDOW (selected_window)->buffer)) | 1959 | || ! EQ (buf, XWINDOW (selected_window)->contents)) |
| 1961 | /* Do this except when the selected window's buffer | 1960 | /* Do this except when the selected window's buffer |
| 1962 | is being removed from some other window. */ | 1961 | is being removed from some other window. */ |
| 1963 | #endif | 1962 | #endif |
| @@ -1973,14 +1972,14 @@ unshow_buffer (register struct window *w) | |||
| 1973 | /* Point in the selected window's buffer | 1972 | /* Point in the selected window's buffer |
| 1974 | is actually stored in that buffer, and the window's pointm isn't used. | 1973 | is actually stored in that buffer, and the window's pointm isn't used. |
| 1975 | So don't clobber point in that buffer. */ | 1974 | So don't clobber point in that buffer. */ |
| 1976 | if (! EQ (buf, XWINDOW (selected_window)->buffer) | 1975 | if (! EQ (buf, XWINDOW (selected_window)->contents) |
| 1977 | /* Don't clobber point in current buffer either (this could be | 1976 | /* Don't clobber point in current buffer either (this could be |
| 1978 | useful in connection with bug#12208). | 1977 | useful in connection with bug#12208). |
| 1979 | && XBUFFER (buf) != current_buffer */ | 1978 | && XBUFFER (buf) != current_buffer */ |
| 1980 | /* This line helps to fix Horsley's testbug.el bug. */ | 1979 | /* This line helps to fix Horsley's testbug.el bug. */ |
| 1981 | && !(WINDOWP (BVAR (b, last_selected_window)) | 1980 | && !(WINDOWP (BVAR (b, last_selected_window)) |
| 1982 | && w != XWINDOW (BVAR (b, last_selected_window)) | 1981 | && w != XWINDOW (BVAR (b, last_selected_window)) |
| 1983 | && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) | 1982 | && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->contents))) |
| 1984 | temp_set_point_both (b, | 1983 | temp_set_point_both (b, |
| 1985 | clip_to_bounds (BUF_BEGV (b), | 1984 | clip_to_bounds (BUF_BEGV (b), |
| 1986 | marker_position (w->pointm), | 1985 | marker_position (w->pointm), |
| @@ -2045,13 +2044,8 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 2045 | 2044 | ||
| 2046 | tem = o->parent; | 2045 | tem = o->parent; |
| 2047 | wset_parent (n, tem); | 2046 | wset_parent (n, tem); |
| 2048 | if (!NILP (tem)) | 2047 | if (!NILP (tem) && EQ (XWINDOW (tem)->contents, old)) |
| 2049 | { | 2048 | wset_combination (XWINDOW (tem), XWINDOW (tem)->horizontal, new); |
| 2050 | if (EQ (XWINDOW (tem)->vchild, old)) | ||
| 2051 | wset_vchild (XWINDOW (tem), new); | ||
| 2052 | if (EQ (XWINDOW (tem)->hchild, old)) | ||
| 2053 | wset_hchild (XWINDOW (tem), new); | ||
| 2054 | } | ||
| 2055 | } | 2049 | } |
| 2056 | 2050 | ||
| 2057 | /* If window WINDOW and its parent window are iso-combined, merge | 2051 | /* If window WINDOW and its parent window are iso-combined, merge |
| @@ -2070,22 +2064,19 @@ recombine_windows (Lisp_Object window) | |||
| 2070 | if (!NILP (parent) && NILP (w->combination_limit)) | 2064 | if (!NILP (parent) && NILP (w->combination_limit)) |
| 2071 | { | 2065 | { |
| 2072 | p = XWINDOW (parent); | 2066 | p = XWINDOW (parent); |
| 2073 | if (((!NILP (p->vchild) && !NILP (w->vchild)) | 2067 | if (WINDOWP (p->contents) && WINDOWP (w->contents) |
| 2074 | || (!NILP (p->hchild) && !NILP (w->hchild)))) | 2068 | && p->horizontal == w->horizontal) |
| 2075 | /* WINDOW and PARENT are both either a vertical or a horizontal | 2069 | /* WINDOW and PARENT are both either a vertical or a horizontal |
| 2076 | combination. */ | 2070 | combination. */ |
| 2077 | { | 2071 | { |
| 2078 | horflag = NILP (w->vchild); | 2072 | horflag = WINDOW_HORIZONTAL_COMBINATION_P (w); |
| 2079 | child = horflag ? w->hchild : w->vchild; | 2073 | child = w->contents; |
| 2080 | c = XWINDOW (child); | 2074 | c = XWINDOW (child); |
| 2081 | 2075 | ||
| 2082 | /* Splice WINDOW's children into its parent's children and | 2076 | /* Splice WINDOW's children into its parent's children and |
| 2083 | assign new normal sizes. */ | 2077 | assign new normal sizes. */ |
| 2084 | if (NILP (w->prev)) | 2078 | if (NILP (w->prev)) |
| 2085 | if (horflag) | 2079 | wset_combination (p, horflag, child); |
| 2086 | wset_hchild (p, child); | ||
| 2087 | else | ||
| 2088 | wset_vchild (p, child); | ||
| 2089 | else | 2080 | else |
| 2090 | { | 2081 | { |
| 2091 | wset_prev (c, w->prev); | 2082 | wset_prev (c, w->prev); |
| @@ -2123,8 +2114,7 @@ recombine_windows (Lisp_Object window) | |||
| 2123 | } | 2114 | } |
| 2124 | 2115 | ||
| 2125 | /* WINDOW can be deleted now. */ | 2116 | /* WINDOW can be deleted now. */ |
| 2126 | wset_vchild (w, Qnil); | 2117 | wset_combination (w, 0, Qnil); |
| 2127 | wset_hchild (w, Qnil); | ||
| 2128 | } | 2118 | } |
| 2129 | } | 2119 | } |
| 2130 | } | 2120 | } |
| @@ -2210,7 +2200,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf | |||
| 2210 | struct frame *f = XFRAME (w->frame); | 2200 | struct frame *f = XFRAME (w->frame); |
| 2211 | int candidate_p = 1; | 2201 | int candidate_p = 1; |
| 2212 | 2202 | ||
| 2213 | if (!BUFFERP (w->buffer)) | 2203 | if (!BUFFERP (w->contents)) |
| 2214 | candidate_p = 0; | 2204 | candidate_p = 0; |
| 2215 | else if (MINI_WINDOW_P (w) | 2205 | else if (MINI_WINDOW_P (w) |
| 2216 | && (EQ (minibuf, Qlambda) | 2206 | && (EQ (minibuf, Qlambda) |
| @@ -2550,7 +2540,7 @@ enum window_loop | |||
| 2550 | GET_BUFFER_WINDOW, /* Arg is buffer */ | 2540 | GET_BUFFER_WINDOW, /* Arg is buffer */ |
| 2551 | REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */ | 2541 | REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */ |
| 2552 | REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ | 2542 | REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ |
| 2553 | CHECK_ALL_WINDOWS | 2543 | CHECK_ALL_WINDOWS /* Arg is ignored */ |
| 2554 | }; | 2544 | }; |
| 2555 | 2545 | ||
| 2556 | static Lisp_Object | 2546 | static Lisp_Object |
| @@ -2614,7 +2604,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2614 | switch (type) | 2604 | switch (type) |
| 2615 | { | 2605 | { |
| 2616 | case GET_BUFFER_WINDOW: | 2606 | case GET_BUFFER_WINDOW: |
| 2617 | if (EQ (w->buffer, obj) | 2607 | if (EQ (w->contents, obj) |
| 2618 | /* Don't find any minibuffer window except the one that | 2608 | /* Don't find any minibuffer window except the one that |
| 2619 | is currently in use. */ | 2609 | is currently in use. */ |
| 2620 | && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) | 2610 | && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) |
| @@ -2638,25 +2628,25 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2638 | case REPLACE_BUFFER_IN_WINDOWS_SAFELY: | 2628 | case REPLACE_BUFFER_IN_WINDOWS_SAFELY: |
| 2639 | /* We could simply check whether the buffer shown by window | 2629 | /* We could simply check whether the buffer shown by window |
| 2640 | is live, and show another buffer in case it isn't. */ | 2630 | is live, and show another buffer in case it isn't. */ |
| 2641 | if (EQ (w->buffer, obj)) | 2631 | if (EQ (w->contents, obj)) |
| 2642 | { | 2632 | { |
| 2643 | /* Undedicate WINDOW. */ | 2633 | /* Undedicate WINDOW. */ |
| 2644 | wset_dedicated (w, Qnil); | 2634 | wset_dedicated (w, Qnil); |
| 2645 | /* Make WINDOW show the buffer returned by | 2635 | /* Make WINDOW show the buffer returned by |
| 2646 | other_buffer_safely, don't run any hooks. */ | 2636 | other_buffer_safely, don't run any hooks. */ |
| 2647 | set_window_buffer | 2637 | set_window_buffer |
| 2648 | (window, other_buffer_safely (w->buffer), 0, 0); | 2638 | (window, other_buffer_safely (w->contents), 0, 0); |
| 2649 | /* If WINDOW is the selected window, make its buffer | 2639 | /* If WINDOW is the selected window, make its buffer |
| 2650 | current. But do so only if the window shows the | 2640 | current. But do so only if the window shows the |
| 2651 | current buffer (Bug#6454). */ | 2641 | current buffer (Bug#6454). */ |
| 2652 | if (EQ (window, selected_window) | 2642 | if (EQ (window, selected_window) |
| 2653 | && XBUFFER (w->buffer) == current_buffer) | 2643 | && XBUFFER (w->contents) == current_buffer) |
| 2654 | Fset_buffer (w->buffer); | 2644 | Fset_buffer (w->contents); |
| 2655 | } | 2645 | } |
| 2656 | break; | 2646 | break; |
| 2657 | 2647 | ||
| 2658 | case REDISPLAY_BUFFER_WINDOWS: | 2648 | case REDISPLAY_BUFFER_WINDOWS: |
| 2659 | if (EQ (w->buffer, obj)) | 2649 | if (EQ (w->contents, obj)) |
| 2660 | { | 2650 | { |
| 2661 | mark_window_display_accurate (window, 0); | 2651 | mark_window_display_accurate (window, 0); |
| 2662 | w->update_mode_line = 1; | 2652 | w->update_mode_line = 1; |
| @@ -2666,11 +2656,20 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2666 | } | 2656 | } |
| 2667 | break; | 2657 | break; |
| 2668 | 2658 | ||
| 2669 | /* Check for a window that has a killed buffer. */ | 2659 | /* Check for a leaf window that has a killed buffer |
| 2660 | or broken markers. */ | ||
| 2670 | case CHECK_ALL_WINDOWS: | 2661 | case CHECK_ALL_WINDOWS: |
| 2671 | if (! NILP (w->buffer) | 2662 | if (BUFFERP (w->contents)) |
| 2672 | && !BUFFER_LIVE_P (XBUFFER (w->buffer))) | 2663 | { |
| 2673 | emacs_abort (); | 2664 | struct buffer *b = XBUFFER (w->contents); |
| 2665 | |||
| 2666 | if (!BUFFER_LIVE_P (b)) | ||
| 2667 | emacs_abort (); | ||
| 2668 | if (!MARKERP (w->start) || XMARKER (w->start)->buffer != b) | ||
| 2669 | emacs_abort (); | ||
| 2670 | if (!MARKERP (w->pointm) || XMARKER (w->pointm)->buffer != b) | ||
| 2671 | emacs_abort (); | ||
| 2672 | } | ||
| 2674 | break; | 2673 | break; |
| 2675 | 2674 | ||
| 2676 | case WINDOW_LOOP_UNUSED: | 2675 | case WINDOW_LOOP_UNUSED: |
| @@ -2787,7 +2786,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2787 | else if (MINI_WINDOW_P (w)) /* && top > 0) */ | 2786 | else if (MINI_WINDOW_P (w)) /* && top > 0) */ |
| 2788 | error ("Can't expand minibuffer to full frame"); | 2787 | error ("Can't expand minibuffer to full frame"); |
| 2789 | 2788 | ||
| 2790 | if (!NILP (w->buffer)) | 2789 | if (BUFFERP (w->contents)) |
| 2791 | { | 2790 | { |
| 2792 | startpos = marker_position (w->start); | 2791 | startpos = marker_position (w->start); |
| 2793 | startbyte = marker_byte_position (w->start); | 2792 | startbyte = marker_byte_position (w->start); |
| @@ -2859,7 +2858,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2859 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 2858 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 2860 | resize_failed = 0; | 2859 | resize_failed = 0; |
| 2861 | 2860 | ||
| 2862 | if (NILP (w->buffer)) | 2861 | if (!WINDOW_LEAF_P (w)) |
| 2863 | { | 2862 | { |
| 2864 | /* Resize child windows vertically. */ | 2863 | /* Resize child windows vertically. */ |
| 2865 | XSETINT (delta, r->total_lines - w->total_lines); | 2864 | XSETINT (delta, r->total_lines - w->total_lines); |
| @@ -2918,28 +2917,21 @@ window-start value is reasonable when this function is called. */) | |||
| 2918 | sibling = w->next; | 2917 | sibling = w->next; |
| 2919 | s = XWINDOW (sibling); | 2918 | s = XWINDOW (sibling); |
| 2920 | wset_prev (s, Qnil); | 2919 | wset_prev (s, Qnil); |
| 2921 | if (!NILP (XWINDOW (w->parent)->vchild)) | 2920 | wset_combination (XWINDOW (w->parent), |
| 2922 | wset_vchild (XWINDOW (w->parent), sibling); | 2921 | XWINDOW (w->parent)->horizontal, sibling); |
| 2923 | else | ||
| 2924 | wset_hchild (XWINDOW (w->parent), sibling); | ||
| 2925 | } | 2922 | } |
| 2926 | 2923 | ||
| 2927 | /* Delete ROOT and all child windows of ROOT. */ | 2924 | /* Delete ROOT and all child windows of ROOT. */ |
| 2928 | if (!NILP (r->vchild)) | 2925 | if (WINDOWP (r->contents)) |
| 2929 | { | 2926 | { |
| 2930 | delete_all_child_windows (r->vchild); | 2927 | delete_all_child_windows (r->contents); |
| 2931 | wset_vchild (r, Qnil); | 2928 | wset_combination (r, 0, Qnil); |
| 2932 | } | ||
| 2933 | else if (!NILP (r->hchild)) | ||
| 2934 | { | ||
| 2935 | delete_all_child_windows (r->hchild); | ||
| 2936 | wset_hchild (r, Qnil); | ||
| 2937 | } | 2929 | } |
| 2938 | 2930 | ||
| 2939 | replace_window (root, window, 1); | 2931 | replace_window (root, window, 1); |
| 2940 | 2932 | ||
| 2941 | /* This must become SWINDOW anyway ....... */ | 2933 | /* This must become SWINDOW anyway ....... */ |
| 2942 | if (!NILP (w->buffer) && !resize_failed) | 2934 | if (BUFFERP (w->contents) && !resize_failed) |
| 2943 | { | 2935 | { |
| 2944 | /* Try to minimize scrolling, by setting the window start to the | 2936 | /* Try to minimize scrolling, by setting the window start to the |
| 2945 | point will cause the text at the old window start to be at the | 2937 | point will cause the text at the old window start to be at the |
| @@ -2948,18 +2940,18 @@ window-start value is reasonable when this function is called. */) | |||
| 2948 | when the display is not current, due to typeahead). */ | 2940 | when the display is not current, due to typeahead). */ |
| 2949 | new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); | 2941 | new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); |
| 2950 | if (new_top != top | 2942 | if (new_top != top |
| 2951 | && startpos >= BUF_BEGV (XBUFFER (w->buffer)) | 2943 | && startpos >= BUF_BEGV (XBUFFER (w->contents)) |
| 2952 | && startpos <= BUF_ZV (XBUFFER (w->buffer))) | 2944 | && startpos <= BUF_ZV (XBUFFER (w->contents))) |
| 2953 | { | 2945 | { |
| 2954 | struct position pos; | 2946 | struct position pos; |
| 2955 | struct buffer *obuf = current_buffer; | 2947 | struct buffer *obuf = current_buffer; |
| 2956 | 2948 | ||
| 2957 | Fset_buffer (w->buffer); | 2949 | Fset_buffer (w->contents); |
| 2958 | /* This computation used to temporarily move point, but that | 2950 | /* This computation used to temporarily move point, but that |
| 2959 | can have unwanted side effects due to text properties. */ | 2951 | can have unwanted side effects due to text properties. */ |
| 2960 | pos = *vmotion (startpos, startbyte, -top, w); | 2952 | pos = *vmotion (startpos, startbyte, -top, w); |
| 2961 | 2953 | ||
| 2962 | set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); | 2954 | set_marker_both (w->start, w->contents, pos.bufpos, pos.bytepos); |
| 2963 | w->window_end_valid = 0; | 2955 | w->window_end_valid = 0; |
| 2964 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE | 2956 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE |
| 2965 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); | 2957 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); |
| @@ -3159,7 +3151,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, | |||
| 3159 | struct window *w = XWINDOW (window); | 3151 | struct window *w = XWINDOW (window); |
| 3160 | struct buffer *b = XBUFFER (buffer); | 3152 | struct buffer *b = XBUFFER (buffer); |
| 3161 | ptrdiff_t count = SPECPDL_INDEX (); | 3153 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3162 | int samebuf = EQ (buffer, w->buffer); | 3154 | int samebuf = EQ (buffer, w->contents); |
| 3163 | 3155 | ||
| 3164 | wset_buffer (w, buffer); | 3156 | wset_buffer (w, buffer); |
| 3165 | 3157 | ||
| @@ -3278,7 +3270,7 @@ This function runs `window-scroll-functions' before running | |||
| 3278 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) | 3270 | if (!BUFFER_LIVE_P (XBUFFER (buffer))) |
| 3279 | error ("Attempt to display deleted buffer"); | 3271 | error ("Attempt to display deleted buffer"); |
| 3280 | 3272 | ||
| 3281 | tem = w->buffer; | 3273 | tem = w->contents; |
| 3282 | if (NILP (tem)) | 3274 | if (NILP (tem)) |
| 3283 | error ("Window is deleted"); | 3275 | error ("Window is deleted"); |
| 3284 | else | 3276 | else |
| @@ -3331,8 +3323,8 @@ displaying that buffer. */) | |||
| 3331 | struct window *w = XWINDOW (object); | 3323 | struct window *w = XWINDOW (object); |
| 3332 | mark_window_display_accurate (object, 0); | 3324 | mark_window_display_accurate (object, 0); |
| 3333 | w->update_mode_line = 1; | 3325 | w->update_mode_line = 1; |
| 3334 | if (BUFFERP (w->buffer)) | 3326 | if (BUFFERP (w->contents)) |
| 3335 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 3327 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 3336 | ++update_mode_lines; | 3328 | ++update_mode_lines; |
| 3337 | return Qt; | 3329 | return Qt; |
| 3338 | } | 3330 | } |
| @@ -3401,7 +3393,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3401 | record_unwind_protect (Fset_buffer, prev_buffer); | 3393 | record_unwind_protect (Fset_buffer, prev_buffer); |
| 3402 | record_unwind_protect (select_window_norecord, prev_window); | 3394 | record_unwind_protect (select_window_norecord, prev_window); |
| 3403 | Fselect_window (window, Qt); | 3395 | Fselect_window (window, Qt); |
| 3404 | Fset_buffer (w->buffer); | 3396 | Fset_buffer (w->contents); |
| 3405 | Frun_hooks (1, &Qtemp_buffer_show_hook); | 3397 | Frun_hooks (1, &Qtemp_buffer_show_hook); |
| 3406 | unbind_to (count, Qnil); | 3398 | unbind_to (count, Qnil); |
| 3407 | } | 3399 | } |
| @@ -3422,7 +3414,7 @@ make_parent_window (Lisp_Object window, bool horflag) | |||
| 3422 | memcpy ((char *) p + sizeof (struct vectorlike_header), | 3414 | memcpy ((char *) p + sizeof (struct vectorlike_header), |
| 3423 | (char *) o + sizeof (struct vectorlike_header), | 3415 | (char *) o + sizeof (struct vectorlike_header), |
| 3424 | word_size * VECSIZE (struct window)); | 3416 | word_size * VECSIZE (struct window)); |
| 3425 | /* P's buffer slot may change from nil to a buffer. */ | 3417 | /* P's buffer slot may change from nil to a buffer... */ |
| 3426 | adjust_window_count (p, 1); | 3418 | adjust_window_count (p, 1); |
| 3427 | XSETWINDOW (parent, p); | 3419 | XSETWINDOW (parent, p); |
| 3428 | 3420 | ||
| @@ -3431,12 +3423,11 @@ make_parent_window (Lisp_Object window, bool horflag) | |||
| 3431 | wset_next (o, Qnil); | 3423 | wset_next (o, Qnil); |
| 3432 | wset_prev (o, Qnil); | 3424 | wset_prev (o, Qnil); |
| 3433 | wset_parent (o, parent); | 3425 | wset_parent (o, parent); |
| 3434 | 3426 | /* ...but now P becomes an internal window. */ | |
| 3435 | wset_hchild (p, horflag ? window : Qnil); | ||
| 3436 | wset_vchild (p, horflag ? Qnil : window); | ||
| 3437 | wset_start (p, Qnil); | 3427 | wset_start (p, Qnil); |
| 3438 | wset_pointm (p, Qnil); | 3428 | wset_pointm (p, Qnil); |
| 3439 | wset_buffer (p, Qnil); | 3429 | wset_buffer (p, Qnil); |
| 3430 | wset_combination (p, horflag, window); | ||
| 3440 | wset_combination_limit (p, Qnil); | 3431 | wset_combination_limit (p, Qnil); |
| 3441 | wset_window_parameters (p, Qnil); | 3432 | wset_window_parameters (p, Qnil); |
| 3442 | } | 3433 | } |
| @@ -3525,10 +3516,10 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3525 | { | 3516 | { |
| 3526 | struct window *c; | 3517 | struct window *c; |
| 3527 | 3518 | ||
| 3528 | if (!NILP (w->vchild)) | 3519 | if (WINDOW_VERTICAL_COMBINATION_P (w)) |
| 3529 | /* W is a vertical combination. */ | 3520 | /* W is a vertical combination. */ |
| 3530 | { | 3521 | { |
| 3531 | c = XWINDOW (w->vchild); | 3522 | c = XWINDOW (w->contents); |
| 3532 | if (horflag) | 3523 | if (horflag) |
| 3533 | /* All child windows of W must have the same width as W. */ | 3524 | /* All child windows of W must have the same width as W. */ |
| 3534 | { | 3525 | { |
| @@ -3556,10 +3547,10 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3556 | return (sum_of_sizes == XINT (w->new_total)); | 3547 | return (sum_of_sizes == XINT (w->new_total)); |
| 3557 | } | 3548 | } |
| 3558 | } | 3549 | } |
| 3559 | else if (!NILP (w->hchild)) | 3550 | else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) |
| 3560 | /* W is a horizontal combination. */ | 3551 | /* W is a horizontal combination. */ |
| 3561 | { | 3552 | { |
| 3562 | c = XWINDOW (w->hchild); | 3553 | c = XWINDOW (w->contents); |
| 3563 | if (horflag) | 3554 | if (horflag) |
| 3564 | /* The sum of the widths of the child windows of W must equal W's | 3555 | /* The sum of the widths of the child windows of W must equal W's |
| 3565 | width. */ | 3556 | width. */ |
| @@ -3626,10 +3617,10 @@ window_resize_apply (struct window *w, bool horflag) | |||
| 3626 | pos = w->top_line; | 3617 | pos = w->top_line; |
| 3627 | } | 3618 | } |
| 3628 | 3619 | ||
| 3629 | if (!NILP (w->vchild)) | 3620 | if (WINDOW_VERTICAL_COMBINATION_P (w)) |
| 3630 | /* W is a vertical combination. */ | 3621 | /* W is a vertical combination. */ |
| 3631 | { | 3622 | { |
| 3632 | c = XWINDOW (w->vchild); | 3623 | c = XWINDOW (w->contents); |
| 3633 | while (c) | 3624 | while (c) |
| 3634 | { | 3625 | { |
| 3635 | if (horflag) | 3626 | if (horflag) |
| @@ -3642,10 +3633,10 @@ window_resize_apply (struct window *w, bool horflag) | |||
| 3642 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3633 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3643 | } | 3634 | } |
| 3644 | } | 3635 | } |
| 3645 | else if (!NILP (w->hchild)) | 3636 | else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) |
| 3646 | /* W is a horizontal combination. */ | 3637 | /* W is a horizontal combination. */ |
| 3647 | { | 3638 | { |
| 3648 | c = XWINDOW (w->hchild); | 3639 | c = XWINDOW (w->contents); |
| 3649 | while (c) | 3640 | while (c) |
| 3650 | { | 3641 | { |
| 3651 | if (horflag) | 3642 | if (horflag) |
| @@ -3728,7 +3719,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag) | |||
| 3728 | ? 1 : 0))); | 3719 | ? 1 : 0))); |
| 3729 | 3720 | ||
| 3730 | r->top_line = FRAME_TOP_MARGIN (f); | 3721 | r->top_line = FRAME_TOP_MARGIN (f); |
| 3731 | if (NILP (r->vchild) && NILP (r->hchild)) | 3722 | if (WINDOW_LEAF_P (r)) |
| 3732 | /* For a leaf root window just set the size. */ | 3723 | /* For a leaf root window just set the size. */ |
| 3733 | if (horflag) | 3724 | if (horflag) |
| 3734 | r->total_cols = new_size; | 3725 | r->total_cols = new_size; |
| @@ -3843,9 +3834,9 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3843 | combination_limit = | 3834 | combination_limit = |
| 3844 | EQ (Vwindow_combination_limit, Qt) | 3835 | EQ (Vwindow_combination_limit, Qt) |
| 3845 | || NILP (o->parent) | 3836 | || NILP (o->parent) |
| 3846 | || NILP (horflag | 3837 | || (horflag |
| 3847 | ? (XWINDOW (o->parent)->hchild) | 3838 | ? WINDOW_VERTICAL_COMBINATION_P (XWINDOW (o->parent)) |
| 3848 | : (XWINDOW (o->parent)->vchild)); | 3839 | : WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (o->parent))); |
| 3849 | 3840 | ||
| 3850 | /* We need a live reference window to initialize some parameters. */ | 3841 | /* We need a live reference window to initialize some parameters. */ |
| 3851 | if (WINDOW_LIVE_P (old)) | 3842 | if (WINDOW_LIVE_P (old)) |
| @@ -3915,17 +3906,12 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3915 | n = XWINDOW (new); | 3906 | n = XWINDOW (new); |
| 3916 | wset_frame (n, frame); | 3907 | wset_frame (n, frame); |
| 3917 | wset_parent (n, o->parent); | 3908 | wset_parent (n, o->parent); |
| 3918 | wset_vchild (n, Qnil); | ||
| 3919 | wset_hchild (n, Qnil); | ||
| 3920 | 3909 | ||
| 3921 | if (EQ (side, Qabove) || EQ (side, Qleft)) | 3910 | if (EQ (side, Qabove) || EQ (side, Qleft)) |
| 3922 | { | 3911 | { |
| 3923 | wset_prev (n, o->prev); | 3912 | wset_prev (n, o->prev); |
| 3924 | if (NILP (n->prev)) | 3913 | if (NILP (n->prev)) |
| 3925 | if (horflag) | 3914 | wset_combination (p, horflag, new); |
| 3926 | wset_hchild (p, new); | ||
| 3927 | else | ||
| 3928 | wset_vchild (p, new); | ||
| 3929 | else | 3915 | else |
| 3930 | wset_next (XWINDOW (n->prev), new); | 3916 | wset_next (XWINDOW (n->prev), new); |
| 3931 | wset_next (n, old); | 3917 | wset_next (n, old); |
| @@ -3974,7 +3960,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3974 | adjust_glyphs (f); | 3960 | adjust_glyphs (f); |
| 3975 | /* Set buffer of NEW to buffer of reference window. Don't run | 3961 | /* Set buffer of NEW to buffer of reference window. Don't run |
| 3976 | any hooks. */ | 3962 | any hooks. */ |
| 3977 | set_window_buffer (new, r->buffer, 0, 1); | 3963 | set_window_buffer (new, r->contents, 0, 1); |
| 3978 | unblock_input (); | 3964 | unblock_input (); |
| 3979 | 3965 | ||
| 3980 | /* Maybe we should run the scroll functions in Elisp (which already | 3966 | /* Maybe we should run the scroll functions in Elisp (which already |
| @@ -3996,13 +3982,11 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3996 | register Lisp_Object parent, sibling, frame, root; | 3982 | register Lisp_Object parent, sibling, frame, root; |
| 3997 | struct window *w, *p, *s, *r; | 3983 | struct window *w, *p, *s, *r; |
| 3998 | struct frame *f; | 3984 | struct frame *f; |
| 3999 | bool horflag; | 3985 | bool horflag, before_sibling = 0; |
| 4000 | int before_sibling = 0; | ||
| 4001 | 3986 | ||
| 4002 | w = decode_any_window (window); | 3987 | w = decode_any_window (window); |
| 4003 | XSETWINDOW (window, w); | 3988 | XSETWINDOW (window, w); |
| 4004 | if (NILP (w->buffer) | 3989 | if (NILP (w->contents)) |
| 4005 | && NILP (w->hchild) && NILP (w->vchild)) | ||
| 4006 | /* It's a no-op to delete an already deleted window. */ | 3990 | /* It's a no-op to delete an already deleted window. */ |
| 4007 | return Qnil; | 3991 | return Qnil; |
| 4008 | 3992 | ||
| @@ -4016,7 +4000,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4016 | error ("Attempt to delete sole window of parent"); | 4000 | error ("Attempt to delete sole window of parent"); |
| 4017 | 4001 | ||
| 4018 | p = XWINDOW (parent); | 4002 | p = XWINDOW (parent); |
| 4019 | horflag = NILP (p->vchild); | 4003 | horflag = WINDOW_HORIZONTAL_COMBINATION_P (p); |
| 4020 | 4004 | ||
| 4021 | frame = WINDOW_FRAME (w); | 4005 | frame = WINDOW_FRAME (w); |
| 4022 | f = XFRAME (frame); | 4006 | f = XFRAME (frame); |
| @@ -4034,10 +4018,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4034 | sibling = w->next; | 4018 | sibling = w->next; |
| 4035 | s = XWINDOW (sibling); | 4019 | s = XWINDOW (sibling); |
| 4036 | wset_prev (s, Qnil); | 4020 | wset_prev (s, Qnil); |
| 4037 | if (horflag) | 4021 | wset_combination (p, horflag, sibling); |
| 4038 | wset_hchild (p, sibling); | ||
| 4039 | else | ||
| 4040 | wset_vchild (p, sibling); | ||
| 4041 | } | 4022 | } |
| 4042 | else | 4023 | else |
| 4043 | /* Get SIBLING above (on the left of) WINDOW. */ | 4024 | /* Get SIBLING above (on the left of) WINDOW. */ |
| @@ -4079,17 +4060,12 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4079 | wset_next (w, Qnil); /* Don't delete w->next too. */ | 4060 | wset_next (w, Qnil); /* Don't delete w->next too. */ |
| 4080 | free_window_matrices (w); | 4061 | free_window_matrices (w); |
| 4081 | 4062 | ||
| 4082 | if (!NILP (w->vchild)) | 4063 | if (WINDOWP (w->contents)) |
| 4083 | { | 4064 | { |
| 4084 | delete_all_child_windows (w->vchild); | 4065 | delete_all_child_windows (w->contents); |
| 4085 | wset_vchild (w, Qnil); | 4066 | wset_combination (w, 0, Qnil); |
| 4086 | } | 4067 | } |
| 4087 | else if (!NILP (w->hchild)) | 4068 | else |
| 4088 | { | ||
| 4089 | delete_all_child_windows (w->hchild); | ||
| 4090 | wset_hchild (w, Qnil); | ||
| 4091 | } | ||
| 4092 | else if (!NILP (w->buffer)) | ||
| 4093 | { | 4069 | { |
| 4094 | unshow_buffer (w); | 4070 | unshow_buffer (w); |
| 4095 | unchain_marker (XMARKER (w->pointm)); | 4071 | unchain_marker (XMARKER (w->pointm)); |
| @@ -4108,8 +4084,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4108 | wset_normal_cols (s, p->normal_cols); | 4084 | wset_normal_cols (s, p->normal_cols); |
| 4109 | wset_normal_lines (s, p->normal_lines); | 4085 | wset_normal_lines (s, p->normal_lines); |
| 4110 | /* Mark PARENT as deleted. */ | 4086 | /* Mark PARENT as deleted. */ |
| 4111 | wset_vchild (p, Qnil); | 4087 | wset_combination (p, 0, Qnil); |
| 4112 | wset_hchild (p, Qnil); | ||
| 4113 | /* Try to merge SIBLING into its new parent. */ | 4088 | /* Try to merge SIBLING into its new parent. */ |
| 4114 | recombine_windows (sibling); | 4089 | recombine_windows (sibling); |
| 4115 | } | 4090 | } |
| @@ -4157,10 +4132,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4157 | if (before_sibling) | 4132 | if (before_sibling) |
| 4158 | { | 4133 | { |
| 4159 | wset_prev (s, window); | 4134 | wset_prev (s, window); |
| 4160 | if (horflag) | 4135 | wset_combination (p, horflag, window); |
| 4161 | wset_hchild (p, window); | ||
| 4162 | else | ||
| 4163 | wset_vchild (p, window); | ||
| 4164 | } | 4136 | } |
| 4165 | else | 4137 | else |
| 4166 | { | 4138 | { |
| @@ -4303,10 +4275,8 @@ mark_window_cursors_off (struct window *w) | |||
| 4303 | { | 4275 | { |
| 4304 | while (w) | 4276 | while (w) |
| 4305 | { | 4277 | { |
| 4306 | if (!NILP (w->hchild)) | 4278 | if (WINDOWP (w->contents)) |
| 4307 | mark_window_cursors_off (XWINDOW (w->hchild)); | 4279 | mark_window_cursors_off (XWINDOW (w->contents)); |
| 4308 | else if (!NILP (w->vchild)) | ||
| 4309 | mark_window_cursors_off (XWINDOW (w->vchild)); | ||
| 4310 | else | 4280 | else |
| 4311 | w->phys_cursor_on_p = 0; | 4281 | w->phys_cursor_on_p = 0; |
| 4312 | 4282 | ||
| @@ -4325,8 +4295,7 @@ window_internal_height (struct window *w) | |||
| 4325 | if (!MINI_WINDOW_P (w)) | 4295 | if (!MINI_WINDOW_P (w)) |
| 4326 | { | 4296 | { |
| 4327 | if (!NILP (w->parent) | 4297 | if (!NILP (w->parent) |
| 4328 | || !NILP (w->vchild) | 4298 | || WINDOWP (w->contents) |
| 4329 | || !NILP (w->hchild) | ||
| 4330 | || !NILP (w->next) | 4299 | || !NILP (w->next) |
| 4331 | || !NILP (w->prev) | 4300 | || !NILP (w->prev) |
| 4332 | || WINDOW_WANTS_MODELINE_P (w)) | 4301 | || WINDOW_WANTS_MODELINE_P (w)) |
| @@ -4465,7 +4434,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4465 | else | 4434 | else |
| 4466 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); | 4435 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); |
| 4467 | set_marker_restricted (w->start, make_number (spos), | 4436 | set_marker_restricted (w->start, make_number (spos), |
| 4468 | w->buffer); | 4437 | w->contents); |
| 4469 | w->start_at_line_beg = 1; | 4438 | w->start_at_line_beg = 1; |
| 4470 | w->update_mode_line = 1; | 4439 | w->update_mode_line = 1; |
| 4471 | w->last_modified = 0; | 4440 | w->last_modified = 0; |
| @@ -4589,7 +4558,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4589 | 4558 | ||
| 4590 | /* If control gets here, then we vscrolled. */ | 4559 | /* If control gets here, then we vscrolled. */ |
| 4591 | 4560 | ||
| 4592 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 4561 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 4593 | 4562 | ||
| 4594 | /* Don't try to change the window start below. */ | 4563 | /* Don't try to change the window start below. */ |
| 4595 | vscrolled = 1; | 4564 | vscrolled = 1; |
| @@ -4609,7 +4578,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4609 | } | 4578 | } |
| 4610 | 4579 | ||
| 4611 | /* Set the window start, and set up the window for redisplay. */ | 4580 | /* Set the window start, and set up the window for redisplay. */ |
| 4612 | set_marker_restricted_both (w->start, w->buffer, IT_CHARPOS (it), | 4581 | set_marker_restricted_both (w->start, w->contents, IT_CHARPOS (it), |
| 4613 | IT_BYTEPOS (it)); | 4582 | IT_BYTEPOS (it)); |
| 4614 | bytepos = marker_byte_position (w->start); | 4583 | bytepos = marker_byte_position (w->start); |
| 4615 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); | 4584 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); |
| @@ -4809,7 +4778,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4809 | int this_scroll_margin = | 4778 | int this_scroll_margin = |
| 4810 | max (0, min (scroll_margin, w->total_lines / 4)); | 4779 | max (0, min (scroll_margin, w->total_lines / 4)); |
| 4811 | 4780 | ||
| 4812 | set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); | 4781 | set_marker_restricted_both (w->start, w->contents, pos, pos_byte); |
| 4813 | w->start_at_line_beg = !NILP (bolp); | 4782 | w->start_at_line_beg = !NILP (bolp); |
| 4814 | w->update_mode_line = 1; | 4783 | w->update_mode_line = 1; |
| 4815 | w->last_modified = 0; | 4784 | w->last_modified = 0; |
| @@ -4903,10 +4872,10 @@ scroll_command (Lisp_Object n, int direction) | |||
| 4903 | 4872 | ||
| 4904 | /* If selected window's buffer isn't current, make it current for | 4873 | /* If selected window's buffer isn't current, make it current for |
| 4905 | the moment. But don't screw up if window_scroll gets an error. */ | 4874 | the moment. But don't screw up if window_scroll gets an error. */ |
| 4906 | if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) | 4875 | if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer) |
| 4907 | { | 4876 | { |
| 4908 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 4877 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 4909 | Fset_buffer (XWINDOW (selected_window)->buffer); | 4878 | Fset_buffer (XWINDOW (selected_window)->contents); |
| 4910 | 4879 | ||
| 4911 | /* Make redisplay consider other windows than just selected_window. */ | 4880 | /* Make redisplay consider other windows than just selected_window. */ |
| 4912 | ++windows_or_buffers_changed; | 4881 | ++windows_or_buffers_changed; |
| @@ -5021,7 +4990,7 @@ specifies the window to scroll. This takes precedence over | |||
| 5021 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 4990 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 5022 | ++windows_or_buffers_changed; | 4991 | ++windows_or_buffers_changed; |
| 5023 | 4992 | ||
| 5024 | Fset_buffer (w->buffer); | 4993 | Fset_buffer (w->contents); |
| 5025 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); | 4994 | SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); |
| 5026 | 4995 | ||
| 5027 | if (NILP (arg)) | 4996 | if (NILP (arg)) |
| @@ -5115,10 +5084,10 @@ displayed_window_lines (struct window *w) | |||
| 5115 | int bottom_y; | 5084 | int bottom_y; |
| 5116 | void *itdata = NULL; | 5085 | void *itdata = NULL; |
| 5117 | 5086 | ||
| 5118 | if (XBUFFER (w->buffer) != current_buffer) | 5087 | if (XBUFFER (w->contents) != current_buffer) |
| 5119 | { | 5088 | { |
| 5120 | old_buffer = current_buffer; | 5089 | old_buffer = current_buffer; |
| 5121 | set_buffer_internal (XBUFFER (w->buffer)); | 5090 | set_buffer_internal (XBUFFER (w->contents)); |
| 5122 | } | 5091 | } |
| 5123 | else | 5092 | else |
| 5124 | old_buffer = NULL; | 5093 | old_buffer = NULL; |
| @@ -5180,7 +5149,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5180 | (register Lisp_Object arg) | 5149 | (register Lisp_Object arg) |
| 5181 | { | 5150 | { |
| 5182 | struct window *w = XWINDOW (selected_window); | 5151 | struct window *w = XWINDOW (selected_window); |
| 5183 | struct buffer *buf = XBUFFER (w->buffer); | 5152 | struct buffer *buf = XBUFFER (w->contents); |
| 5184 | struct buffer *obuf = current_buffer; | 5153 | struct buffer *obuf = current_buffer; |
| 5185 | int center_p = 0; | 5154 | int center_p = 0; |
| 5186 | ptrdiff_t charpos, bytepos; | 5155 | ptrdiff_t charpos, bytepos; |
| @@ -5346,7 +5315,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5346 | } | 5315 | } |
| 5347 | 5316 | ||
| 5348 | /* Set the new window start. */ | 5317 | /* Set the new window start. */ |
| 5349 | set_marker_both (w->start, w->buffer, charpos, bytepos); | 5318 | set_marker_both (w->start, w->contents, charpos, bytepos); |
| 5350 | w->window_end_valid = 0; | 5319 | w->window_end_valid = 0; |
| 5351 | 5320 | ||
| 5352 | w->optional_new_start = 1; | 5321 | w->optional_new_start = 1; |
| @@ -5390,9 +5359,8 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 5390 | int this_scroll_margin; | 5359 | int this_scroll_margin; |
| 5391 | #endif | 5360 | #endif |
| 5392 | 5361 | ||
| 5393 | if (!(BUFFERP (w->buffer) | 5362 | if (!(BUFFERP (w->contents) && XBUFFER (w->contents) == current_buffer)) |
| 5394 | && XBUFFER (w->buffer) == current_buffer)) | 5363 | /* This test is needed to make sure PT/PT_BYTE make sense in w->contents |
| 5395 | /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer | ||
| 5396 | when passed below to set_marker_both. */ | 5364 | when passed below to set_marker_both. */ |
| 5397 | error ("move-to-window-line called from unrelated buffer"); | 5365 | error ("move-to-window-line called from unrelated buffer"); |
| 5398 | 5366 | ||
| @@ -5402,7 +5370,7 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 5402 | { | 5370 | { |
| 5403 | int height = window_internal_height (w); | 5371 | int height = window_internal_height (w); |
| 5404 | Fvertical_motion (make_number (- (height / 2)), window); | 5372 | Fvertical_motion (make_number (- (height / 2)), window); |
| 5405 | set_marker_both (w->start, w->buffer, PT, PT_BYTE); | 5373 | set_marker_both (w->start, w->contents, PT, PT_BYTE); |
| 5406 | w->start_at_line_beg = !NILP (Fbolp ()); | 5374 | w->start_at_line_beg = !NILP (Fbolp ()); |
| 5407 | w->force_start = 1; | 5375 | w->force_start = 1; |
| 5408 | } | 5376 | } |
| @@ -5552,9 +5520,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5552 | window-point of the final-selected-window to the window-point of | 5520 | window-point of the final-selected-window to the window-point of |
| 5553 | the current-selected-window. So we have to be careful which | 5521 | the current-selected-window. So we have to be careful which |
| 5554 | point of the current-buffer we copy into old_point. */ | 5522 | point of the current-buffer we copy into old_point. */ |
| 5555 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | 5523 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) |
| 5556 | && WINDOWP (selected_window) | 5524 | && WINDOWP (selected_window) |
| 5557 | && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) | 5525 | && EQ (XWINDOW (selected_window)->contents, new_current_buffer) |
| 5558 | && !EQ (selected_window, data->current_window)) | 5526 | && !EQ (selected_window, data->current_window)) |
| 5559 | old_point = marker_position (XWINDOW (data->current_window)->pointm); | 5527 | old_point = marker_position (XWINDOW (data->current_window)->pointm); |
| 5560 | else | 5528 | else |
| @@ -5568,7 +5536,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5568 | So if possible we want this arbitrary choice of "which point" to | 5536 | So if possible we want this arbitrary choice of "which point" to |
| 5569 | be the one from the to-be-selected-window so as to prevent this | 5537 | be the one from the to-be-selected-window so as to prevent this |
| 5570 | window's cursor from being copied from another window. */ | 5538 | window's cursor from being copied from another window. */ |
| 5571 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | 5539 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) |
| 5572 | /* If current_window = selected_window, its point is in BUF_PT. */ | 5540 | /* If current_window = selected_window, its point is in BUF_PT. */ |
| 5573 | && !EQ (selected_window, data->current_window)) | 5541 | && !EQ (selected_window, data->current_window)) |
| 5574 | old_point = marker_position (XWINDOW (data->current_window)->pointm); | 5542 | old_point = marker_position (XWINDOW (data->current_window)->pointm); |
| @@ -5610,8 +5578,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5610 | p = SAVED_WINDOW_N (saved_windows, k); | 5578 | p = SAVED_WINDOW_N (saved_windows, k); |
| 5611 | window = p->window; | 5579 | window = p->window; |
| 5612 | w = XWINDOW (window); | 5580 | w = XWINDOW (window); |
| 5613 | if (!NILP (w->buffer) | 5581 | if (BUFFERP (w->contents) |
| 5614 | && !EQ (w->buffer, p->buffer) | 5582 | && !EQ (w->contents, p->buffer) |
| 5615 | && BUFFER_LIVE_P (XBUFFER (p->buffer))) | 5583 | && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5616 | /* If a window we restore gets another buffer, record the | 5584 | /* If a window we restore gets another buffer, record the |
| 5617 | window's old buffer. */ | 5585 | window's old buffer. */ |
| @@ -5644,13 +5612,13 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5644 | window holds garbage.) We do this now, before | 5612 | window holds garbage.) We do this now, before |
| 5645 | restoring the window contents, and prevent it from | 5613 | restoring the window contents, and prevent it from |
| 5646 | being done later on when we select a new window. */ | 5614 | being done later on when we select a new window. */ |
| 5647 | if (! NILP (XWINDOW (selected_window)->buffer)) | 5615 | if (! NILP (XWINDOW (selected_window)->contents)) |
| 5648 | { | 5616 | { |
| 5649 | w = XWINDOW (selected_window); | 5617 | w = XWINDOW (selected_window); |
| 5650 | set_marker_both (w->pointm, | 5618 | set_marker_both (w->pointm, |
| 5651 | w->buffer, | 5619 | w->contents, |
| 5652 | BUF_PT (XBUFFER (w->buffer)), | 5620 | BUF_PT (XBUFFER (w->contents)), |
| 5653 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 5621 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 5654 | } | 5622 | } |
| 5655 | 5623 | ||
| 5656 | windows_or_buffers_changed++; | 5624 | windows_or_buffers_changed++; |
| @@ -5697,18 +5665,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5697 | { | 5665 | { |
| 5698 | wset_prev (w, Qnil); | 5666 | wset_prev (w, Qnil); |
| 5699 | if (!NILP (w->parent)) | 5667 | if (!NILP (w->parent)) |
| 5700 | { | 5668 | wset_combination (XWINDOW (w->parent), |
| 5701 | if (XINT (p->total_cols) == XWINDOW (w->parent)->total_cols) | 5669 | (XINT (p->total_cols) |
| 5702 | { | 5670 | != XWINDOW (w->parent)->total_cols), |
| 5703 | wset_vchild (XWINDOW (w->parent), p->window); | 5671 | p->window); |
| 5704 | wset_hchild (XWINDOW (w->parent), Qnil); | ||
| 5705 | } | ||
| 5706 | else | ||
| 5707 | { | ||
| 5708 | wset_hchild (XWINDOW (w->parent), p->window); | ||
| 5709 | wset_vchild (XWINDOW (w->parent), Qnil); | ||
| 5710 | } | ||
| 5711 | } | ||
| 5712 | } | 5672 | } |
| 5713 | 5673 | ||
| 5714 | /* If we squirreled away the buffer, restore it now. */ | 5674 | /* If we squirreled away the buffer, restore it now. */ |
| @@ -5757,20 +5717,16 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5757 | w->last_modified = 0; | 5717 | w->last_modified = 0; |
| 5758 | w->last_overlay_modified = 0; | 5718 | w->last_overlay_modified = 0; |
| 5759 | 5719 | ||
| 5760 | /* Reinstall the saved buffer and pointers into it. */ | 5720 | if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) |
| 5761 | if (NILP (p->buffer)) | ||
| 5762 | /* An internal window. */ | ||
| 5763 | wset_buffer (w, p->buffer); | ||
| 5764 | else if (BUFFER_LIVE_P (XBUFFER (p->buffer))) | ||
| 5765 | /* If saved buffer is alive, install it. */ | 5721 | /* If saved buffer is alive, install it. */ |
| 5766 | { | 5722 | { |
| 5767 | wset_buffer (w, p->buffer); | 5723 | wset_buffer (w, p->buffer); |
| 5768 | w->start_at_line_beg = !NILP (p->start_at_line_beg); | 5724 | w->start_at_line_beg = !NILP (p->start_at_line_beg); |
| 5769 | set_marker_restricted (w->start, p->start, w->buffer); | 5725 | set_marker_restricted (w->start, p->start, w->contents); |
| 5770 | set_marker_restricted (w->pointm, p->pointm, | 5726 | set_marker_restricted (w->pointm, p->pointm, |
| 5771 | w->buffer); | 5727 | w->contents); |
| 5772 | Fset_marker (BVAR (XBUFFER (w->buffer), mark), | 5728 | Fset_marker (BVAR (XBUFFER (w->contents), mark), |
| 5773 | p->mark, w->buffer); | 5729 | p->mark, w->contents); |
| 5774 | 5730 | ||
| 5775 | /* As documented in Fcurrent_window_configuration, don't | 5731 | /* As documented in Fcurrent_window_configuration, don't |
| 5776 | restore the location of point in the buffer which was | 5732 | restore the location of point in the buffer which was |
| @@ -5779,23 +5735,21 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5779 | && XBUFFER (p->buffer) == current_buffer) | 5735 | && XBUFFER (p->buffer) == current_buffer) |
| 5780 | Fgoto_char (w->pointm); | 5736 | Fgoto_char (w->pointm); |
| 5781 | } | 5737 | } |
| 5782 | else if (!NILP (w->buffer) | 5738 | else if (BUFFERP (w->contents) && BUFFER_LIVE_P (XBUFFER (w->contents))) |
| 5783 | && BUFFER_LIVE_P (XBUFFER (w->buffer))) | 5739 | /* Keep window's old buffer; make sure the markers are real. */ |
| 5784 | /* Keep window's old buffer; make sure the markers are | 5740 | { |
| 5785 | real. */ | 5741 | /* Set window markers at start of visible range. */ |
| 5786 | { | 5742 | if (XMARKER (w->start)->buffer == 0) |
| 5787 | /* Set window markers at start of visible range. */ | 5743 | set_marker_restricted_both (w->start, w->contents, 0, 0); |
| 5788 | if (XMARKER (w->start)->buffer == 0) | 5744 | if (XMARKER (w->pointm)->buffer == 0) |
| 5789 | set_marker_restricted_both (w->start, w->buffer, 0, 0); | 5745 | set_marker_restricted_both |
| 5790 | if (XMARKER (w->pointm)->buffer == 0) | 5746 | (w->pointm, w->contents, |
| 5791 | set_marker_restricted_both | 5747 | BUF_PT (XBUFFER (w->contents)), |
| 5792 | (w->pointm, w->buffer, | 5748 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 5793 | BUF_PT (XBUFFER (w->buffer)), | 5749 | w->start_at_line_beg = 1; |
| 5794 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 5750 | } |
| 5795 | w->start_at_line_beg = 1; | 5751 | else if (!NILP (w->start)) |
| 5796 | } | 5752 | /* Leaf window has no live buffer, get one. */ |
| 5797 | else | ||
| 5798 | /* Window has no live buffer, get one. */ | ||
| 5799 | { | 5753 | { |
| 5800 | /* Get the buffer via other_buffer_safely in order to | 5754 | /* Get the buffer via other_buffer_safely in order to |
| 5801 | avoid showing an unimportant buffer and, if necessary, to | 5755 | avoid showing an unimportant buffer and, if necessary, to |
| @@ -5804,8 +5758,8 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5804 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); | 5758 | wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); |
| 5805 | /* This will set the markers to beginning of visible | 5759 | /* This will set the markers to beginning of visible |
| 5806 | range. */ | 5760 | range. */ |
| 5807 | set_marker_restricted_both (w->start, w->buffer, 0, 0); | 5761 | set_marker_restricted_both (w->start, w->contents, 0, 0); |
| 5808 | set_marker_restricted_both (w->pointm, w->buffer, 0, 0); | 5762 | set_marker_restricted_both (w->pointm, w->contents, 0, 0); |
| 5809 | w->start_at_line_beg = 1; | 5763 | w->start_at_line_beg = 1; |
| 5810 | if (!NILP (w->dedicated)) | 5764 | if (!NILP (w->dedicated)) |
| 5811 | /* Record this window as dead. */ | 5765 | /* Record this window as dead. */ |
| @@ -5818,17 +5772,17 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5818 | fset_root_window (f, data->root_window); | 5772 | fset_root_window (f, data->root_window); |
| 5819 | /* Arrange *not* to restore point in the buffer that was | 5773 | /* Arrange *not* to restore point in the buffer that was |
| 5820 | current when the window configuration was saved. */ | 5774 | current when the window configuration was saved. */ |
| 5821 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | 5775 | if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) |
| 5822 | set_marker_restricted (XWINDOW (data->current_window)->pointm, | 5776 | set_marker_restricted (XWINDOW (data->current_window)->pointm, |
| 5823 | make_number (old_point), | 5777 | make_number (old_point), |
| 5824 | XWINDOW (data->current_window)->buffer); | 5778 | XWINDOW (data->current_window)->contents); |
| 5825 | 5779 | ||
| 5826 | /* In the following call to `select-window', prevent "swapping out | 5780 | /* In the following call to `select-window', prevent "swapping out |
| 5827 | point" in the old selected window using the buffer that has | 5781 | point" in the old selected window using the buffer that has |
| 5828 | been restored into it. We already swapped out that point from | 5782 | been restored into it. We already swapped out that point from |
| 5829 | that window's old buffer. */ | 5783 | that window's old buffer. */ |
| 5830 | select_window (data->current_window, Qnil, 1); | 5784 | select_window (data->current_window, Qnil, 1); |
| 5831 | BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) | 5785 | BVAR (XBUFFER (XWINDOW (selected_window)->contents), last_selected_window) |
| 5832 | = selected_window; | 5786 | = selected_window; |
| 5833 | 5787 | ||
| 5834 | if (NILP (data->focus_frame) | 5788 | if (NILP (data->focus_frame) |
| @@ -5855,14 +5809,9 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5855 | /* Now, free glyph matrices in windows that were not reused. */ | 5809 | /* Now, free glyph matrices in windows that were not reused. */ |
| 5856 | for (i = n = 0; i < n_leaf_windows; ++i) | 5810 | for (i = n = 0; i < n_leaf_windows; ++i) |
| 5857 | { | 5811 | { |
| 5858 | if (NILP (leaf_windows[i]->buffer)) | 5812 | if (NILP (leaf_windows[i]->contents)) |
| 5859 | { | 5813 | free_window_matrices (leaf_windows[i]); |
| 5860 | /* Assert it's not reused as a combination. */ | 5814 | else if (EQ (leaf_windows[i]->contents, new_current_buffer)) |
| 5861 | eassert (NILP (leaf_windows[i]->hchild) | ||
| 5862 | && NILP (leaf_windows[i]->vchild)); | ||
| 5863 | free_window_matrices (leaf_windows[i]); | ||
| 5864 | } | ||
| 5865 | else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) | ||
| 5866 | ++n; | 5815 | ++n; |
| 5867 | } | 5816 | } |
| 5868 | 5817 | ||
| @@ -5893,7 +5842,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5893 | Fset_buffer (new_current_buffer); | 5842 | Fset_buffer (new_current_buffer); |
| 5894 | /* If the new current buffer doesn't appear in the selected | 5843 | /* If the new current buffer doesn't appear in the selected |
| 5895 | window, go to its old point (see bug#12208). */ | 5844 | window, go to its old point (see bug#12208). */ |
| 5896 | if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) | 5845 | if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) |
| 5897 | Fgoto_char (make_number (old_point)); | 5846 | Fgoto_char (make_number (old_point)); |
| 5898 | } | 5847 | } |
| 5899 | 5848 | ||
| @@ -5904,8 +5853,10 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5904 | } | 5853 | } |
| 5905 | 5854 | ||
| 5906 | 5855 | ||
| 5907 | /* Recursively delete all child windows reachable via the next, vchild, | 5856 | /* If WINDOW is an internal window, recursively delete all child windows |
| 5908 | and hchild slots of WINDOW. */ | 5857 | reachable via the next and contents slots of WINDOW. Otherwise setup |
| 5858 | WINDOW to not show any buffer. */ | ||
| 5859 | |||
| 5909 | void | 5860 | void |
| 5910 | delete_all_child_windows (Lisp_Object window) | 5861 | delete_all_child_windows (Lisp_Object window) |
| 5911 | { | 5862 | { |
| @@ -5917,17 +5868,12 @@ delete_all_child_windows (Lisp_Object window) | |||
| 5917 | /* Delete WINDOW's siblings (we traverse postorderly). */ | 5868 | /* Delete WINDOW's siblings (we traverse postorderly). */ |
| 5918 | delete_all_child_windows (w->next); | 5869 | delete_all_child_windows (w->next); |
| 5919 | 5870 | ||
| 5920 | if (!NILP (w->vchild)) | 5871 | if (WINDOWP (w->contents)) |
| 5921 | { | ||
| 5922 | delete_all_child_windows (w->vchild); | ||
| 5923 | wset_vchild (w, Qnil); | ||
| 5924 | } | ||
| 5925 | else if (!NILP (w->hchild)) | ||
| 5926 | { | 5872 | { |
| 5927 | delete_all_child_windows (w->hchild); | 5873 | delete_all_child_windows (w->contents); |
| 5928 | wset_hchild (w, Qnil); | 5874 | wset_combination (w, 0, Qnil); |
| 5929 | } | 5875 | } |
| 5930 | else if (!NILP (w->buffer)) | 5876 | else if (BUFFERP (w->contents)) |
| 5931 | { | 5877 | { |
| 5932 | unshow_buffer (w); | 5878 | unshow_buffer (w); |
| 5933 | unchain_marker (XMARKER (w->pointm)); | 5879 | unchain_marker (XMARKER (w->pointm)); |
| @@ -5935,7 +5881,7 @@ delete_all_child_windows (Lisp_Object window) | |||
| 5935 | /* Since combination limit makes sense for an internal windows | 5881 | /* Since combination limit makes sense for an internal windows |
| 5936 | only, we use this slot to save the buffer for the sake of | 5882 | only, we use this slot to save the buffer for the sake of |
| 5937 | possible resurrection in Fset_window_configuration. */ | 5883 | possible resurrection in Fset_window_configuration. */ |
| 5938 | wset_combination_limit (w, w->buffer); | 5884 | wset_combination_limit (w, w->contents); |
| 5939 | wset_buffer (w, Qnil); | 5885 | wset_buffer (w, Qnil); |
| 5940 | } | 5886 | } |
| 5941 | 5887 | ||
| @@ -5948,10 +5894,8 @@ count_windows (register struct window *window) | |||
| 5948 | register int count = 1; | 5894 | register int count = 1; |
| 5949 | if (!NILP (window->next)) | 5895 | if (!NILP (window->next)) |
| 5950 | count += count_windows (XWINDOW (window->next)); | 5896 | count += count_windows (XWINDOW (window->next)); |
| 5951 | if (!NILP (window->vchild)) | 5897 | if (WINDOWP (window->contents)) |
| 5952 | count += count_windows (XWINDOW (window->vchild)); | 5898 | count += count_windows (XWINDOW (window->contents)); |
| 5953 | if (!NILP (window->hchild)) | ||
| 5954 | count += count_windows (XWINDOW (window->hchild)); | ||
| 5955 | return count; | 5899 | return count; |
| 5956 | } | 5900 | } |
| 5957 | 5901 | ||
| @@ -5963,10 +5907,8 @@ get_leaf_windows (struct window *w, struct window **flat, int i) | |||
| 5963 | { | 5907 | { |
| 5964 | while (w) | 5908 | while (w) |
| 5965 | { | 5909 | { |
| 5966 | if (!NILP (w->hchild)) | 5910 | if (WINDOWP (w->contents)) |
| 5967 | i = get_leaf_windows (XWINDOW (w->hchild), flat, i); | 5911 | i = get_leaf_windows (XWINDOW (w->contents), flat, i); |
| 5968 | else if (!NILP (w->vchild)) | ||
| 5969 | i = get_leaf_windows (XWINDOW (w->vchild), flat, i); | ||
| 5970 | else | 5912 | else |
| 5971 | flat[i++] = w; | 5913 | flat[i++] = w; |
| 5972 | 5914 | ||
| @@ -6006,7 +5948,7 @@ get_phys_cursor_glyph (struct window *w) | |||
| 6006 | hpos = row->used[TEXT_AREA] - 1; | 5948 | hpos = row->used[TEXT_AREA] - 1; |
| 6007 | } | 5949 | } |
| 6008 | 5950 | ||
| 6009 | if (hpos >= 0 && hpos < row->used[TEXT_AREA]) | 5951 | if (0 <= hpos && hpos < row->used[TEXT_AREA]) |
| 6010 | glyph = row->glyphs[TEXT_AREA] + hpos; | 5952 | glyph = row->glyphs[TEXT_AREA] + hpos; |
| 6011 | else | 5953 | else |
| 6012 | glyph = NULL; | 5954 | glyph = NULL; |
| @@ -6022,14 +5964,14 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6022 | register struct window *w; | 5964 | register struct window *w; |
| 6023 | register Lisp_Object tem, pers, par; | 5965 | register Lisp_Object tem, pers, par; |
| 6024 | 5966 | ||
| 6025 | for (;!NILP (window); window = w->next) | 5967 | for (; !NILP (window); window = w->next) |
| 6026 | { | 5968 | { |
| 6027 | p = SAVED_WINDOW_N (vector, i); | 5969 | p = SAVED_WINDOW_N (vector, i); |
| 6028 | w = XWINDOW (window); | 5970 | w = XWINDOW (window); |
| 6029 | 5971 | ||
| 6030 | wset_temslot (w, make_number (i)); i++; | 5972 | wset_temslot (w, make_number (i)); i++; |
| 6031 | p->window = window; | 5973 | p->window = window; |
| 6032 | p->buffer = w->buffer; | 5974 | p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil); |
| 6033 | p->left_col = make_number (w->left_col); | 5975 | p->left_col = make_number (w->left_col); |
| 6034 | p->top_line = make_number (w->top_line); | 5976 | p->top_line = make_number (w->top_line); |
| 6035 | p->total_cols = make_number (w->total_cols); | 5977 | p->total_cols = make_number (w->total_cols); |
| @@ -6096,15 +6038,15 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6096 | } | 6038 | } |
| 6097 | } | 6039 | } |
| 6098 | 6040 | ||
| 6099 | if (!NILP (w->buffer)) | 6041 | if (BUFFERP (w->contents)) |
| 6100 | { | 6042 | { |
| 6101 | /* Save w's value of point in the window configuration. If w | 6043 | /* Save w's value of point in the window configuration. If w |
| 6102 | is the selected window, then get the value of point from | 6044 | is the selected window, then get the value of point from |
| 6103 | the buffer; pointm is garbage in the selected window. */ | 6045 | the buffer; pointm is garbage in the selected window. */ |
| 6104 | if (EQ (window, selected_window)) | 6046 | if (EQ (window, selected_window)) |
| 6105 | p->pointm = build_marker (XBUFFER (w->buffer), | 6047 | p->pointm = build_marker (XBUFFER (w->contents), |
| 6106 | BUF_PT (XBUFFER (w->buffer)), | 6048 | BUF_PT (XBUFFER (w->contents)), |
| 6107 | BUF_PT_BYTE (XBUFFER (w->buffer))); | 6049 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 6108 | else | 6050 | else |
| 6109 | p->pointm = Fcopy_marker (w->pointm, Qnil); | 6051 | p->pointm = Fcopy_marker (w->pointm, Qnil); |
| 6110 | XMARKER (p->pointm)->insertion_type | 6052 | XMARKER (p->pointm)->insertion_type |
| @@ -6113,7 +6055,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6113 | p->start = Fcopy_marker (w->start, Qnil); | 6055 | p->start = Fcopy_marker (w->start, Qnil); |
| 6114 | p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; | 6056 | p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; |
| 6115 | 6057 | ||
| 6116 | tem = BVAR (XBUFFER (w->buffer), mark); | 6058 | tem = BVAR (XBUFFER (w->contents), mark); |
| 6117 | p->mark = Fcopy_marker (tem, Qnil); | 6059 | p->mark = Fcopy_marker (tem, Qnil); |
| 6118 | } | 6060 | } |
| 6119 | else | 6061 | else |
| @@ -6134,10 +6076,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 6134 | else | 6076 | else |
| 6135 | p->prev = XWINDOW (w->prev)->temslot; | 6077 | p->prev = XWINDOW (w->prev)->temslot; |
| 6136 | 6078 | ||
| 6137 | if (!NILP (w->vchild)) | 6079 | if (WINDOWP (w->contents)) |
| 6138 | i = save_window_save (w->vchild, vector, i); | 6080 | i = save_window_save (w->contents, vector, i); |
| 6139 | if (!NILP (w->hchild)) | ||
| 6140 | i = save_window_save (w->hchild, vector, i); | ||
| 6141 | } | 6081 | } |
| 6142 | 6082 | ||
| 6143 | return i; | 6083 | return i; |
| @@ -6454,7 +6394,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) | |||
| 6454 | adjust_glyphs (f); | 6394 | adjust_glyphs (f); |
| 6455 | 6395 | ||
| 6456 | /* Prevent redisplay shortcuts. */ | 6396 | /* Prevent redisplay shortcuts. */ |
| 6457 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 6397 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 6458 | } | 6398 | } |
| 6459 | } | 6399 | } |
| 6460 | 6400 | ||
| @@ -6488,10 +6428,8 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u | |||
| 6488 | 6428 | ||
| 6489 | for (cont = 1; w && cont;) | 6429 | for (cont = 1; w && cont;) |
| 6490 | { | 6430 | { |
| 6491 | if (!NILP (w->hchild)) | 6431 | if (WINDOWP (w->contents)) |
| 6492 | cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); | 6432 | cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data); |
| 6493 | else if (!NILP (w->vchild)) | ||
| 6494 | cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); | ||
| 6495 | else | 6433 | else |
| 6496 | cont = fn (w, user_data); | 6434 | cont = fn (w, user_data); |
| 6497 | 6435 | ||
diff --git a/src/window.h b/src/window.h index 71c438ff7f2..411756f045e 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -41,14 +41,13 @@ They are deleted only by calling delete-window on them (but | |||
| 41 | this can be done implicitly). Combination windows can be created | 41 | this can be done implicitly). Combination windows can be created |
| 42 | and deleted at any time. | 42 | and deleted at any time. |
| 43 | 43 | ||
| 44 | A leaf window has a non-nil buffer field, and also | 44 | A leaf window has a buffer stored in contents field and markers in its start |
| 45 | has markers in its start and pointm fields. Non-leaf windows | 45 | and pointm fields. Non-leaf windows have nil in the latter two fields. |
| 46 | have nil in these fields. | ||
| 47 | 46 | ||
| 48 | Non-leaf windows are either vertical or horizontal combinations. | 47 | Non-leaf windows are either vertical or horizontal combinations. |
| 49 | 48 | ||
| 50 | A vertical combination window has children that are arranged on the frame | 49 | A vertical combination window has children that are arranged on the frame |
| 51 | one above the next. Its vchild field points to the uppermost child. | 50 | one above the next. Its contents field points to the uppermost child. |
| 52 | The parent field of each of the children points to the vertical | 51 | The parent field of each of the children points to the vertical |
| 53 | combination window. The next field of each child points to the | 52 | combination window. The next field of each child points to the |
| 54 | child below it, or is nil for the lowest child. The prev field | 53 | child below it, or is nil for the lowest child. The prev field |
| @@ -56,7 +55,7 @@ of each child points to the child above it, or is nil for the | |||
| 56 | highest child. | 55 | highest child. |
| 57 | 56 | ||
| 58 | A horizontal combination window has children that are side by side. | 57 | A horizontal combination window has children that are side by side. |
| 59 | Its hchild field points to the leftmost child. In each child | 58 | Its contents field points to the leftmost child. In each child |
| 60 | the next field points to the child to the right and the prev field | 59 | the next field points to the child to the right and the prev field |
| 61 | points to the child to the left. | 60 | points to the child to the left. |
| 62 | 61 | ||
| @@ -78,7 +77,7 @@ the root window is the minibuf window. On minibufferless screens or | |||
| 78 | minibuffer-only screens, the root window and the minibuffer window are | 77 | minibuffer-only screens, the root window and the minibuffer window are |
| 79 | one and the same, so its prev and next members are nil. | 78 | one and the same, so its prev and next members are nil. |
| 80 | 79 | ||
| 81 | A dead window has its buffer, hchild, and vchild windows all nil. */ | 80 | A dead window has its contents field set to nil. */ |
| 82 | 81 | ||
| 83 | struct cursor_pos | 82 | struct cursor_pos |
| 84 | { | 83 | { |
| @@ -102,13 +101,6 @@ struct window | |||
| 102 | Lisp_Object next; | 101 | Lisp_Object next; |
| 103 | Lisp_Object prev; | 102 | Lisp_Object prev; |
| 104 | 103 | ||
| 105 | /* First child of this window: vchild is used if this is a vertical | ||
| 106 | combination, hchild if this is a horizontal combination. Of the | ||
| 107 | fields vchild, hchild and buffer, one and only one is non-nil | ||
| 108 | unless the window is dead. */ | ||
| 109 | Lisp_Object hchild; | ||
| 110 | Lisp_Object vchild; | ||
| 111 | |||
| 112 | /* The window this one is a child of. */ | 104 | /* The window this one is a child of. */ |
| 113 | Lisp_Object parent; | 105 | Lisp_Object parent; |
| 114 | 106 | ||
| @@ -123,10 +115,8 @@ struct window | |||
| 123 | Lisp_Object new_total; | 115 | Lisp_Object new_total; |
| 124 | Lisp_Object new_normal; | 116 | Lisp_Object new_normal; |
| 125 | 117 | ||
| 126 | /* The buffer displayed in this window. Of the fields vchild, | 118 | /* May be buffer, window, or nil. */ |
| 127 | hchild and buffer, one and only one is non-nil unless the window | 119 | Lisp_Object contents; |
| 128 | is dead. */ | ||
| 129 | Lisp_Object buffer; | ||
| 130 | 120 | ||
| 131 | /* A marker pointing to where in the text to start displaying. | 121 | /* A marker pointing to where in the text to start displaying. |
| 132 | BIDI Note: This is the _logical-order_ start, i.e. the smallest | 122 | BIDI Note: This is the _logical-order_ start, i.e. the smallest |
| @@ -282,6 +272,10 @@ struct window | |||
| 282 | /* Non-zero if this window is a minibuffer window. */ | 272 | /* Non-zero if this window is a minibuffer window. */ |
| 283 | unsigned mini : 1; | 273 | unsigned mini : 1; |
| 284 | 274 | ||
| 275 | /* Meaningful only if contents is a window, non-zero if this | ||
| 276 | internal window is used in horizontal combination. */ | ||
| 277 | unsigned horizontal : 1; | ||
| 278 | |||
| 285 | /* Non-zero means must regenerate mode line of this window. */ | 279 | /* Non-zero means must regenerate mode line of this window. */ |
| 286 | unsigned update_mode_line : 1; | 280 | unsigned update_mode_line : 1; |
| 287 | 281 | ||
| @@ -428,6 +422,21 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 428 | 422 | ||
| 429 | /* A handy macro. */ | 423 | /* A handy macro. */ |
| 430 | 424 | ||
| 425 | /* Non-zero if W is leaf (carry the buffer). */ | ||
| 426 | |||
| 427 | #define WINDOW_LEAF_P(W) \ | ||
| 428 | (BUFFERP ((W)->contents)) | ||
| 429 | |||
| 430 | /* Non-zero if W is a member of horizontal combination. */ | ||
| 431 | |||
| 432 | #define WINDOW_HORIZONTAL_COMBINATION_P(W) \ | ||
| 433 | (WINDOWP ((W)->contents) && (W)->horizontal) | ||
| 434 | |||
| 435 | /* Non-zero if W is a member of vertical combination. */ | ||
| 436 | |||
| 437 | #define WINDOW_VERTICAL_COMBINATION_P(W) \ | ||
| 438 | (WINDOWP ((W)->contents) && !(W)->horizontal) | ||
| 439 | |||
| 431 | #define WINDOW_XFRAME(W) \ | 440 | #define WINDOW_XFRAME(W) \ |
| 432 | (XFRAME (WINDOW_FRAME ((W)))) | 441 | (XFRAME (WINDOW_FRAME ((W)))) |
| 433 | 442 | ||
| @@ -931,20 +940,17 @@ extern void check_frame_size (struct frame *frame, int *rows, int *cols); | |||
| 931 | struct glyph *get_phys_cursor_glyph (struct window *w); | 940 | struct glyph *get_phys_cursor_glyph (struct window *w); |
| 932 | 941 | ||
| 933 | /* Value is non-zero if WINDOW is a valid window. */ | 942 | /* Value is non-zero if WINDOW is a valid window. */ |
| 934 | #define WINDOW_VALID_P(WINDOW) \ | 943 | #define WINDOW_VALID_P(WINDOW) \ |
| 935 | (WINDOWP (WINDOW) \ | 944 | (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->contents)) \ |
| 936 | && (!NILP (XWINDOW (WINDOW)->buffer) \ | 945 | |
| 937 | || !NILP (XWINDOW (WINDOW)->vchild) \ | 946 | /* A window of any sort, leaf or interior, is "valid" if its |
| 938 | || !NILP (XWINDOW (WINDOW)->hchild))) | 947 | contents slot is non-nil. */ |
| 939 | |||
| 940 | /* A window of any sort, leaf or interior, is "valid" if one | ||
| 941 | of its buffer, vchild, or hchild members is non-nil. */ | ||
| 942 | #define CHECK_VALID_WINDOW(WINDOW) \ | 948 | #define CHECK_VALID_WINDOW(WINDOW) \ |
| 943 | CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW) | 949 | CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW) |
| 944 | 950 | ||
| 945 | /* Value is non-zero if WINDOW is a live window. */ | 951 | /* Value is non-zero if WINDOW is a live window. */ |
| 946 | #define WINDOW_LIVE_P(WINDOW) \ | 952 | #define WINDOW_LIVE_P(WINDOW) \ |
| 947 | (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) | 953 | (WINDOWP (WINDOW) && BUFFERP (XWINDOW (WINDOW)->contents)) |
| 948 | 954 | ||
| 949 | /* A window is "live" if and only if it shows a buffer. */ | 955 | /* A window is "live" if and only if it shows a buffer. */ |
| 950 | #define CHECK_LIVE_WINDOW(WINDOW) \ | 956 | #define CHECK_LIVE_WINDOW(WINDOW) \ |
diff --git a/src/xdisp.c b/src/xdisp.c index bd68b286f4e..f8a9fd57dc1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -582,7 +582,7 @@ static struct glyph scratch_glyphs[MAX_SCRATCH_GLYPHS]; | |||
| 582 | 582 | ||
| 583 | /* Ascent and height of the last line processed by move_it_to. */ | 583 | /* Ascent and height of the last line processed by move_it_to. */ |
| 584 | 584 | ||
| 585 | static int last_max_ascent, last_height; | 585 | static int last_height; |
| 586 | 586 | ||
| 587 | /* Non-zero if there's a help-echo in the echo area. */ | 587 | /* Non-zero if there's a help-echo in the echo area. */ |
| 588 | 588 | ||
| @@ -1288,10 +1288,10 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1288 | if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w)))) | 1288 | if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w)))) |
| 1289 | return visible_p; | 1289 | return visible_p; |
| 1290 | 1290 | ||
| 1291 | if (XBUFFER (w->buffer) != current_buffer) | 1291 | if (XBUFFER (w->contents) != current_buffer) |
| 1292 | { | 1292 | { |
| 1293 | old_buffer = current_buffer; | 1293 | old_buffer = current_buffer; |
| 1294 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 1294 | set_buffer_internal_1 (XBUFFER (w->contents)); |
| 1295 | } | 1295 | } |
| 1296 | 1296 | ||
| 1297 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1297 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| @@ -4463,7 +4463,7 @@ handle_display_prop (struct it *it) | |||
| 4463 | if it was a text property. */ | 4463 | if it was a text property. */ |
| 4464 | 4464 | ||
| 4465 | if (!STRINGP (it->string)) | 4465 | if (!STRINGP (it->string)) |
| 4466 | object = it->w->buffer; | 4466 | object = it->w->contents; |
| 4467 | 4467 | ||
| 4468 | display_replaced_p = handle_display_spec (it, propval, object, overlay, | 4468 | display_replaced_p = handle_display_spec (it, propval, object, overlay, |
| 4469 | position, bufpos, | 4469 | position, bufpos, |
| @@ -4874,7 +4874,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 4874 | it->what = IT_IMAGE; | 4874 | it->what = IT_IMAGE; |
| 4875 | it->image_id = -1; /* no image */ | 4875 | it->image_id = -1; /* no image */ |
| 4876 | it->position = start_pos; | 4876 | it->position = start_pos; |
| 4877 | it->object = NILP (object) ? it->w->buffer : object; | 4877 | it->object = NILP (object) ? it->w->contents : object; |
| 4878 | it->method = GET_FROM_IMAGE; | 4878 | it->method = GET_FROM_IMAGE; |
| 4879 | it->from_overlay = Qnil; | 4879 | it->from_overlay = Qnil; |
| 4880 | it->face_id = face_id; | 4880 | it->face_id = face_id; |
| @@ -5025,7 +5025,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 5025 | it->what = IT_XWIDGET; | 5025 | it->what = IT_XWIDGET; |
| 5026 | it->method = GET_FROM_XWIDGET; | 5026 | it->method = GET_FROM_XWIDGET; |
| 5027 | it->position = start_pos; | 5027 | it->position = start_pos; |
| 5028 | it->object = NILP (object) ? it->w->buffer : object; | 5028 | it->object = NILP (object) ? it->w->contents : object; |
| 5029 | *position = start_pos; | 5029 | *position = start_pos; |
| 5030 | 5030 | ||
| 5031 | it->xwidget = lookup_xwidget(value); | 5031 | it->xwidget = lookup_xwidget(value); |
| @@ -5037,7 +5037,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 5037 | it->what = IT_IMAGE; | 5037 | it->what = IT_IMAGE; |
| 5038 | it->image_id = lookup_image (it->f, value); | 5038 | it->image_id = lookup_image (it->f, value); |
| 5039 | it->position = start_pos; | 5039 | it->position = start_pos; |
| 5040 | it->object = NILP (object) ? it->w->buffer : object; | 5040 | it->object = NILP (object) ? it->w->contents : object; |
| 5041 | it->method = GET_FROM_IMAGE; | 5041 | it->method = GET_FROM_IMAGE; |
| 5042 | 5042 | ||
| 5043 | /* Say that we haven't consumed the characters with | 5043 | /* Say that we haven't consumed the characters with |
| @@ -5871,7 +5871,7 @@ pop_it (struct it *it) | |||
| 5871 | it->object = p->u.stretch.object; | 5871 | it->object = p->u.stretch.object; |
| 5872 | break; | 5872 | break; |
| 5873 | case GET_FROM_BUFFER: | 5873 | case GET_FROM_BUFFER: |
| 5874 | it->object = it->w->buffer; | 5874 | it->object = it->w->contents; |
| 5875 | break; | 5875 | break; |
| 5876 | case GET_FROM_STRING: | 5876 | case GET_FROM_STRING: |
| 5877 | it->object = it->string; | 5877 | it->object = it->string; |
| @@ -5884,7 +5884,7 @@ pop_it (struct it *it) | |||
| 5884 | else | 5884 | else |
| 5885 | { | 5885 | { |
| 5886 | it->method = GET_FROM_BUFFER; | 5886 | it->method = GET_FROM_BUFFER; |
| 5887 | it->object = it->w->buffer; | 5887 | it->object = it->w->contents; |
| 5888 | } | 5888 | } |
| 5889 | } | 5889 | } |
| 5890 | it->end_charpos = p->end_charpos; | 5890 | it->end_charpos = p->end_charpos; |
| @@ -6325,7 +6325,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) | |||
| 6325 | IT_STRING_BYTEPOS (*it) = -1; | 6325 | IT_STRING_BYTEPOS (*it) = -1; |
| 6326 | it->string = Qnil; | 6326 | it->string = Qnil; |
| 6327 | it->method = GET_FROM_BUFFER; | 6327 | it->method = GET_FROM_BUFFER; |
| 6328 | it->object = it->w->buffer; | 6328 | it->object = it->w->contents; |
| 6329 | it->area = TEXT_AREA; | 6329 | it->area = TEXT_AREA; |
| 6330 | it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 6330 | it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 6331 | it->sp = 0; | 6331 | it->sp = 0; |
| @@ -7179,7 +7179,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 7179 | else | 7179 | else |
| 7180 | { | 7180 | { |
| 7181 | it->method = GET_FROM_BUFFER; | 7181 | it->method = GET_FROM_BUFFER; |
| 7182 | it->object = it->w->buffer; | 7182 | it->object = it->w->contents; |
| 7183 | } | 7183 | } |
| 7184 | 7184 | ||
| 7185 | it->dpvec = NULL; | 7185 | it->dpvec = NULL; |
| @@ -7755,7 +7755,7 @@ next_element_from_ellipsis (struct it *it) | |||
| 7755 | setting face_before_selective_p. */ | 7755 | setting face_before_selective_p. */ |
| 7756 | it->saved_face_id = it->face_id; | 7756 | it->saved_face_id = it->face_id; |
| 7757 | it->method = GET_FROM_BUFFER; | 7757 | it->method = GET_FROM_BUFFER; |
| 7758 | it->object = it->w->buffer; | 7758 | it->object = it->w->contents; |
| 7759 | reseat_at_next_visible_line_start (it, 1); | 7759 | reseat_at_next_visible_line_start (it, 1); |
| 7760 | it->face_before_selective_p = 1; | 7760 | it->face_before_selective_p = 1; |
| 7761 | } | 7761 | } |
| @@ -8032,7 +8032,7 @@ next_element_from_buffer (struct it *it) | |||
| 8032 | 8032 | ||
| 8033 | /* Record what we have and where it came from. */ | 8033 | /* Record what we have and where it came from. */ |
| 8034 | it->what = IT_CHARACTER; | 8034 | it->what = IT_CHARACTER; |
| 8035 | it->object = it->w->buffer; | 8035 | it->object = it->w->contents; |
| 8036 | it->position = it->current.pos; | 8036 | it->position = it->current.pos; |
| 8037 | 8037 | ||
| 8038 | /* Normally we return the character found above, except when we | 8038 | /* Normally we return the character found above, except when we |
| @@ -8138,7 +8138,7 @@ next_element_from_composition (struct it *it) | |||
| 8138 | return 0; | 8138 | return 0; |
| 8139 | } | 8139 | } |
| 8140 | it->position = it->current.pos; | 8140 | it->position = it->current.pos; |
| 8141 | it->object = it->w->buffer; | 8141 | it->object = it->w->contents; |
| 8142 | it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it), | 8142 | it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it), |
| 8143 | IT_BYTEPOS (*it), Qnil); | 8143 | IT_BYTEPOS (*it), Qnil); |
| 8144 | } | 8144 | } |
| @@ -8979,7 +8979,6 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos | |||
| 8979 | it->current_y += it->max_ascent + it->max_descent; | 8979 | it->current_y += it->max_ascent + it->max_descent; |
| 8980 | ++it->vpos; | 8980 | ++it->vpos; |
| 8981 | last_height = it->max_ascent + it->max_descent; | 8981 | last_height = it->max_ascent + it->max_descent; |
| 8982 | last_max_ascent = it->max_ascent; | ||
| 8983 | it->max_ascent = it->max_descent = 0; | 8982 | it->max_ascent = it->max_descent = 0; |
| 8984 | } | 8983 | } |
| 8985 | 8984 | ||
| @@ -9006,7 +9005,6 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos | |||
| 9006 | it->current_y += it->max_ascent + it->max_descent; | 9005 | it->current_y += it->max_ascent + it->max_descent; |
| 9007 | ++it->vpos; | 9006 | ++it->vpos; |
| 9008 | last_height = it->max_ascent + it->max_descent; | 9007 | last_height = it->max_ascent + it->max_descent; |
| 9009 | last_max_ascent = it->max_ascent; | ||
| 9010 | } | 9008 | } |
| 9011 | 9009 | ||
| 9012 | if (backup_data) | 9010 | if (backup_data) |
| @@ -10048,7 +10046,7 @@ with_echo_area_buffer_unwind_data (struct window *w) | |||
| 10048 | Vwith_echo_area_save_vector = Qnil; | 10046 | Vwith_echo_area_save_vector = Qnil; |
| 10049 | 10047 | ||
| 10050 | if (NILP (vector)) | 10048 | if (NILP (vector)) |
| 10051 | vector = Fmake_vector (make_number (7), Qnil); | 10049 | vector = Fmake_vector (make_number (9), Qnil); |
| 10052 | 10050 | ||
| 10053 | XSETBUFFER (tmp, current_buffer); ASET (vector, i, tmp); ++i; | 10051 | XSETBUFFER (tmp, current_buffer); ASET (vector, i, tmp); ++i; |
| 10054 | ASET (vector, i, Vdeactivate_mark); ++i; | 10052 | ASET (vector, i, Vdeactivate_mark); ++i; |
| @@ -10057,13 +10055,15 @@ with_echo_area_buffer_unwind_data (struct window *w) | |||
| 10057 | if (w) | 10055 | if (w) |
| 10058 | { | 10056 | { |
| 10059 | XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i; | 10057 | XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i; |
| 10060 | ASET (vector, i, w->buffer); ++i; | 10058 | ASET (vector, i, w->contents); ++i; |
| 10061 | ASET (vector, i, make_number (marker_position (w->pointm))); ++i; | 10059 | ASET (vector, i, make_number (marker_position (w->pointm))); ++i; |
| 10062 | ASET (vector, i, make_number (marker_byte_position (w->pointm))); ++i; | 10060 | ASET (vector, i, make_number (marker_byte_position (w->pointm))); ++i; |
| 10061 | ASET (vector, i, make_number (marker_position (w->start))); ++i; | ||
| 10062 | ASET (vector, i, make_number (marker_byte_position (w->start))); ++i; | ||
| 10063 | } | 10063 | } |
| 10064 | else | 10064 | else |
| 10065 | { | 10065 | { |
| 10066 | int end = i + 4; | 10066 | int end = i + 6; |
| 10067 | for (; i < end; ++i) | 10067 | for (; i < end; ++i) |
| 10068 | ASET (vector, i, Qnil); | 10068 | ASET (vector, i, Qnil); |
| 10069 | } | 10069 | } |
| @@ -10086,16 +10086,18 @@ unwind_with_echo_area_buffer (Lisp_Object vector) | |||
| 10086 | if (WINDOWP (AREF (vector, 3))) | 10086 | if (WINDOWP (AREF (vector, 3))) |
| 10087 | { | 10087 | { |
| 10088 | struct window *w; | 10088 | struct window *w; |
| 10089 | Lisp_Object buffer, charpos, bytepos; | 10089 | Lisp_Object buffer; |
| 10090 | 10090 | ||
| 10091 | w = XWINDOW (AREF (vector, 3)); | 10091 | w = XWINDOW (AREF (vector, 3)); |
| 10092 | buffer = AREF (vector, 4); | 10092 | buffer = AREF (vector, 4); |
| 10093 | charpos = AREF (vector, 5); | ||
| 10094 | bytepos = AREF (vector, 6); | ||
| 10095 | 10093 | ||
| 10096 | wset_buffer (w, buffer); | 10094 | wset_buffer (w, buffer); |
| 10097 | set_marker_both (w->pointm, buffer, | 10095 | set_marker_both (w->pointm, buffer, |
| 10098 | XFASTINT (charpos), XFASTINT (bytepos)); | 10096 | XFASTINT (AREF (vector, 5)), |
| 10097 | XFASTINT (AREF (vector, 6))); | ||
| 10098 | set_marker_both (w->start, buffer, | ||
| 10099 | XFASTINT (AREF (vector, 7)), | ||
| 10100 | XFASTINT (AREF (vector, 8))); | ||
| 10099 | } | 10101 | } |
| 10100 | 10102 | ||
| 10101 | Vwith_echo_area_save_vector = vector; | 10103 | Vwith_echo_area_save_vector = vector; |
| @@ -10309,9 +10311,9 @@ resize_mini_window (struct window *w, int exact_p) | |||
| 10309 | eassert (MINI_WINDOW_P (w)); | 10311 | eassert (MINI_WINDOW_P (w)); |
| 10310 | 10312 | ||
| 10311 | /* By default, start display at the beginning. */ | 10313 | /* By default, start display at the beginning. */ |
| 10312 | set_marker_both (w->start, w->buffer, | 10314 | set_marker_both (w->start, w->contents, |
| 10313 | BUF_BEGV (XBUFFER (w->buffer)), | 10315 | BUF_BEGV (XBUFFER (w->contents)), |
| 10314 | BUF_BEGV_BYTE (XBUFFER (w->buffer))); | 10316 | BUF_BEGV_BYTE (XBUFFER (w->contents))); |
| 10315 | 10317 | ||
| 10316 | /* Don't resize windows while redisplaying a window; it would | 10318 | /* Don't resize windows while redisplaying a window; it would |
| 10317 | confuse redisplay functions when the size of the window they are | 10319 | confuse redisplay functions when the size of the window they are |
| @@ -10338,10 +10340,10 @@ resize_mini_window (struct window *w, int exact_p) | |||
| 10338 | struct text_pos start; | 10340 | struct text_pos start; |
| 10339 | struct buffer *old_current_buffer = NULL; | 10341 | struct buffer *old_current_buffer = NULL; |
| 10340 | 10342 | ||
| 10341 | if (current_buffer != XBUFFER (w->buffer)) | 10343 | if (current_buffer != XBUFFER (w->contents)) |
| 10342 | { | 10344 | { |
| 10343 | old_current_buffer = current_buffer; | 10345 | old_current_buffer = current_buffer; |
| 10344 | set_buffer_internal (XBUFFER (w->buffer)); | 10346 | set_buffer_internal (XBUFFER (w->contents)); |
| 10345 | } | 10347 | } |
| 10346 | 10348 | ||
| 10347 | init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); | 10349 | init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); |
| @@ -10790,7 +10792,7 @@ buffer_shared_and_changed (void) | |||
| 10790 | 10792 | ||
| 10791 | /* Nonzero if W doesn't reflect the actual state of current buffer due | 10793 | /* Nonzero if W doesn't reflect the actual state of current buffer due |
| 10792 | to its text or overlays change. FIXME: this may be called when | 10794 | to its text or overlays change. FIXME: this may be called when |
| 10793 | XBUFFER (w->buffer) != current_buffer, which looks suspicious. */ | 10795 | XBUFFER (w->contents) != current_buffer, which looks suspicious. */ |
| 10794 | 10796 | ||
| 10795 | static int | 10797 | static int |
| 10796 | window_outdated (struct window *w) | 10798 | window_outdated (struct window *w) |
| @@ -10805,7 +10807,7 @@ window_outdated (struct window *w) | |||
| 10805 | static int | 10807 | static int |
| 10806 | window_buffer_changed (struct window *w) | 10808 | window_buffer_changed (struct window *w) |
| 10807 | { | 10809 | { |
| 10808 | struct buffer *b = XBUFFER (w->buffer); | 10810 | struct buffer *b = XBUFFER (w->contents); |
| 10809 | 10811 | ||
| 10810 | eassert (BUFFER_LIVE_P (b)); | 10812 | eassert (BUFFER_LIVE_P (b)); |
| 10811 | 10813 | ||
| @@ -11059,7 +11061,7 @@ x_consider_frame_title (Lisp_Object frame) | |||
| 11059 | 11061 | ||
| 11060 | Fselect_window (f->selected_window, Qt); | 11062 | Fselect_window (f->selected_window, Qt); |
| 11061 | set_buffer_internal_1 | 11063 | set_buffer_internal_1 |
| 11062 | (XBUFFER (XWINDOW (f->selected_window)->buffer)); | 11064 | (XBUFFER (XWINDOW (f->selected_window)->contents)); |
| 11063 | fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; | 11065 | fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; |
| 11064 | 11066 | ||
| 11065 | mode_line_target = MODE_LINE_TITLE; | 11067 | mode_line_target = MODE_LINE_TITLE; |
| @@ -11178,7 +11180,7 @@ prepare_menu_bars (void) | |||
| 11178 | if (windows_or_buffers_changed | 11180 | if (windows_or_buffers_changed |
| 11179 | && FRAME_NS_P (f)) | 11181 | && FRAME_NS_P (f)) |
| 11180 | ns_set_doc_edited | 11182 | ns_set_doc_edited |
| 11181 | (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->buffer)); | 11183 | (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->contents)); |
| 11182 | #endif | 11184 | #endif |
| 11183 | UNGCPRO; | 11185 | UNGCPRO; |
| 11184 | } | 11186 | } |
| @@ -11250,7 +11252,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run) | |||
| 11250 | 11252 | ||
| 11251 | specbind (Qinhibit_menubar_update, Qt); | 11253 | specbind (Qinhibit_menubar_update, Qt); |
| 11252 | 11254 | ||
| 11253 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 11255 | set_buffer_internal_1 (XBUFFER (w->contents)); |
| 11254 | if (save_match_data) | 11256 | if (save_match_data) |
| 11255 | record_unwind_save_match_data (); | 11257 | record_unwind_save_match_data (); |
| 11256 | if (NILP (Voverriding_local_map_menu_flag)) | 11258 | if (NILP (Voverriding_local_map_menu_flag)) |
| @@ -11454,7 +11456,7 @@ update_tool_bar (struct frame *f, int save_match_data) | |||
| 11454 | /* Set current_buffer to the buffer of the selected | 11456 | /* Set current_buffer to the buffer of the selected |
| 11455 | window of the frame, so that we get the right local | 11457 | window of the frame, so that we get the right local |
| 11456 | keymaps. */ | 11458 | keymaps. */ |
| 11457 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 11459 | set_buffer_internal_1 (XBUFFER (w->contents)); |
| 11458 | 11460 | ||
| 11459 | /* Save match data, if we must. */ | 11461 | /* Save match data, if we must. */ |
| 11460 | if (save_match_data) | 11462 | if (save_match_data) |
| @@ -12321,10 +12323,8 @@ hscroll_window_tree (Lisp_Object window) | |||
| 12321 | { | 12323 | { |
| 12322 | struct window *w = XWINDOW (window); | 12324 | struct window *w = XWINDOW (window); |
| 12323 | 12325 | ||
| 12324 | if (WINDOWP (w->hchild)) | 12326 | if (WINDOWP (w->contents)) |
| 12325 | hscrolled_p |= hscroll_window_tree (w->hchild); | 12327 | hscrolled_p |= hscroll_window_tree (w->contents); |
| 12326 | else if (WINDOWP (w->vchild)) | ||
| 12327 | hscrolled_p |= hscroll_window_tree (w->vchild); | ||
| 12328 | else if (w->cursor.vpos >= 0) | 12328 | else if (w->cursor.vpos >= 0) |
| 12329 | { | 12329 | { |
| 12330 | int h_margin; | 12330 | int h_margin; |
| @@ -12344,7 +12344,7 @@ hscroll_window_tree (Lisp_Object window) | |||
| 12344 | /* Scroll when cursor is inside this scroll margin. */ | 12344 | /* Scroll when cursor is inside this scroll margin. */ |
| 12345 | h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); | 12345 | h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); |
| 12346 | 12346 | ||
| 12347 | if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer)) | 12347 | if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->contents)) |
| 12348 | /* For left-to-right rows, hscroll when cursor is either | 12348 | /* For left-to-right rows, hscroll when cursor is either |
| 12349 | (i) inside the right hscroll margin, or (ii) if it is | 12349 | (i) inside the right hscroll margin, or (ii) if it is |
| 12350 | inside the left margin and the window is already | 12350 | inside the left margin and the window is already |
| @@ -12379,7 +12379,7 @@ hscroll_window_tree (Lisp_Object window) | |||
| 12379 | 12379 | ||
| 12380 | /* Find point in a display of infinite width. */ | 12380 | /* Find point in a display of infinite width. */ |
| 12381 | saved_current_buffer = current_buffer; | 12381 | saved_current_buffer = current_buffer; |
| 12382 | current_buffer = XBUFFER (w->buffer); | 12382 | current_buffer = XBUFFER (w->contents); |
| 12383 | 12383 | ||
| 12384 | if (w == XWINDOW (selected_window)) | 12384 | if (w == XWINDOW (selected_window)) |
| 12385 | pt = PT; | 12385 | pt = PT; |
| @@ -12432,7 +12432,7 @@ hscroll_window_tree (Lisp_Object window) | |||
| 12432 | redisplay. */ | 12432 | redisplay. */ |
| 12433 | if (w->hscroll != hscroll) | 12433 | if (w->hscroll != hscroll) |
| 12434 | { | 12434 | { |
| 12435 | XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; | 12435 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |
| 12436 | w->hscroll = hscroll; | 12436 | w->hscroll = hscroll; |
| 12437 | hscrolled_p = 1; | 12437 | hscrolled_p = 1; |
| 12438 | } | 12438 | } |
| @@ -12521,9 +12521,9 @@ debug_method_add (struct window *w, char const *fmt, ...) | |||
| 12521 | if (trace_redisplay_p) | 12521 | if (trace_redisplay_p) |
| 12522 | fprintf (stderr, "%p (%s): %s\n", | 12522 | fprintf (stderr, "%p (%s): %s\n", |
| 12523 | w, | 12523 | w, |
| 12524 | ((BUFFERP (w->buffer) | 12524 | ((BUFFERP (w->contents) |
| 12525 | && STRINGP (BVAR (XBUFFER (w->buffer), name))) | 12525 | && STRINGP (BVAR (XBUFFER (w->contents), name))) |
| 12526 | ? SSDATA (BVAR (XBUFFER (w->buffer), name)) | 12526 | ? SSDATA (BVAR (XBUFFER (w->contents), name)) |
| 12527 | : "no buffer"), | 12527 | : "no buffer"), |
| 12528 | method + len); | 12528 | method + len); |
| 12529 | } | 12529 | } |
| @@ -12587,8 +12587,8 @@ text_outside_line_unchanged_p (struct window *w, | |||
| 12587 | require to redisplay the whole paragraph. It might be worthwhile | 12587 | require to redisplay the whole paragraph. It might be worthwhile |
| 12588 | to find the paragraph limits and widen the range of redisplayed | 12588 | to find the paragraph limits and widen the range of redisplayed |
| 12589 | lines to that, but for now just give up this optimization. */ | 12589 | lines to that, but for now just give up this optimization. */ |
| 12590 | if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) | 12590 | if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) |
| 12591 | && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) | 12591 | && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction))) |
| 12592 | unchanged_p = 0; | 12592 | unchanged_p = 0; |
| 12593 | } | 12593 | } |
| 12594 | 12594 | ||
| @@ -12811,7 +12811,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b) | |||
| 12811 | we set b->clip_changed to 1 to force updating the screen. If | 12811 | we set b->clip_changed to 1 to force updating the screen. If |
| 12812 | b->clip_changed has already been set to 1, we can skip this | 12812 | b->clip_changed has already been set to 1, we can skip this |
| 12813 | check. */ | 12813 | check. */ |
| 12814 | if (!b->clip_changed && BUFFERP (w->buffer) && w->window_end_valid) | 12814 | if (!b->clip_changed && BUFFERP (w->contents) && w->window_end_valid) |
| 12815 | { | 12815 | { |
| 12816 | ptrdiff_t pt; | 12816 | ptrdiff_t pt; |
| 12817 | 12817 | ||
| @@ -12820,11 +12820,11 @@ reconsider_clip_changes (struct window *w, struct buffer *b) | |||
| 12820 | else | 12820 | else |
| 12821 | pt = marker_position (w->pointm); | 12821 | pt = marker_position (w->pointm); |
| 12822 | 12822 | ||
| 12823 | if ((w->current_matrix->buffer != XBUFFER (w->buffer) | 12823 | if ((w->current_matrix->buffer != XBUFFER (w->contents) |
| 12824 | || pt != w->last_point) | 12824 | || pt != w->last_point) |
| 12825 | && check_point_in_composition (w->current_matrix->buffer, | 12825 | && check_point_in_composition (w->current_matrix->buffer, |
| 12826 | w->last_point, | 12826 | w->last_point, |
| 12827 | XBUFFER (w->buffer), pt)) | 12827 | XBUFFER (w->contents), pt)) |
| 12828 | b->clip_changed = 1; | 12828 | b->clip_changed = 1; |
| 12829 | } | 12829 | } |
| 12830 | } | 12830 | } |
| @@ -13002,8 +13002,6 @@ redisplay_internal (void) | |||
| 13002 | 13002 | ||
| 13003 | unbind_to (count1, Qnil); | 13003 | unbind_to (count1, Qnil); |
| 13004 | 13004 | ||
| 13005 | FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1; | ||
| 13006 | |||
| 13007 | consider_all_windows_p = (update_mode_lines | 13005 | consider_all_windows_p = (update_mode_lines |
| 13008 | || buffer_shared_and_changed () | 13006 | || buffer_shared_and_changed () |
| 13009 | || cursor_type_changed); | 13007 | || cursor_type_changed); |
| @@ -13079,11 +13077,11 @@ redisplay_internal (void) | |||
| 13079 | the whole window. The assignment to this_line_start_pos prevents | 13077 | the whole window. The assignment to this_line_start_pos prevents |
| 13080 | the optimization directly below this if-statement. */ | 13078 | the optimization directly below this if-statement. */ |
| 13081 | if (((!NILP (Vtransient_mark_mode) | 13079 | if (((!NILP (Vtransient_mark_mode) |
| 13082 | && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) | 13080 | && !NILP (BVAR (XBUFFER (w->contents), mark_active))) |
| 13083 | != (w->region_showing > 0)) | 13081 | != (w->region_showing > 0)) |
| 13084 | || (w->region_showing | 13082 | || (w->region_showing |
| 13085 | && w->region_showing | 13083 | && w->region_showing |
| 13086 | != XINT (Fmarker_position (BVAR (XBUFFER (w->buffer), mark))))) | 13084 | != XINT (Fmarker_position (BVAR (XBUFFER (w->contents), mark))))) |
| 13087 | CHARPOS (this_line_start_pos) = 0; | 13085 | CHARPOS (this_line_start_pos) = 0; |
| 13088 | 13086 | ||
| 13089 | /* Optimize the case that only the line containing the cursor in the | 13087 | /* Optimize the case that only the line containing the cursor in the |
| @@ -13101,7 +13099,7 @@ redisplay_internal (void) | |||
| 13101 | && !FRAME_OBSCURED_P (XFRAME (w->frame)) | 13099 | && !FRAME_OBSCURED_P (XFRAME (w->frame)) |
| 13102 | /* Make sure recorded data applies to current buffer, etc. */ | 13100 | /* Make sure recorded data applies to current buffer, etc. */ |
| 13103 | && this_line_buffer == current_buffer | 13101 | && this_line_buffer == current_buffer |
| 13104 | && current_buffer == XBUFFER (w->buffer) | 13102 | && current_buffer == XBUFFER (w->contents) |
| 13105 | && !w->force_start | 13103 | && !w->force_start |
| 13106 | && !w->optional_new_start | 13104 | && !w->optional_new_start |
| 13107 | /* Point must be on the line that we have info recorded about. */ | 13105 | /* Point must be on the line that we have info recorded about. */ |
| @@ -13231,7 +13229,7 @@ redisplay_internal (void) | |||
| 13231 | PT == w->last_point | 13229 | PT == w->last_point |
| 13232 | /* Make sure the cursor was last displayed | 13230 | /* Make sure the cursor was last displayed |
| 13233 | in this window. Otherwise we have to reposition it. */ | 13231 | in this window. Otherwise we have to reposition it. */ |
| 13234 | && w->cursor.vpos >= 0 | 13232 | && 0 <= w->cursor.vpos |
| 13235 | && w->cursor.vpos < WINDOW_TOTAL_LINES (w)) | 13233 | && w->cursor.vpos < WINDOW_TOTAL_LINES (w)) |
| 13236 | { | 13234 | { |
| 13237 | if (!must_finish) | 13235 | if (!must_finish) |
| @@ -13399,7 +13397,7 @@ redisplay_internal (void) | |||
| 13399 | Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); | 13397 | Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); |
| 13400 | struct frame *mini_frame; | 13398 | struct frame *mini_frame; |
| 13401 | 13399 | ||
| 13402 | displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); | 13400 | displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents); |
| 13403 | /* Use list_of_error, not Qerror, so that | 13401 | /* Use list_of_error, not Qerror, so that |
| 13404 | we catch only errors and don't run the debugger. */ | 13402 | we catch only errors and don't run the debugger. */ |
| 13405 | internal_condition_case_1 (redisplay_window_1, selected_window, | 13403 | internal_condition_case_1 (redisplay_window_1, selected_window, |
| @@ -13609,7 +13607,7 @@ unwind_redisplay (Lisp_Object old_frame) | |||
| 13609 | static void | 13607 | static void |
| 13610 | mark_window_display_accurate_1 (struct window *w, int accurate_p) | 13608 | mark_window_display_accurate_1 (struct window *w, int accurate_p) |
| 13611 | { | 13609 | { |
| 13612 | struct buffer *b = XBUFFER (w->buffer); | 13610 | struct buffer *b = XBUFFER (w->contents); |
| 13613 | 13611 | ||
| 13614 | w->last_modified = accurate_p ? BUF_MODIFF (b) : 0; | 13612 | w->last_modified = accurate_p ? BUF_MODIFF (b) : 0; |
| 13615 | w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0; | 13613 | w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0; |
| @@ -13656,11 +13654,9 @@ mark_window_display_accurate (Lisp_Object window, int accurate_p) | |||
| 13656 | for (; !NILP (window); window = w->next) | 13654 | for (; !NILP (window); window = w->next) |
| 13657 | { | 13655 | { |
| 13658 | w = XWINDOW (window); | 13656 | w = XWINDOW (window); |
| 13659 | if (!NILP (w->vchild)) | 13657 | if (WINDOWP (w->contents)) |
| 13660 | mark_window_display_accurate (w->vchild, accurate_p); | 13658 | mark_window_display_accurate (w->contents, accurate_p); |
| 13661 | else if (!NILP (w->hchild)) | 13659 | else |
| 13662 | mark_window_display_accurate (w->hchild, accurate_p); | ||
| 13663 | else if (BUFFERP (w->buffer)) | ||
| 13664 | mark_window_display_accurate_1 (w, accurate_p); | 13660 | mark_window_display_accurate_1 (w, accurate_p); |
| 13665 | } | 13661 | } |
| 13666 | 13662 | ||
| @@ -13717,13 +13713,11 @@ redisplay_windows (Lisp_Object window) | |||
| 13717 | { | 13713 | { |
| 13718 | struct window *w = XWINDOW (window); | 13714 | struct window *w = XWINDOW (window); |
| 13719 | 13715 | ||
| 13720 | if (!NILP (w->hchild)) | 13716 | if (WINDOWP (w->contents)) |
| 13721 | redisplay_windows (w->hchild); | 13717 | redisplay_windows (w->contents); |
| 13722 | else if (!NILP (w->vchild)) | 13718 | else if (BUFFERP (w->contents)) |
| 13723 | redisplay_windows (w->vchild); | ||
| 13724 | else if (!NILP (w->buffer)) | ||
| 13725 | { | 13719 | { |
| 13726 | displayed_buffer = XBUFFER (w->buffer); | 13720 | displayed_buffer = XBUFFER (w->contents); |
| 13727 | /* Use list_of_error, not Qerror, so that | 13721 | /* Use list_of_error, not Qerror, so that |
| 13728 | we catch only errors and don't run the debugger. */ | 13722 | we catch only errors and don't run the debugger. */ |
| 13729 | internal_condition_case_1 (redisplay_window_0, window, | 13723 | internal_condition_case_1 (redisplay_window_0, window, |
| @@ -14370,7 +14364,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 14370 | && !MATRIX_ROW_CONTINUATION_LINE_P (row) | 14364 | && !MATRIX_ROW_CONTINUATION_LINE_P (row) |
| 14371 | && row->x == 0) | 14365 | && row->x == 0) |
| 14372 | { | 14366 | { |
| 14373 | this_line_buffer = XBUFFER (w->buffer); | 14367 | this_line_buffer = XBUFFER (w->contents); |
| 14374 | 14368 | ||
| 14375 | CHARPOS (this_line_start_pos) | 14369 | CHARPOS (this_line_start_pos) |
| 14376 | = MATRIX_ROW_START_CHARPOS (row) + delta; | 14370 | = MATRIX_ROW_START_CHARPOS (row) + delta; |
| @@ -14406,7 +14400,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp) | |||
| 14406 | struct window *w = XWINDOW (window); | 14400 | struct window *w = XWINDOW (window); |
| 14407 | SET_MARKER_FROM_TEXT_POS (w->start, startp); | 14401 | SET_MARKER_FROM_TEXT_POS (w->start, startp); |
| 14408 | 14402 | ||
| 14409 | if (current_buffer != XBUFFER (w->buffer)) | 14403 | if (current_buffer != XBUFFER (w->contents)) |
| 14410 | emacs_abort (); | 14404 | emacs_abort (); |
| 14411 | 14405 | ||
| 14412 | if (!NILP (Vwindow_scroll_functions)) | 14406 | if (!NILP (Vwindow_scroll_functions)) |
| @@ -14415,7 +14409,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp) | |||
| 14415 | make_number (CHARPOS (startp))); | 14409 | make_number (CHARPOS (startp))); |
| 14416 | SET_TEXT_POS_FROM_MARKER (startp, w->start); | 14410 | SET_TEXT_POS_FROM_MARKER (startp, w->start); |
| 14417 | /* In case the hook functions switch buffers. */ | 14411 | /* In case the hook functions switch buffers. */ |
| 14418 | set_buffer_internal (XBUFFER (w->buffer)); | 14412 | set_buffer_internal (XBUFFER (w->contents)); |
| 14419 | } | 14413 | } |
| 14420 | 14414 | ||
| 14421 | return startp; | 14415 | return startp; |
| @@ -15066,7 +15060,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 15066 | must_scroll = 1; | 15060 | must_scroll = 1; |
| 15067 | } | 15061 | } |
| 15068 | else if (rc != CURSOR_MOVEMENT_SUCCESS | 15062 | else if (rc != CURSOR_MOVEMENT_SUCCESS |
| 15069 | && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) | 15063 | && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))) |
| 15070 | { | 15064 | { |
| 15071 | struct glyph_row *row1; | 15065 | struct glyph_row *row1; |
| 15072 | 15066 | ||
| @@ -15129,7 +15123,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 15129 | else if (scroll_p) | 15123 | else if (scroll_p) |
| 15130 | rc = CURSOR_MOVEMENT_MUST_SCROLL; | 15124 | rc = CURSOR_MOVEMENT_MUST_SCROLL; |
| 15131 | else if (rc != CURSOR_MOVEMENT_SUCCESS | 15125 | else if (rc != CURSOR_MOVEMENT_SUCCESS |
| 15132 | && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) | 15126 | && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))) |
| 15133 | { | 15127 | { |
| 15134 | /* With bidi-reordered rows, there could be more than | 15128 | /* With bidi-reordered rows, there could be more than |
| 15135 | one candidate row whose start and end positions | 15129 | one candidate row whose start and end positions |
| @@ -15236,7 +15230,7 @@ set_vertical_scroll_bar (struct window *w) | |||
| 15236 | || (w == XWINDOW (minibuf_window) | 15230 | || (w == XWINDOW (minibuf_window) |
| 15237 | && NILP (echo_area_buffer[0]))) | 15231 | && NILP (echo_area_buffer[0]))) |
| 15238 | { | 15232 | { |
| 15239 | struct buffer *buf = XBUFFER (w->buffer); | 15233 | struct buffer *buf = XBUFFER (w->contents); |
| 15240 | whole = BUF_ZV (buf) - BUF_BEGV (buf); | 15234 | whole = BUF_ZV (buf) - BUF_BEGV (buf); |
| 15241 | start = marker_position (w->start) - BUF_BEGV (buf); | 15235 | start = marker_position (w->start) - BUF_BEGV (buf); |
| 15242 | /* I don't think this is guaranteed to be right. For the | 15236 | /* I don't think this is guaranteed to be right. For the |
| @@ -15270,7 +15264,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15270 | { | 15264 | { |
| 15271 | struct window *w = XWINDOW (window); | 15265 | struct window *w = XWINDOW (window); |
| 15272 | struct frame *f = XFRAME (w->frame); | 15266 | struct frame *f = XFRAME (w->frame); |
| 15273 | struct buffer *buffer = XBUFFER (w->buffer); | 15267 | struct buffer *buffer = XBUFFER (w->contents); |
| 15274 | struct buffer *old = current_buffer; | 15268 | struct buffer *old = current_buffer; |
| 15275 | struct text_pos lpoint, opoint, startp; | 15269 | struct text_pos lpoint, opoint, startp; |
| 15276 | int update_mode_line; | 15270 | int update_mode_line; |
| @@ -15292,12 +15286,14 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15292 | SET_TEXT_POS (lpoint, PT, PT_BYTE); | 15286 | SET_TEXT_POS (lpoint, PT, PT_BYTE); |
| 15293 | opoint = lpoint; | 15287 | opoint = lpoint; |
| 15294 | 15288 | ||
| 15295 | /* W must be a leaf window here. */ | ||
| 15296 | eassert (!NILP (w->buffer)); | ||
| 15297 | #ifdef GLYPH_DEBUG | 15289 | #ifdef GLYPH_DEBUG |
| 15298 | *w->desired_matrix->method = 0; | 15290 | *w->desired_matrix->method = 0; |
| 15299 | #endif | 15291 | #endif |
| 15300 | 15292 | ||
| 15293 | /* Make sure that both W's markers are valid. */ | ||
| 15294 | eassert (XMARKER (w->start)->buffer == buffer); | ||
| 15295 | eassert (XMARKER (w->pointm)->buffer == buffer); | ||
| 15296 | |||
| 15301 | restart: | 15297 | restart: |
| 15302 | reconsider_clip_changes (w, buffer); | 15298 | reconsider_clip_changes (w, buffer); |
| 15303 | 15299 | ||
| @@ -15323,10 +15319,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15323 | else if ((w != XWINDOW (minibuf_window) | 15319 | else if ((w != XWINDOW (minibuf_window) |
| 15324 | || minibuf_level == 0) | 15320 | || minibuf_level == 0) |
| 15325 | /* When buffer is nonempty, redisplay window normally. */ | 15321 | /* When buffer is nonempty, redisplay window normally. */ |
| 15326 | && BUF_Z (XBUFFER (w->buffer)) == BUF_BEG (XBUFFER (w->buffer)) | 15322 | && BUF_Z (XBUFFER (w->contents)) == BUF_BEG (XBUFFER (w->contents)) |
| 15327 | /* Quail displays non-mini buffers in minibuffer window. | 15323 | /* Quail displays non-mini buffers in minibuffer window. |
| 15328 | In that case, redisplay the window normally. */ | 15324 | In that case, redisplay the window normally. */ |
| 15329 | && !NILP (Fmemq (w->buffer, Vminibuffer_list))) | 15325 | && !NILP (Fmemq (w->contents, Vminibuffer_list))) |
| 15330 | { | 15326 | { |
| 15331 | /* W is a mini-buffer window, but it's not active, so clear | 15327 | /* W is a mini-buffer window, but it's not active, so clear |
| 15332 | it. */ | 15328 | it. */ |
| @@ -15348,7 +15344,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15348 | value. */ | 15344 | value. */ |
| 15349 | /* Really select the buffer, for the sake of buffer-local | 15345 | /* Really select the buffer, for the sake of buffer-local |
| 15350 | variables. */ | 15346 | variables. */ |
| 15351 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 15347 | set_buffer_internal_1 (XBUFFER (w->contents)); |
| 15352 | 15348 | ||
| 15353 | current_matrix_up_to_date_p | 15349 | current_matrix_up_to_date_p |
| 15354 | = (w->window_end_valid | 15350 | = (w->window_end_valid |
| @@ -16653,7 +16649,7 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16653 | bidi-reordered glyph rows. Let set_cursor_from_row | 16649 | bidi-reordered glyph rows. Let set_cursor_from_row |
| 16654 | figure out where to put the cursor, and if it fails, | 16650 | figure out where to put the cursor, and if it fails, |
| 16655 | give up. */ | 16651 | give up. */ |
| 16656 | if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) | 16652 | if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))) |
| 16657 | { | 16653 | { |
| 16658 | if (!set_cursor_from_row (w, row, w->current_matrix, | 16654 | if (!set_cursor_from_row (w, row, w->current_matrix, |
| 16659 | 0, 0, 0, 0)) | 16655 | 0, 0, 0, 0)) |
| @@ -16904,7 +16900,7 @@ sync_frame_with_window_matrix_rows (struct window *w) | |||
| 16904 | 16900 | ||
| 16905 | /* Preconditions: W must be a leaf window and full-width. Its frame | 16901 | /* Preconditions: W must be a leaf window and full-width. Its frame |
| 16906 | must have a frame matrix. */ | 16902 | must have a frame matrix. */ |
| 16907 | eassert (NILP (w->hchild) && NILP (w->vchild)); | 16903 | eassert (BUFFERP (w->contents)); |
| 16908 | eassert (WINDOW_FULL_WIDTH_P (w)); | 16904 | eassert (WINDOW_FULL_WIDTH_P (w)); |
| 16909 | eassert (!FRAME_WINDOW_P (f)); | 16905 | eassert (!FRAME_WINDOW_P (f)); |
| 16910 | 16906 | ||
| @@ -16946,7 +16942,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos, | |||
| 16946 | { | 16942 | { |
| 16947 | struct glyph_row *row = start; | 16943 | struct glyph_row *row = start; |
| 16948 | struct glyph_row *best_row = NULL; | 16944 | struct glyph_row *best_row = NULL; |
| 16949 | ptrdiff_t mindif = BUF_ZV (XBUFFER (w->buffer)) + 1; | 16945 | ptrdiff_t mindif = BUF_ZV (XBUFFER (w->contents)) + 1; |
| 16950 | int last_y; | 16946 | int last_y; |
| 16951 | 16947 | ||
| 16952 | /* If we happen to start on a header-line, skip that. */ | 16948 | /* If we happen to start on a header-line, skip that. */ |
| @@ -16982,7 +16978,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos, | |||
| 16982 | { | 16978 | { |
| 16983 | struct glyph *g; | 16979 | struct glyph *g; |
| 16984 | 16980 | ||
| 16985 | if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) | 16981 | if (NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) |
| 16986 | || (!best_row && !row->continued_p)) | 16982 | || (!best_row && !row->continued_p)) |
| 16987 | return row; | 16983 | return row; |
| 16988 | /* In bidi-reordered rows, there could be several rows | 16984 | /* In bidi-reordered rows, there could be several rows |
| @@ -17155,7 +17151,7 @@ try_window_id (struct window *w) | |||
| 17155 | wrapped line can change the wrap position, altering the line | 17151 | wrapped line can change the wrap position, altering the line |
| 17156 | above it. It might be worthwhile to handle this more | 17152 | above it. It might be worthwhile to handle this more |
| 17157 | intelligently, but for now just redisplay from scratch. */ | 17153 | intelligently, but for now just redisplay from scratch. */ |
| 17158 | if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap))) | 17154 | if (!NILP (BVAR (XBUFFER (w->contents), word_wrap))) |
| 17159 | GIVE_UP (21); | 17155 | GIVE_UP (21); |
| 17160 | 17156 | ||
| 17161 | /* Under bidi reordering, adding or deleting a character in the | 17157 | /* Under bidi reordering, adding or deleting a character in the |
| @@ -17166,8 +17162,8 @@ try_window_id (struct window *w) | |||
| 17166 | to find the paragraph limits and widen the range of redisplayed | 17162 | to find the paragraph limits and widen the range of redisplayed |
| 17167 | lines to that, but for now just give up this optimization and | 17163 | lines to that, but for now just give up this optimization and |
| 17168 | redisplay from scratch. */ | 17164 | redisplay from scratch. */ |
| 17169 | if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) | 17165 | if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) |
| 17170 | && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) | 17166 | && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction))) |
| 17171 | GIVE_UP (22); | 17167 | GIVE_UP (22); |
| 17172 | 17168 | ||
| 17173 | /* Make sure beg_unchanged and end_unchanged are up to date. Do it | 17169 | /* Make sure beg_unchanged and end_unchanged are up to date. Do it |
| @@ -18055,7 +18051,7 @@ glyphs in short form, otherwise show glyphs in long form. */) | |||
| 18055 | (Lisp_Object glyphs) | 18051 | (Lisp_Object glyphs) |
| 18056 | { | 18052 | { |
| 18057 | struct window *w = XWINDOW (selected_window); | 18053 | struct window *w = XWINDOW (selected_window); |
| 18058 | struct buffer *buffer = XBUFFER (w->buffer); | 18054 | struct buffer *buffer = XBUFFER (w->contents); |
| 18059 | 18055 | ||
| 18060 | fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n", | 18056 | fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n", |
| 18061 | BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer)); | 18057 | BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer)); |
| @@ -18161,7 +18157,7 @@ static struct glyph_row * | |||
| 18161 | get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) | 18157 | get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) |
| 18162 | { | 18158 | { |
| 18163 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 18159 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 18164 | struct buffer *buffer = XBUFFER (w->buffer); | 18160 | struct buffer *buffer = XBUFFER (w->contents); |
| 18165 | struct buffer *old = current_buffer; | 18161 | struct buffer *old = current_buffer; |
| 18166 | const unsigned char *arrow_string = SDATA (overlay_arrow_string); | 18162 | const unsigned char *arrow_string = SDATA (overlay_arrow_string); |
| 18167 | int arrow_len = SCHARS (overlay_arrow_string); | 18163 | int arrow_len = SCHARS (overlay_arrow_string); |
| @@ -19368,7 +19364,7 @@ display_line (struct it *it) | |||
| 19368 | row->glyphs[TEXT_AREA]->charpos = -1; | 19364 | row->glyphs[TEXT_AREA]->charpos = -1; |
| 19369 | row->displays_text_p = 0; | 19365 | row->displays_text_p = 0; |
| 19370 | 19366 | ||
| 19371 | if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines)) | 19367 | if (!NILP (BVAR (XBUFFER (it->w->contents), indicate_empty_lines)) |
| 19372 | && (!MINI_WINDOW_P (it->w) | 19368 | && (!MINI_WINDOW_P (it->w) |
| 19373 | || (minibuf_level && EQ (it->window, minibuf_window)))) | 19369 | || (minibuf_level && EQ (it->window, minibuf_window)))) |
| 19374 | row->indicate_empty_line_p = 1; | 19370 | row->indicate_empty_line_p = 1; |
| @@ -20183,10 +20179,8 @@ redisplay_mode_lines (Lisp_Object window, int force) | |||
| 20183 | { | 20179 | { |
| 20184 | struct window *w = XWINDOW (window); | 20180 | struct window *w = XWINDOW (window); |
| 20185 | 20181 | ||
| 20186 | if (WINDOWP (w->hchild)) | 20182 | if (WINDOWP (w->contents)) |
| 20187 | nwindows += redisplay_mode_lines (w->hchild, force); | 20183 | nwindows += redisplay_mode_lines (w->contents, force); |
| 20188 | else if (WINDOWP (w->vchild)) | ||
| 20189 | nwindows += redisplay_mode_lines (w->vchild, force); | ||
| 20190 | else if (force | 20184 | else if (force |
| 20191 | || FRAME_GARBAGED_P (XFRAME (w->frame)) | 20185 | || FRAME_GARBAGED_P (XFRAME (w->frame)) |
| 20192 | || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p) | 20186 | || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p) |
| @@ -20196,7 +20190,7 @@ redisplay_mode_lines (Lisp_Object window, int force) | |||
| 20196 | 20190 | ||
| 20197 | /* Set the window's buffer for the mode line display. */ | 20191 | /* Set the window's buffer for the mode line display. */ |
| 20198 | SET_TEXT_POS (lpoint, PT, PT_BYTE); | 20192 | SET_TEXT_POS (lpoint, PT, PT_BYTE); |
| 20199 | set_buffer_internal_1 (XBUFFER (w->buffer)); | 20193 | set_buffer_internal_1 (XBUFFER (w->contents)); |
| 20200 | 20194 | ||
| 20201 | /* Point refers normally to the selected window. For any | 20195 | /* Point refers normally to the selected window. For any |
| 20202 | other window, set up appropriate value. */ | 20196 | other window, set up appropriate value. */ |
| @@ -20978,7 +20972,7 @@ are the selected window and the WINDOW's buffer). */) | |||
| 20978 | XSETWINDOW (window, w); | 20972 | XSETWINDOW (window, w); |
| 20979 | 20973 | ||
| 20980 | if (NILP (buffer)) | 20974 | if (NILP (buffer)) |
| 20981 | buffer = w->buffer; | 20975 | buffer = w->contents; |
| 20982 | CHECK_BUFFER (buffer); | 20976 | CHECK_BUFFER (buffer); |
| 20983 | 20977 | ||
| 20984 | /* Make formatting the modeline a non-op when noninteractive, otherwise | 20978 | /* Make formatting the modeline a non-op when noninteractive, otherwise |
| @@ -22284,7 +22278,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, | |||
| 22284 | return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w)); | 22278 | return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w)); |
| 22285 | } | 22279 | } |
| 22286 | 22280 | ||
| 22287 | prop = buffer_local_value_1 (prop, it->w->buffer); | 22281 | prop = buffer_local_value_1 (prop, it->w->contents); |
| 22288 | if (EQ (prop, Qunbound)) | 22282 | if (EQ (prop, Qunbound)) |
| 22289 | prop = Qnil; | 22283 | prop = Qnil; |
| 22290 | } | 22284 | } |
| @@ -22343,7 +22337,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, | |||
| 22343 | return OK_PIXELS (pixels); | 22337 | return OK_PIXELS (pixels); |
| 22344 | } | 22338 | } |
| 22345 | 22339 | ||
| 22346 | car = buffer_local_value_1 (car, it->w->buffer); | 22340 | car = buffer_local_value_1 (car, it->w->contents); |
| 22347 | if (EQ (car, Qunbound)) | 22341 | if (EQ (car, Qunbound)) |
| 22348 | car = Qnil; | 22342 | car = Qnil; |
| 22349 | } | 22343 | } |
| @@ -24325,7 +24319,7 @@ produce_stretch_glyph (struct it *it) | |||
| 24325 | int n = width; | 24319 | int n = width; |
| 24326 | 24320 | ||
| 24327 | if (!STRINGP (object)) | 24321 | if (!STRINGP (object)) |
| 24328 | object = it->w->buffer; | 24322 | object = it->w->contents; |
| 24329 | #ifdef HAVE_WINDOW_SYSTEM | 24323 | #ifdef HAVE_WINDOW_SYSTEM |
| 24330 | if (FRAME_WINDOW_P (it->f)) | 24324 | if (FRAME_WINDOW_P (it->f)) |
| 24331 | append_stretch_glyph (it, object, width, height, ascent); | 24325 | append_stretch_glyph (it, object, width, height, ascent); |
| @@ -25724,7 +25718,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, | |||
| 25724 | int *active_cursor) | 25718 | int *active_cursor) |
| 25725 | { | 25719 | { |
| 25726 | struct frame *f = XFRAME (w->frame); | 25720 | struct frame *f = XFRAME (w->frame); |
| 25727 | struct buffer *b = XBUFFER (w->buffer); | 25721 | struct buffer *b = XBUFFER (w->contents); |
| 25728 | int cursor_type = DEFAULT_CURSOR; | 25722 | int cursor_type = DEFAULT_CURSOR; |
| 25729 | Lisp_Object alt_cursor; | 25723 | Lisp_Object alt_cursor; |
| 25730 | int non_selected = 0; | 25724 | int non_selected = 0; |
| @@ -26282,10 +26276,8 @@ update_cursor_in_window_tree (struct window *w, int on_p) | |||
| 26282 | { | 26276 | { |
| 26283 | while (w) | 26277 | while (w) |
| 26284 | { | 26278 | { |
| 26285 | if (!NILP (w->hchild)) | 26279 | if (WINDOWP (w->contents)) |
| 26286 | update_cursor_in_window_tree (XWINDOW (w->hchild), on_p); | 26280 | update_cursor_in_window_tree (XWINDOW (w->contents), on_p); |
| 26287 | else if (!NILP (w->vchild)) | ||
| 26288 | update_cursor_in_window_tree (XWINDOW (w->vchild), on_p); | ||
| 26289 | else | 26281 | else |
| 26290 | update_window_cursor (w, on_p); | 26282 | update_window_cursor (w, on_p); |
| 26291 | 26283 | ||
| @@ -27531,7 +27523,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 27531 | { | 27523 | { |
| 27532 | help_echo_string = help; | 27524 | help_echo_string = help; |
| 27533 | XSETWINDOW (help_echo_window, w); | 27525 | XSETWINDOW (help_echo_window, w); |
| 27534 | help_echo_object = w->buffer; | 27526 | help_echo_object = w->contents; |
| 27535 | help_echo_pos = charpos; | 27527 | help_echo_pos = charpos; |
| 27536 | } | 27528 | } |
| 27537 | } | 27529 | } |
| @@ -27567,7 +27559,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 27567 | { | 27559 | { |
| 27568 | Lisp_Object default_help | 27560 | Lisp_Object default_help |
| 27569 | = buffer_local_value_1 (Qmode_line_default_help_echo, | 27561 | = buffer_local_value_1 (Qmode_line_default_help_echo, |
| 27570 | w->buffer); | 27562 | w->contents); |
| 27571 | 27563 | ||
| 27572 | if (STRINGP (default_help)) | 27564 | if (STRINGP (default_help)) |
| 27573 | { | 27565 | { |
| @@ -27842,7 +27834,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 27842 | 27834 | ||
| 27843 | /* Are we in a window whose display is up to date? | 27835 | /* Are we in a window whose display is up to date? |
| 27844 | And verify the buffer's text has not changed. */ | 27836 | And verify the buffer's text has not changed. */ |
| 27845 | b = XBUFFER (w->buffer); | 27837 | b = XBUFFER (w->contents); |
| 27846 | if (part == ON_TEXT | 27838 | if (part == ON_TEXT |
| 27847 | && w->window_end_valid | 27839 | && w->window_end_valid |
| 27848 | && w->last_modified == BUF_MODIFF (b) | 27840 | && w->last_modified == BUF_MODIFF (b) |
| @@ -28051,8 +28043,8 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 28051 | if (pos > 0) | 28043 | if (pos > 0) |
| 28052 | { | 28044 | { |
| 28053 | mouse_face = get_char_property_and_overlay | 28045 | mouse_face = get_char_property_and_overlay |
| 28054 | (make_number (pos), Qmouse_face, w->buffer, &overlay); | 28046 | (make_number (pos), Qmouse_face, w->contents, &overlay); |
| 28055 | buffer = w->buffer; | 28047 | buffer = w->contents; |
| 28056 | disp_string = object; | 28048 | disp_string = object; |
| 28057 | } | 28049 | } |
| 28058 | } | 28050 | } |
| @@ -28165,11 +28157,11 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 28165 | if (p > 0) | 28157 | if (p > 0) |
| 28166 | { | 28158 | { |
| 28167 | help = Fget_char_property (make_number (p), | 28159 | help = Fget_char_property (make_number (p), |
| 28168 | Qhelp_echo, w->buffer); | 28160 | Qhelp_echo, w->contents); |
| 28169 | if (!NILP (help)) | 28161 | if (!NILP (help)) |
| 28170 | { | 28162 | { |
| 28171 | charpos = p; | 28163 | charpos = p; |
| 28172 | obj = w->buffer; | 28164 | obj = w->contents; |
| 28173 | } | 28165 | } |
| 28174 | } | 28166 | } |
| 28175 | } | 28167 | } |
| @@ -28220,7 +28212,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 28220 | ptrdiff_t p = string_buffer_position (obj, start); | 28212 | ptrdiff_t p = string_buffer_position (obj, start); |
| 28221 | if (p > 0) | 28213 | if (p > 0) |
| 28222 | pointer = Fget_char_property (make_number (p), | 28214 | pointer = Fget_char_property (make_number (p), |
| 28223 | Qpointer, w->buffer); | 28215 | Qpointer, w->contents); |
| 28224 | } | 28216 | } |
| 28225 | } | 28217 | } |
| 28226 | else if (BUFFERP (obj) | 28218 | else if (BUFFERP (obj) |
| @@ -28663,12 +28655,9 @@ expose_window_tree (struct window *w, XRectangle *r) | |||
| 28663 | 28655 | ||
| 28664 | while (w && !FRAME_GARBAGED_P (f)) | 28656 | while (w && !FRAME_GARBAGED_P (f)) |
| 28665 | { | 28657 | { |
| 28666 | if (!NILP (w->hchild)) | 28658 | if (WINDOWP (w->contents)) |
| 28667 | mouse_face_overwritten_p | ||
| 28668 | |= expose_window_tree (XWINDOW (w->hchild), r); | ||
| 28669 | else if (!NILP (w->vchild)) | ||
| 28670 | mouse_face_overwritten_p | 28659 | mouse_face_overwritten_p |
| 28671 | |= expose_window_tree (XWINDOW (w->vchild), r); | 28660 | |= expose_window_tree (XWINDOW (w->contents), r); |
| 28672 | else | 28661 | else |
| 28673 | mouse_face_overwritten_p |= expose_window (w, r); | 28662 | mouse_face_overwritten_p |= expose_window (w, r); |
| 28674 | 28663 | ||
diff --git a/src/xfaces.c b/src/xfaces.c index 6db6ac7683f..b2ace1be14e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -231,7 +231,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 231 | #undef FRAME_X_DISPLAY_INFO | 231 | #undef FRAME_X_DISPLAY_INFO |
| 232 | #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO | 232 | #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO |
| 233 | #define x_display_info w32_display_info | 233 | #define x_display_info w32_display_info |
| 234 | #define check_x check_w32 | ||
| 235 | #define GCGraphicsExposures 0 | 234 | #define GCGraphicsExposures 0 |
| 236 | #endif /* HAVE_NTGUI */ | 235 | #endif /* HAVE_NTGUI */ |
| 237 | 236 | ||
| @@ -239,7 +238,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 239 | #undef FRAME_X_DISPLAY_INFO | 238 | #undef FRAME_X_DISPLAY_INFO |
| 240 | #define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO | 239 | #define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO |
| 241 | #define x_display_info ns_display_info | 240 | #define x_display_info ns_display_info |
| 242 | #define check_x check_ns | ||
| 243 | #define GCGraphicsExposures 0 | 241 | #define GCGraphicsExposures 0 |
| 244 | #endif /* HAVE_NS */ | 242 | #endif /* HAVE_NS */ |
| 245 | #endif /* HAVE_WINDOW_SYSTEM */ | 243 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -1636,7 +1634,7 @@ the WIDTH times as wide as FACE on FRAME. */) | |||
| 1636 | struct frame *f; | 1634 | struct frame *f; |
| 1637 | int size, avgwidth IF_LINT (= 0); | 1635 | int size, avgwidth IF_LINT (= 0); |
| 1638 | 1636 | ||
| 1639 | check_x (); | 1637 | check_window_system (NULL); |
| 1640 | CHECK_STRING (pattern); | 1638 | CHECK_STRING (pattern); |
| 1641 | 1639 | ||
| 1642 | if (! NILP (maximum)) | 1640 | if (! NILP (maximum)) |
| @@ -1645,8 +1643,8 @@ the WIDTH times as wide as FACE on FRAME. */) | |||
| 1645 | if (!NILP (width)) | 1643 | if (!NILP (width)) |
| 1646 | CHECK_NUMBER (width); | 1644 | CHECK_NUMBER (width); |
| 1647 | 1645 | ||
| 1648 | /* We can't simply call check_x_frame because this function may be | 1646 | /* We can't simply call decode_window_system_frame because |
| 1649 | called before any frame is created. */ | 1647 | this function may be called before any frame is created. */ |
| 1650 | f = decode_live_frame (frame); | 1648 | f = decode_live_frame (frame); |
| 1651 | if (! FRAME_WINDOW_P (f)) | 1649 | if (! FRAME_WINDOW_P (f)) |
| 1652 | { | 1650 | { |
| @@ -3925,8 +3923,8 @@ If FRAME is omitted or nil, use the selected frame. */) | |||
| 3925 | struct frame *f; | 3923 | struct frame *f; |
| 3926 | Lisp_Object lface1, lface2; | 3924 | Lisp_Object lface1, lface2; |
| 3927 | 3925 | ||
| 3928 | /* Don't use check_x_frame here because this function is called | 3926 | /* Don't use decode_window_system_frame here because this function |
| 3929 | before X frames exist. At that time, if FRAME is nil, | 3927 | is called before X frames exist. At that time, if FRAME is nil, |
| 3930 | selected_frame will be used which is the frame dumped with | 3928 | selected_frame will be used which is the frame dumped with |
| 3931 | Emacs. That frame is not an X frame. */ | 3929 | Emacs. That frame is not an X frame. */ |
| 3932 | f = EQ (frame, Qt) ? NULL : decode_live_frame (frame); | 3930 | f = EQ (frame, Qt) ? NULL : decode_live_frame (frame); |
| @@ -5964,7 +5962,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 5964 | 5962 | ||
| 5965 | /* W must display the current buffer. We could write this function | 5963 | /* W must display the current buffer. We could write this function |
| 5966 | to use the frame and buffer of W, but right now it doesn't. */ | 5964 | to use the frame and buffer of W, but right now it doesn't. */ |
| 5967 | /* eassert (XBUFFER (w->buffer) == current_buffer); */ | 5965 | /* eassert (XBUFFER (w->contents) == current_buffer); */ |
| 5968 | 5966 | ||
| 5969 | XSETFASTINT (position, pos); | 5967 | XSETFASTINT (position, pos); |
| 5970 | 5968 | ||
| @@ -5974,9 +5972,9 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, | |||
| 5974 | 5972 | ||
| 5975 | /* Get the `face' or `mouse_face' text property at POS, and | 5973 | /* Get the `face' or `mouse_face' text property at POS, and |
| 5976 | determine the next position at which the property changes. */ | 5974 | determine the next position at which the property changes. */ |
| 5977 | prop = Fget_text_property (position, propname, w->buffer); | 5975 | prop = Fget_text_property (position, propname, w->contents); |
| 5978 | XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); | 5976 | XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); |
| 5979 | end = Fnext_single_property_change (position, propname, w->buffer, limit1); | 5977 | end = Fnext_single_property_change (position, propname, w->contents, limit1); |
| 5980 | if (INTEGERP (end)) | 5978 | if (INTEGERP (end)) |
| 5981 | endpos = XINT (end); | 5979 | endpos = XINT (end); |
| 5982 | 5980 | ||
| @@ -6072,7 +6070,7 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, | |||
| 6072 | 6070 | ||
| 6073 | /* W must display the current buffer. We could write this function | 6071 | /* W must display the current buffer. We could write this function |
| 6074 | to use the frame and buffer of W, but right now it doesn't. */ | 6072 | to use the frame and buffer of W, but right now it doesn't. */ |
| 6075 | /* eassert (XBUFFER (w->buffer) == current_buffer); */ | 6073 | /* eassert (XBUFFER (w->contents) == current_buffer); */ |
| 6076 | 6074 | ||
| 6077 | XSETFASTINT (position, pos); | 6075 | XSETFASTINT (position, pos); |
| 6078 | 6076 | ||
| @@ -6082,9 +6080,9 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, | |||
| 6082 | 6080 | ||
| 6083 | /* Get the `face' or `mouse_face' text property at POS, and | 6081 | /* Get the `face' or `mouse_face' text property at POS, and |
| 6084 | determine the next position at which the property changes. */ | 6082 | determine the next position at which the property changes. */ |
| 6085 | prop = Fget_text_property (position, propname, w->buffer); | 6083 | prop = Fget_text_property (position, propname, w->contents); |
| 6086 | XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); | 6084 | XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); |
| 6087 | end = Fnext_single_property_change (position, propname, w->buffer, limit1); | 6085 | end = Fnext_single_property_change (position, propname, w->contents, limit1); |
| 6088 | if (INTEGERP (end)) | 6086 | if (INTEGERP (end)) |
| 6089 | endpos = XINT (end); | 6087 | endpos = XINT (end); |
| 6090 | 6088 | ||
diff --git a/src/xfns.c b/src/xfns.c index e24d3981a09..f4c24cb09a0 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -123,10 +123,6 @@ extern LWLIB_ID widget_id_tick; | |||
| 123 | 123 | ||
| 124 | #define MAXREQUEST(dpy) (XMaxRequestSize (dpy)) | 124 | #define MAXREQUEST(dpy) (XMaxRequestSize (dpy)) |
| 125 | 125 | ||
| 126 | /* Nonzero if using X. */ | ||
| 127 | |||
| 128 | int x_in_use; | ||
| 129 | |||
| 130 | static Lisp_Object Qsuppress_icon; | 126 | static Lisp_Object Qsuppress_icon; |
| 131 | static Lisp_Object Qundefined_color; | 127 | static Lisp_Object Qundefined_color; |
| 132 | static Lisp_Object Qcompound_text, Qcancel_timer; | 128 | static Lisp_Object Qcompound_text, Qcancel_timer; |
| @@ -139,38 +135,6 @@ static int dpyinfo_refcount; | |||
| 139 | 135 | ||
| 140 | static struct x_display_info *x_display_info_for_name (Lisp_Object); | 136 | static struct x_display_info *x_display_info_for_name (Lisp_Object); |
| 141 | 137 | ||
| 142 | |||
| 143 | /* Error if we are not connected to X. */ | ||
| 144 | |||
| 145 | void | ||
| 146 | check_x (void) | ||
| 147 | { | ||
| 148 | if (! x_in_use) | ||
| 149 | error ("X windows are not in use or not initialized"); | ||
| 150 | } | ||
| 151 | |||
| 152 | /* Nonzero if we can use mouse menus. | ||
| 153 | You should not call this unless HAVE_MENUS is defined. */ | ||
| 154 | |||
| 155 | int | ||
| 156 | have_menus_p (void) | ||
| 157 | { | ||
| 158 | return x_in_use; | ||
| 159 | } | ||
| 160 | |||
| 161 | /* Extract a frame as a FRAME_PTR, defaulting to the selected frame | ||
| 162 | and checking validity for X. */ | ||
| 163 | |||
| 164 | FRAME_PTR | ||
| 165 | check_x_frame (Lisp_Object frame) | ||
| 166 | { | ||
| 167 | struct frame *f = decode_live_frame (frame); | ||
| 168 | |||
| 169 | if (! FRAME_X_P (f)) | ||
| 170 | error ("Non-X frame used"); | ||
| 171 | return f; | ||
| 172 | } | ||
| 173 | |||
| 174 | /* Let the user specify an X display with a Lisp object. | 138 | /* Let the user specify an X display with a Lisp object. |
| 175 | OBJECT may be nil, a frame or a terminal object. | 139 | OBJECT may be nil, a frame or a terminal object. |
| 176 | nil stands for the selected frame--or, if that is not an X frame, | 140 | nil stands for the selected frame--or, if that is not an X frame, |
| @@ -205,7 +169,7 @@ check_x_display_info (Lisp_Object object) | |||
| 205 | dpyinfo = x_display_info_for_name (object); | 169 | dpyinfo = x_display_info_for_name (object); |
| 206 | else | 170 | else |
| 207 | { | 171 | { |
| 208 | FRAME_PTR f = check_x_frame (object); | 172 | FRAME_PTR f = decode_window_system_frame (object); |
| 209 | dpyinfo = FRAME_X_DISPLAY_INFO (f); | 173 | dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 210 | } | 174 | } |
| 211 | 175 | ||
| @@ -2992,7 +2956,7 @@ If FRAME is omitted or nil, use the selected frame. | |||
| 2992 | Signal error if FRAME is not an X frame. */) | 2956 | Signal error if FRAME is not an X frame. */) |
| 2993 | (Lisp_Object frame) | 2957 | (Lisp_Object frame) |
| 2994 | { | 2958 | { |
| 2995 | struct frame *f = check_x_frame (frame); | 2959 | struct frame *f = decode_window_system_frame (frame); |
| 2996 | 2960 | ||
| 2997 | block_input (); | 2961 | block_input (); |
| 2998 | x_wm_set_size_hint (f, 0, 0); | 2962 | x_wm_set_size_hint (f, 0, 0); |
| @@ -3483,7 +3447,7 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, | |||
| 3483 | FRAME nil means use the selected frame. */) | 3447 | FRAME nil means use the selected frame. */) |
| 3484 | (Lisp_Object frame) | 3448 | (Lisp_Object frame) |
| 3485 | { | 3449 | { |
| 3486 | struct frame *f = check_x_frame (frame); | 3450 | struct frame *f = decode_window_system_frame (frame); |
| 3487 | Display *dpy = FRAME_X_DISPLAY (f); | 3451 | Display *dpy = FRAME_X_DISPLAY (f); |
| 3488 | 3452 | ||
| 3489 | block_input (); | 3453 | block_input (); |
| @@ -3516,7 +3480,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, | |||
| 3516 | (Lisp_Object color, Lisp_Object frame) | 3480 | (Lisp_Object color, Lisp_Object frame) |
| 3517 | { | 3481 | { |
| 3518 | XColor foo; | 3482 | XColor foo; |
| 3519 | FRAME_PTR f = check_x_frame (frame); | 3483 | FRAME_PTR f = decode_window_system_frame (frame); |
| 3520 | 3484 | ||
| 3521 | CHECK_STRING (color); | 3485 | CHECK_STRING (color); |
| 3522 | 3486 | ||
| @@ -3531,7 +3495,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, | |||
| 3531 | (Lisp_Object color, Lisp_Object frame) | 3495 | (Lisp_Object color, Lisp_Object frame) |
| 3532 | { | 3496 | { |
| 3533 | XColor foo; | 3497 | XColor foo; |
| 3534 | FRAME_PTR f = check_x_frame (frame); | 3498 | FRAME_PTR f = decode_window_system_frame (frame); |
| 3535 | 3499 | ||
| 3536 | CHECK_STRING (color); | 3500 | CHECK_STRING (color); |
| 3537 | 3501 | ||
| @@ -3996,7 +3960,6 @@ x_display_info_for_name (Lisp_Object name) | |||
| 3996 | if (dpyinfo == 0) | 3960 | if (dpyinfo == 0) |
| 3997 | error ("Cannot connect to X server %s", SDATA (name)); | 3961 | error ("Cannot connect to X server %s", SDATA (name)); |
| 3998 | 3962 | ||
| 3999 | x_in_use = 1; | ||
| 4000 | XSETFASTINT (Vwindow_system_version, 11); | 3963 | XSETFASTINT (Vwindow_system_version, 11); |
| 4001 | 3964 | ||
| 4002 | return dpyinfo; | 3965 | return dpyinfo; |
| @@ -4050,8 +4013,6 @@ An insecure way to solve the problem may be to use `xhost'.\n", | |||
| 4050 | error ("Cannot connect to X server %s", SDATA (display)); | 4013 | error ("Cannot connect to X server %s", SDATA (display)); |
| 4051 | } | 4014 | } |
| 4052 | 4015 | ||
| 4053 | x_in_use = 1; | ||
| 4054 | |||
| 4055 | XSETFASTINT (Vwindow_system_version, 11); | 4016 | XSETFASTINT (Vwindow_system_version, 11); |
| 4056 | return Qnil; | 4017 | return Qnil; |
| 4057 | } | 4018 | } |
| @@ -4143,7 +4104,7 @@ FRAME. Default is to change on the edit X window. */) | |||
| 4143 | (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, | 4104 | (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, |
| 4144 | Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) | 4105 | Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) |
| 4145 | { | 4106 | { |
| 4146 | struct frame *f = check_x_frame (frame); | 4107 | struct frame *f = decode_window_system_frame (frame); |
| 4147 | Atom prop_atom; | 4108 | Atom prop_atom; |
| 4148 | Atom target_type = XA_STRING; | 4109 | Atom target_type = XA_STRING; |
| 4149 | int element_format = 8; | 4110 | int element_format = 8; |
| @@ -4221,7 +4182,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property, | |||
| 4221 | FRAME nil or omitted means use the selected frame. Value is PROP. */) | 4182 | FRAME nil or omitted means use the selected frame. Value is PROP. */) |
| 4222 | (Lisp_Object prop, Lisp_Object frame) | 4183 | (Lisp_Object prop, Lisp_Object frame) |
| 4223 | { | 4184 | { |
| 4224 | struct frame *f = check_x_frame (frame); | 4185 | struct frame *f = decode_window_system_frame (frame); |
| 4225 | Atom prop_atom; | 4186 | Atom prop_atom; |
| 4226 | 4187 | ||
| 4227 | CHECK_STRING (prop); | 4188 | CHECK_STRING (prop); |
| @@ -4257,7 +4218,7 @@ no value of TYPE (always string in the MS Windows case). */) | |||
| 4257 | (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, | 4218 | (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, |
| 4258 | Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) | 4219 | Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) |
| 4259 | { | 4220 | { |
| 4260 | struct frame *f = check_x_frame (frame); | 4221 | struct frame *f = decode_window_system_frame (frame); |
| 4261 | Atom prop_atom; | 4222 | Atom prop_atom; |
| 4262 | int rc; | 4223 | int rc; |
| 4263 | Lisp_Object prop_value = Qnil; | 4224 | Lisp_Object prop_value = Qnil; |
| @@ -4525,8 +4486,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 4525 | Lisp_Object buffer; | 4486 | Lisp_Object buffer; |
| 4526 | struct buffer *old_buffer; | 4487 | struct buffer *old_buffer; |
| 4527 | 4488 | ||
| 4528 | check_x (); | ||
| 4529 | |||
| 4530 | if (!dpyinfo->terminal->name) | 4489 | if (!dpyinfo->terminal->name) |
| 4531 | error ("Terminal is not live, can't create new frames on it"); | 4490 | error ("Terminal is not live, can't create new frames on it"); |
| 4532 | 4491 | ||
| @@ -4923,7 +4882,7 @@ Text larger than the specified size is clipped. */) | |||
| 4923 | if (SCHARS (string) == 0) | 4882 | if (SCHARS (string) == 0) |
| 4924 | string = make_unibyte_string (" ", 1); | 4883 | string = make_unibyte_string (" ", 1); |
| 4925 | 4884 | ||
| 4926 | f = check_x_frame (frame); | 4885 | f = decode_window_system_frame (frame); |
| 4927 | if (NILP (timeout)) | 4886 | if (NILP (timeout)) |
| 4928 | timeout = make_number (5); | 4887 | timeout = make_number (5); |
| 4929 | else | 4888 | else |
| @@ -5043,7 +5002,7 @@ Text larger than the specified size is clipped. */) | |||
| 5043 | 5002 | ||
| 5044 | /* Display the tooltip text in a temporary buffer. */ | 5003 | /* Display the tooltip text in a temporary buffer. */ |
| 5045 | old_buffer = current_buffer; | 5004 | old_buffer = current_buffer; |
| 5046 | set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); | 5005 | set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->contents)); |
| 5047 | bset_truncate_lines (current_buffer, Qnil); | 5006 | bset_truncate_lines (current_buffer, Qnil); |
| 5048 | clear_glyph_matrix (w->desired_matrix); | 5007 | clear_glyph_matrix (w->desired_matrix); |
| 5049 | clear_glyph_matrix (w->current_matrix); | 5008 | clear_glyph_matrix (w->current_matrix); |
| @@ -5246,7 +5205,7 @@ DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog, | |||
| 5246 | #ifdef USE_GTK | 5205 | #ifdef USE_GTK |
| 5247 | if (use_dialog_box | 5206 | if (use_dialog_box |
| 5248 | && use_file_dialog | 5207 | && use_file_dialog |
| 5249 | && have_menus_p () | 5208 | && window_system_available (SELECTED_FRAME ()) |
| 5250 | && xg_uses_old_file_dialog ()) | 5209 | && xg_uses_old_file_dialog ()) |
| 5251 | return Qt; | 5210 | return Qt; |
| 5252 | #endif | 5211 | #endif |
| @@ -5316,7 +5275,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5316 | ptrdiff_t count = SPECPDL_INDEX (); | 5275 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5317 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 5276 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 5318 | 5277 | ||
| 5319 | check_x (); | 5278 | check_window_system (f); |
| 5320 | 5279 | ||
| 5321 | GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); | 5280 | GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); |
| 5322 | 5281 | ||
| @@ -5486,7 +5445,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5486 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 5445 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 5487 | char *cdef_file; | 5446 | char *cdef_file; |
| 5488 | 5447 | ||
| 5489 | check_x (); | 5448 | check_window_system (f); |
| 5490 | 5449 | ||
| 5491 | GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); | 5450 | GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); |
| 5492 | 5451 | ||
| @@ -5541,15 +5500,13 @@ FRAME is the frame on which to pop up the font chooser. If omitted or | |||
| 5541 | nil, it defaults to the selected frame. */) | 5500 | nil, it defaults to the selected frame. */) |
| 5542 | (Lisp_Object frame, Lisp_Object ignored) | 5501 | (Lisp_Object frame, Lisp_Object ignored) |
| 5543 | { | 5502 | { |
| 5544 | FRAME_PTR f = check_x_frame (frame); | 5503 | FRAME_PTR f = decode_window_system_frame (frame); |
| 5545 | Lisp_Object font; | 5504 | Lisp_Object font; |
| 5546 | Lisp_Object font_param; | 5505 | Lisp_Object font_param; |
| 5547 | char *default_name = NULL; | 5506 | char *default_name = NULL; |
| 5548 | struct gcpro gcpro1, gcpro2; | 5507 | struct gcpro gcpro1, gcpro2; |
| 5549 | ptrdiff_t count = SPECPDL_INDEX (); | 5508 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5550 | 5509 | ||
| 5551 | check_x (); | ||
| 5552 | |||
| 5553 | if (popup_activated ()) | 5510 | if (popup_activated ()) |
| 5554 | error ("Trying to use a menu from within a menu-entry"); | 5511 | error ("Trying to use a menu from within a menu-entry"); |
| 5555 | 5512 | ||
| @@ -5609,7 +5566,7 @@ present and mapped to the usual X keysyms. */) | |||
| 5609 | return Qlambda; | 5566 | return Qlambda; |
| 5610 | #else | 5567 | #else |
| 5611 | XkbDescPtr kb; | 5568 | XkbDescPtr kb; |
| 5612 | struct frame *f = check_x_frame (frame); | 5569 | struct frame *f = decode_window_system_frame (frame); |
| 5613 | Display *dpy = FRAME_X_DISPLAY (f); | 5570 | Display *dpy = FRAME_X_DISPLAY (f); |
| 5614 | Lisp_Object have_keys; | 5571 | Lisp_Object have_keys; |
| 5615 | int major, minor, op, event, error_code; | 5572 | int major, minor, op, event, error_code; |
| @@ -5737,9 +5694,6 @@ frame_parm_handler x_frame_parm_handlers[] = | |||
| 5737 | void | 5694 | void |
| 5738 | syms_of_xfns (void) | 5695 | syms_of_xfns (void) |
| 5739 | { | 5696 | { |
| 5740 | /* This is zero if not using X windows. */ | ||
| 5741 | x_in_use = 0; | ||
| 5742 | |||
| 5743 | /* The section below is built by the lisp expression at the top of the file, | 5697 | /* The section below is built by the lisp expression at the top of the file, |
| 5744 | just above where these variables are declared. */ | 5698 | just above where these variables are declared. */ |
| 5745 | /*&&& init symbols here &&&*/ | 5699 | /*&&& init symbols here &&&*/ |
| @@ -5919,9 +5873,6 @@ When using Gtk+ tooltips, the tooltip face is not used. */); | |||
| 5919 | defsubr (&Sx_focus_frame); | 5873 | defsubr (&Sx_focus_frame); |
| 5920 | defsubr (&Sx_backspace_delete_keys_p); | 5874 | defsubr (&Sx_backspace_delete_keys_p); |
| 5921 | 5875 | ||
| 5922 | /* Setting callback functions for fontset handler. */ | ||
| 5923 | check_window_system_func = check_x; | ||
| 5924 | |||
| 5925 | defsubr (&Sx_show_tip); | 5876 | defsubr (&Sx_show_tip); |
| 5926 | defsubr (&Sx_hide_tip); | 5877 | defsubr (&Sx_hide_tip); |
| 5927 | tip_timer = Qnil; | 5878 | tip_timer = Qnil; |
diff --git a/src/xgselect.c b/src/xgselect.c index 2c8e9671abb..0b5ad6ae70d 100644 --- a/src/xgselect.c +++ b/src/xgselect.c | |||
| @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include <glib.h> | 26 | #include <glib.h> |
| 27 | #include <errno.h> | 27 | #include <errno.h> |
| 28 | #include "xterm.h" | 28 | #include "xterm.h" |
| 29 | #include "frame.h" | ||
| 29 | 30 | ||
| 30 | int | 31 | int |
| 31 | xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | 32 | xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, |
| @@ -43,7 +44,7 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, | |||
| 43 | int i, nfds, tmo_in_millisec; | 44 | int i, nfds, tmo_in_millisec; |
| 44 | USE_SAFE_ALLOCA; | 45 | USE_SAFE_ALLOCA; |
| 45 | 46 | ||
| 46 | if (! (x_in_use | 47 | if (! (window_system_available (NULL) |
| 47 | && g_main_context_pending (context = g_main_context_default ()))) | 48 | && g_main_context_pending (context = g_main_context_default ()))) |
| 48 | return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask); | 49 | return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask); |
| 49 | 50 | ||
diff --git a/src/xmenu.c b/src/xmenu.c index af08eeb657c..9993bd87d5b 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -223,8 +223,6 @@ for instance using the window manager, then this produces a quit and | |||
| 223 | FRAME_PTR f = NULL; | 223 | FRAME_PTR f = NULL; |
| 224 | Lisp_Object window; | 224 | Lisp_Object window; |
| 225 | 225 | ||
| 226 | check_x (); | ||
| 227 | |||
| 228 | /* Decode the first argument: find the window or frame to use. */ | 226 | /* Decode the first argument: find the window or frame to use. */ |
| 229 | if (EQ (position, Qt) | 227 | if (EQ (position, Qt) |
| 230 | || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) | 228 | || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) |
| @@ -277,8 +275,7 @@ for instance using the window manager, then this produces a quit and | |||
| 277 | but I don't want to make one now. */ | 275 | but I don't want to make one now. */ |
| 278 | CHECK_WINDOW (window); | 276 | CHECK_WINDOW (window); |
| 279 | 277 | ||
| 280 | if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) | 278 | check_window_system (f); |
| 281 | error ("Can not put X dialog on this terminal"); | ||
| 282 | 279 | ||
| 283 | /* Force a redisplay before showing the dialog. If a frame is created | 280 | /* Force a redisplay before showing the dialog. If a frame is created |
| 284 | just before showing the dialog, its contents may not have been fully | 281 | just before showing the dialog, its contents may not have been fully |
| @@ -485,7 +482,7 @@ If FRAME is nil or not given, use the selected frame. */) | |||
| 485 | (Lisp_Object frame) | 482 | (Lisp_Object frame) |
| 486 | { | 483 | { |
| 487 | XEvent ev; | 484 | XEvent ev; |
| 488 | FRAME_PTR f = check_x_frame (frame); | 485 | FRAME_PTR f = decode_window_system_frame (frame); |
| 489 | Widget menubar; | 486 | Widget menubar; |
| 490 | block_input (); | 487 | block_input (); |
| 491 | 488 | ||
| @@ -569,7 +566,7 @@ If FRAME is nil or not given, use the selected frame. */) | |||
| 569 | block_input (). */ | 566 | block_input (). */ |
| 570 | 567 | ||
| 571 | block_input (); | 568 | block_input (); |
| 572 | f = check_x_frame (frame); | 569 | f = decode_window_system_frame (frame); |
| 573 | 570 | ||
| 574 | if (FRAME_EXTERNAL_MENU_BAR (f)) | 571 | if (FRAME_EXTERNAL_MENU_BAR (f)) |
| 575 | set_frame_menubar (f, 0, 1); | 572 | set_frame_menubar (f, 0, 1); |
| @@ -976,7 +973,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) | |||
| 976 | if (! menubar_widget) | 973 | if (! menubar_widget) |
| 977 | previous_menu_items_used = 0; | 974 | previous_menu_items_used = 0; |
| 978 | 975 | ||
| 979 | buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; | 976 | buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents; |
| 980 | specbind (Qinhibit_quit, Qt); | 977 | specbind (Qinhibit_quit, Qt); |
| 981 | /* Don't let the debugger step into this code | 978 | /* Don't let the debugger step into this code |
| 982 | because it is not reentrant. */ | 979 | because it is not reentrant. */ |
diff --git a/src/xselect.c b/src/xselect.c index cca1a47212b..b422a22d68b 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -2450,7 +2450,7 @@ Use the display for FRAME or the current frame if FRAME is not given or nil. | |||
| 2450 | If the value is 0 or the atom is not known, return the empty string. */) | 2450 | If the value is 0 or the atom is not known, return the empty string. */) |
| 2451 | (Lisp_Object value, Lisp_Object frame) | 2451 | (Lisp_Object value, Lisp_Object frame) |
| 2452 | { | 2452 | { |
| 2453 | struct frame *f = check_x_frame (frame); | 2453 | struct frame *f = decode_window_system_frame (frame); |
| 2454 | char *name = 0; | 2454 | char *name = 0; |
| 2455 | char empty[] = ""; | 2455 | char empty[] = ""; |
| 2456 | Lisp_Object ret = Qnil; | 2456 | Lisp_Object ret = Qnil; |
| @@ -2485,7 +2485,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */) | |||
| 2485 | (Lisp_Object atom, Lisp_Object frame) | 2485 | (Lisp_Object atom, Lisp_Object frame) |
| 2486 | { | 2486 | { |
| 2487 | Atom x_atom; | 2487 | Atom x_atom; |
| 2488 | struct frame *f = check_x_frame (frame); | 2488 | struct frame *f = decode_window_system_frame (frame); |
| 2489 | ptrdiff_t i; | 2489 | ptrdiff_t i; |
| 2490 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 2490 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 2491 | 2491 | ||
| @@ -2618,7 +2618,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2618 | struct x_display_info *dpyinfo = check_x_display_info (display); | 2618 | struct x_display_info *dpyinfo = check_x_display_info (display); |
| 2619 | Window wdest; | 2619 | Window wdest; |
| 2620 | XEvent event; | 2620 | XEvent event; |
| 2621 | struct frame *f = check_x_frame (from); | 2621 | struct frame *f = decode_window_system_frame (from); |
| 2622 | int to_root; | 2622 | int to_root; |
| 2623 | 2623 | ||
| 2624 | CHECK_NUMBER (format); | 2624 | CHECK_NUMBER (format); |
| @@ -2635,7 +2635,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2635 | 2635 | ||
| 2636 | if (FRAMEP (dest) || NILP (dest)) | 2636 | if (FRAMEP (dest) || NILP (dest)) |
| 2637 | { | 2637 | { |
| 2638 | struct frame *fdest = check_x_frame (dest); | 2638 | struct frame *fdest = decode_window_system_frame (dest); |
| 2639 | wdest = FRAME_OUTER_WINDOW (fdest); | 2639 | wdest = FRAME_OUTER_WINDOW (fdest); |
| 2640 | } | 2640 | } |
| 2641 | else if (STRINGP (dest)) | 2641 | else if (STRINGP (dest)) |
diff --git a/src/xsmfns.c b/src/xsmfns.c index 0af196d2160..cb7122202df 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c | |||
| @@ -221,7 +221,7 @@ smc_save_yourself_CB (SmcConn smcConn, | |||
| 221 | props[props_idx]->name = xstrdup (SmRestartCommand); | 221 | props[props_idx]->name = xstrdup (SmRestartCommand); |
| 222 | props[props_idx]->type = xstrdup (SmLISTofARRAY8); | 222 | props[props_idx]->type = xstrdup (SmLISTofARRAY8); |
| 223 | /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */ | 223 | /* /path/to/emacs, --smid=xxx --no-splash --chdir=dir ... */ |
| 224 | if (initial_argc > INT_MAX - 3) | 224 | if (INT_MAX - 3 < initial_argc) |
| 225 | memory_full (SIZE_MAX); | 225 | memory_full (SIZE_MAX); |
| 226 | i = 3 + initial_argc; | 226 | i = 3 + initial_argc; |
| 227 | props[props_idx]->num_vals = i; | 227 | props[props_idx]->num_vals = i; |
diff --git a/src/xterm.h b/src/xterm.h index b241ff23559..16effc5c9ea 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -366,10 +366,6 @@ struct x_display_info | |||
| 366 | extern int use_xim; | 366 | extern int use_xim; |
| 367 | #endif | 367 | #endif |
| 368 | 368 | ||
| 369 | /* This checks to make sure we have a display. */ | ||
| 370 | |||
| 371 | extern void check_x (void); | ||
| 372 | |||
| 373 | extern struct frame *x_window_to_frame (struct x_display_info *, int); | 369 | extern struct frame *x_window_to_frame (struct x_display_info *, int); |
| 374 | extern struct frame *x_any_window_to_frame (struct x_display_info *, int); | 370 | extern struct frame *x_any_window_to_frame (struct x_display_info *, int); |
| 375 | extern struct frame *x_menubar_window_to_frame (struct x_display_info *, | 371 | extern struct frame *x_menubar_window_to_frame (struct x_display_info *, |
| @@ -927,7 +923,6 @@ void x_handle_property_notify (XPropertyEvent *); | |||
| 927 | 923 | ||
| 928 | /* From xfns.c. */ | 924 | /* From xfns.c. */ |
| 929 | 925 | ||
| 930 | struct frame *check_x_frame (Lisp_Object); | ||
| 931 | extern void x_free_gcs (struct frame *); | 926 | extern void x_free_gcs (struct frame *); |
| 932 | 927 | ||
| 933 | /* From xrdb.c. */ | 928 | /* From xrdb.c. */ |
| @@ -1012,7 +1007,6 @@ extern void x_clipboard_manager_save_all (void); | |||
| 1012 | 1007 | ||
| 1013 | extern struct x_display_info * check_x_display_info (Lisp_Object); | 1008 | extern struct x_display_info * check_x_display_info (Lisp_Object); |
| 1014 | extern Lisp_Object x_get_focus_frame (struct frame *); | 1009 | extern Lisp_Object x_get_focus_frame (struct frame *); |
| 1015 | extern int x_in_use; | ||
| 1016 | 1010 | ||
| 1017 | #ifdef USE_GTK | 1011 | #ifdef USE_GTK |
| 1018 | extern int xg_set_icon (struct frame *, Lisp_Object); | 1012 | extern int xg_set_icon (struct frame *, Lisp_Object); |