Now on revision 112175. ------------------------------------------------------------ revno: 112175 committer: Juanma Barranquero branch nick: trunk timestamp: Fri 2013-03-29 04:03:19 +0100 message: src/makefile.w32-in: Update dependencies. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-28 16:21:38 +0000 +++ src/ChangeLog 2013-03-29 03:03:19 +0000 @@ -1,3 +1,8 @@ +2013-03-29 Juanma Barranquero + + * makefile.w32-in ($(BLD)/filelock.$(O), $(BLD)/filelock.$(O)): + Update dependencies. + 2013-03-28 Stefan Monnier * lisp.h (save_type, XSAVE_POINTER, set_save_pointer, XSAVE_INTEGER) === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2013-02-25 17:36:03 +0000 +++ src/makefile.w32-in 2013-03-29 03:03:19 +0000 @@ -873,6 +873,7 @@ $(CHARACTER_H) \ $(CODING_H) \ $(CONFIG_H) \ + $(C_CTYPE_H) \ $(LISP_H) \ $(SYSTIME_H) @@ -1398,6 +1399,7 @@ $(NT_INC)/netdb.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/file.h \ + $(NT_INC)/sys/param.h \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/execinfo.h \ ------------------------------------------------------------ revno: 112174 committer: Juanma Barranquero branch nick: trunk timestamp: Fri 2013-03-29 04:02:22 +0100 message: nt/config.nt: Sync with autogen/config.in. (HAVE_XKBGETKEYBOARD): Remove. (HAVE_XKB): New macro. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2013-03-27 10:09:44 +0000 +++ nt/ChangeLog 2013-03-29 03:02:22 +0000 @@ -1,3 +1,9 @@ +2013-03-29 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + (HAVE_XKBGETKEYBOARD): Remove. + (HAVE_XKB): New macro. + 2013-03-27 Eli Zaretskii * makefile.w32-in (all-other-dirs-nmake, all-other-dirs-gmake) === modified file 'nt/config.nt' --- nt/config.nt 2013-03-26 20:30:43 +0000 +++ nt/config.nt 2013-03-29 03:02:22 +0000 @@ -1113,8 +1113,8 @@ /* Define to 1 if XIM is available */ #undef HAVE_XIM -/* Define to 1 if you have the XkbGetKeyboard function. */ -#undef HAVE_XKBGETKEYBOARD +/* Define to 1 if you have the Xkb extension. */ +#undef HAVE_XKB /* Define to 1 if you have the Xpm library (-lXpm). */ #undef HAVE_XPM ------------------------------------------------------------ revno: 112173 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-03-28 12:33:06 -0400 message: * lisp/emacs-lisp/edebug.el (edebug-mode): Make it a minor mode. (edebug--recursive-edit): Use it. (edebug-kill-buffer): Don't let-bind kill-buffer-hook. (edebug-temp-display-freq-count): Don't let-bind buffer-read-only. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-03-28 03:26:37 +0000 +++ lisp/ChangeLog 2013-03-28 16:33:06 +0000 @@ -1,3 +1,10 @@ +2013-03-28 Stefan Monnier + + * emacs-lisp/edebug.el (edebug-mode): Make it a minor mode. + (edebug--recursive-edit): Use it. + (edebug-kill-buffer): Don't let-bind kill-buffer-hook. + (edebug-temp-display-freq-count): Don't let-bind buffer-read-only. + 2013-03-28 Leo Liu * vc/vc-bzr.el (vc-bzr-revert): Don't backup. (Bug#14066) === modified file 'lisp/emacs-lisp/edebug.el' --- lisp/emacs-lisp/edebug.el 2013-03-24 06:42:25 +0000 +++ lisp/emacs-lisp/edebug.el 2013-03-28 16:33:06 +0000 @@ -54,6 +54,7 @@ (require 'macroexp) (eval-when-compile (require 'cl-lib)) +(eval-when-compile (require 'pcase)) ;;; Options @@ -2072,11 +2073,6 @@ (defvar edebug-active nil) ;; Non-nil when edebug is active -;;; add minor-mode-alist entry -(or (assq 'edebug-active minor-mode-alist) - (setq minor-mode-alist (cons (list 'edebug-active " *Debugging*") - minor-mode-alist))) - (defvar edebug-stack nil) ;; Stack of active functions evaluated via edebug. ;; Should be nil at the top level. @@ -2715,8 +2711,7 @@ ;; Start up a recursive edit inside of edebug. ;; The current buffer is the edebug-buffer, which is put into edebug-mode. ;; Assume that none of the variables below are buffer-local. - (let ((edebug-buffer-read-only buffer-read-only) - ;; match-data must be done in the outside buffer + (let (;; match-data must be done in the outside buffer (edebug-outside-match-data (with-current-buffer edebug-outside-buffer ; in case match buffer different (match-data))) @@ -2730,8 +2725,6 @@ ;; during a recursive-edit edebug-inside-windows - (edebug-outside-map (current-local-map)) - ;; Save the outside value of executing macro. (here??) (edebug-outside-executing-macro executing-kbd-macro) (edebug-outside-pre-command-hook @@ -2804,10 +2797,9 @@ (not (memq arg-mode '(after error)))) (message "Break")) - (setq buffer-read-only t) (setq signal-hook-function nil) - (edebug-mode) + (edebug-mode 1) (unwind-protect (recursive-edit) ; <<<<<<<<<< Recursive edit @@ -2828,10 +2820,7 @@ (set-buffer edebug-buffer) (if (memq edebug-execution-mode '(go Go-nonstop)) (edebug-overlay-arrow)) - (setq buffer-read-only edebug-buffer-read-only) - (use-local-map edebug-outside-map) - (remove-hook 'kill-buffer-hook 'edebug-kill-buffer t) - ) + (edebug-mode -1)) ;; gotta have a buffer to let its buffer local variables be set (get-buffer-create " bogus edebug buffer")) ));; inner let @@ -3773,7 +3762,9 @@ (interactive) (describe-function 'edebug-mode)) -(defun edebug-mode () +(defvar edebug--mode-saved-vars nil) + +(define-minor-mode edebug-mode "Mode for Emacs Lisp buffers while in Edebug. In addition to all Emacs Lisp commands (except those that modify the @@ -3807,20 +3798,32 @@ `edebug-on-signal' `edebug-unwrap-results' `edebug-global-break-condition'" + :lighter " *Debugging*" + :keymap edebug-mode-map ;; If the user kills the buffer in which edebug is currently active, ;; exit to top level, because the edebug command loop can't usefully ;; continue running in such a case. ;; - ;; Append `edebug-kill-buffer' to the hook to avoid interfering with - ;; other entries that are ungarded against deleted buffer. - (add-hook 'kill-buffer-hook 'edebug-kill-buffer t t) - (use-local-map edebug-mode-map)) + (if (not edebug-mode) + (progn + (while edebug--mode-saved-vars + (let ((setting (pop edebug--mode-saved-vars))) + (if (consp setting) + (set (car setting) (cdr setting)) + (kill-local-variable setting)))) + (remove-hook 'kill-buffer-hook 'edebug-kill-buffer t)) + (pcase-dolist (`(,var . ,val) '((buffer-read-only . t))) + (push + (if (local-variable-p var) var (cons var (symbol-value var))) + edebug--mode-saved-vars) + (set (make-local-variable var) val)) + ;; Append `edebug-kill-buffer' to the hook to avoid interfering with + ;; other entries that are ungarded against deleted buffer. + (add-hook 'kill-buffer-hook 'edebug-kill-buffer t t))) (defun edebug-kill-buffer () "Used on `kill-buffer-hook' when Edebug is operating in a buffer of Lisp code." - (let (kill-buffer-hook) - (kill-buffer (current-buffer))) - (top-level)) + (run-with-timer 0 nil #'top-level)) ;;; edebug eval list mode @@ -4143,7 +4146,7 @@ It is removed when you hit any char." ;; This seems not to work with Emacs 18.59. It undoes too far. (interactive) - (let ((buffer-read-only nil)) + (let ((inhibit-read-only t)) (undo-boundary) (edebug-display-freq-count) (setq unread-command-events ------------------------------------------------------------ revno: 112172 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-03-28 12:21:38 -0400 message: * src/lisp.h (save_type, XSAVE_POINTER, set_save_pointer, XSAVE_INTEGER) (set_save_integer, XSAVE_OBJECT, XSAVE_VALUE): Move to avoid forward references. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-28 14:04:49 +0000 +++ src/ChangeLog 2013-03-28 16:21:38 +0000 @@ -1,3 +1,9 @@ +2013-03-28 Stefan Monnier + + * lisp.h (save_type, XSAVE_POINTER, set_save_pointer, XSAVE_INTEGER) + (set_save_integer, XSAVE_OBJECT, XSAVE_VALUE): Move to avoid + forward references. + 2013-03-28 Dmitry Antipov * window.h (struct window): Replace hchild, vchild and buffer slots === modified file 'src/lisp.h' --- src/lisp.h 2013-03-24 12:59:45 +0000 +++ src/lisp.h 2013-03-28 16:21:38 +0000 @@ -552,11 +552,6 @@ } -/* Forward declarations. */ - -LISP_INLINE bool SAVE_VALUEP (Lisp_Object); -LISP_INLINE struct Lisp_Save_Value *XSAVE_VALUE (Lisp_Object); - /* Extract a value or address from a Lisp_Object. */ #define XCONS(a) (eassert (CONSP (a)), \ @@ -1487,53 +1482,6 @@ } data[SAVE_VALUE_SLOTS]; }; -/* Return the type of V's Nth saved value. */ -LISP_INLINE int -save_type (struct Lisp_Save_Value *v, int n) -{ - eassert (0 <= n && n < SAVE_VALUE_SLOTS); - return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1)); -} - -/* Get and set the Nth saved pointer. */ - -LISP_INLINE void * -XSAVE_POINTER (Lisp_Object obj, int n) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); - return XSAVE_VALUE (obj)->data[n].pointer;; -} -LISP_INLINE void -set_save_pointer (Lisp_Object obj, int n, void *val) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); - XSAVE_VALUE (obj)->data[n].pointer = val; -} - -/* Likewise for the saved integer. */ - -LISP_INLINE ptrdiff_t -XSAVE_INTEGER (Lisp_Object obj, int n) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); - return XSAVE_VALUE (obj)->data[n].integer; -} -LISP_INLINE void -set_save_integer (Lisp_Object obj, int n, ptrdiff_t val) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); - XSAVE_VALUE (obj)->data[n].integer = val; -} - -/* Extract Nth saved object. */ - -LISP_INLINE Lisp_Object -XSAVE_OBJECT (Lisp_Object obj, int n) -{ - eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT); - return XSAVE_VALUE (obj)->data[n].object; -} - /* A miscellaneous object, when it's on the free list. */ struct Lisp_Free { @@ -1555,13 +1503,6 @@ struct Lisp_Save_Value u_save_value; }; -LISP_INLINE struct Lisp_Save_Value * -XSAVE_VALUE (Lisp_Object a) -{ - eassert (SAVE_VALUEP (a)); - return & XMISC (a)->u_save_value; -} - /* Forwarding pointer to an int variable. This is allowed only in the value cell of a symbol, and it means that the symbol's value really lives in the @@ -1854,6 +1795,60 @@ return MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value; } +LISP_INLINE struct Lisp_Save_Value * +XSAVE_VALUE (Lisp_Object a) +{ + eassert (SAVE_VALUEP (a)); + return & XMISC (a)->u_save_value; +} + +/* Return the type of V's Nth saved value. */ +LISP_INLINE int +save_type (struct Lisp_Save_Value *v, int n) +{ + eassert (0 <= n && n < SAVE_VALUE_SLOTS); + return (v->save_type >> (SAVE_SLOT_BITS * n) & ((1 << SAVE_SLOT_BITS) - 1)); +} + +/* Get and set the Nth saved pointer. */ + +LISP_INLINE void * +XSAVE_POINTER (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); + return XSAVE_VALUE (obj)->data[n].pointer;; +} +LISP_INLINE void +set_save_pointer (Lisp_Object obj, int n, void *val) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_POINTER); + XSAVE_VALUE (obj)->data[n].pointer = val; +} + +/* Likewise for the saved integer. */ + +LISP_INLINE ptrdiff_t +XSAVE_INTEGER (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); + return XSAVE_VALUE (obj)->data[n].integer; +} +LISP_INLINE void +set_save_integer (Lisp_Object obj, int n, ptrdiff_t val) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_INTEGER); + XSAVE_VALUE (obj)->data[n].integer = val; +} + +/* Extract Nth saved object. */ + +LISP_INLINE Lisp_Object +XSAVE_OBJECT (Lisp_Object obj, int n) +{ + eassert (save_type (XSAVE_VALUE (obj), n) == SAVE_OBJECT); + return XSAVE_VALUE (obj)->data[n].object; +} + #define AUTOLOADP(x) (CONSP (x) && EQ (Qautoload, XCAR (x))) #define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int) ------------------------------------------------------------ revno: 112171 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2013-03-28 18:04:49 +0400 message: * window.h (struct window): Replace hchild, vchild and buffer slots with the only contents slot. This is possible because each valid window may have either the child window (in vertical or horizontal combination) or buffer to display (for the leaf window). Using that, a lof of operations to traverse and/or change window hierarchies may be simplified. New member horizontal is used to distinguish between horizontal and vertical combinations of internal windows. (WINDOW_LEAF_P, WINDOW_HORIZONTAL_COMBINATION_P) (WINDOW_VERTICAL_COMBINATION_P): New macros. (WINDOW_VALID_P, WINDOW_LIVE_P): Adjust to match struct window changes. * window.c (wset_hchild, wset_vchild): Remove. Adjust all users. Use contents slot, not buffer, where appropriate. (wset_combination): New function. (wset_buffer): Add eassert. (Fframe_first_window): Simplify the loop reaching first window. (Fwindow_buffer): Use WINDOW_LEAF_P. (Fwindow_top_child): Use WINDOW_VERTICAL_COMBINATION_P. (Fwindow_left_child): Use WINDOW_HORIZONTAL_COMBINATION_P. (unshow_buffer): Convert initial debugging check to eassert. (replace_window, recombine_windows, Fdelete_other_windows_internal) (make_parent_window, window_resize_check, window_resize_apply) (resize_frame_windows, Fsplit_window_internal, Fdelete_window_internal) (Fset_window_configuration, delete_all_child_windows, save_window_save): Adjust to match struct window changes. (window_loop): Check for broken markers in CHECK_ALL_WINDOWS. (mark_window_cursors_off, count_windows, get_leaf_windows) (foreach_window_1): Simplify the loop. * alloc.c (mark_object): Do not check for the leaf window because internal windows has no glyph matrices anyway. * dispnew.c (clear_window_matrices, showing_window_margins_p) (allocate_matrices_for_window_redisplay, fake_current_matrices) (allocate_matrices_for_frame_redisplay, free_window_matrices) (build_frame_matrix_from_window_tree, mirror_make_current) (frame_row_to_window, mirror_line_dance, check_window_matrix_pointers) (update_window_tree, set_window_update_flags): Simplify the loop. (sync_window_with_frame_matrix_rows): Enforce live window. Use contents slot, not buffer, where appropriate. * frame.c (set_menu_bar_lines_1): Use WINDOW_VERTICAL_COMBINATION_P and WINDOW_HORIZONTAL_COMBINATION_P. (make_frame_visible_1): Simplify the loop. Use contents slot, not buffer, where appropriate. * xdisp.c (hscroll_window_tree, mark_window_display_accurate) (redisplay_windows, redisplay_mode_lines, update_cursor_in_window_tree) (expose_window_tree): Likewise. Use contents slot, not buffer, where appropriate. * textprop.c (get_char_property_and_overlay): Add CHECK_LIVE_WINDOW to avoid deleted windows. Use contents slot instead of buffer. * buffer.c, dispextern.h, editfns.c, fileio.c, font.c, fringe.c: * indent.c, insdel.c, keyboard.c, keymap.c, minibuf.c, msdos.c: * nsfns.m, nsmenu.m, nsterm.m, print.c, w32fns.c, w32menu.c, xfaces.c: * xfns.c, xmenu.c: Use contents slot, not buffer, where appropriate. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-28 13:45:27 +0000 +++ src/ChangeLog 2013-03-28 14:04:49 +0000 @@ -1,3 +1,57 @@ +2013-03-28 Dmitry Antipov + + * window.h (struct window): Replace hchild, vchild and buffer slots + with the only contents slot. This is possible because each valid + window may have either the child window (in vertical or horizontal + combination) or buffer to display (for the leaf window). Using that, + a lof of operations to traverse and/or change window hierarchies may + be simplified. New member horizontal is used to distinguish between + horizontal and vertical combinations of internal windows. + (WINDOW_LEAF_P, WINDOW_HORIZONTAL_COMBINATION_P) + (WINDOW_VERTICAL_COMBINATION_P): New macros. + (WINDOW_VALID_P, WINDOW_LIVE_P): Adjust to match struct window changes. + * window.c (wset_hchild, wset_vchild): Remove. Adjust all users. + Use contents slot, not buffer, where appropriate. + (wset_combination): New function. + (wset_buffer): Add eassert. + (Fframe_first_window): Simplify the loop reaching first window. + (Fwindow_buffer): Use WINDOW_LEAF_P. + (Fwindow_top_child): Use WINDOW_VERTICAL_COMBINATION_P. + (Fwindow_left_child): Use WINDOW_HORIZONTAL_COMBINATION_P. + (unshow_buffer): Convert initial debugging check to eassert. + (replace_window, recombine_windows, Fdelete_other_windows_internal) + (make_parent_window, window_resize_check, window_resize_apply) + (resize_frame_windows, Fsplit_window_internal, Fdelete_window_internal) + (Fset_window_configuration, delete_all_child_windows, save_window_save): + Adjust to match struct window changes. + (window_loop): Check for broken markers in CHECK_ALL_WINDOWS. + (mark_window_cursors_off, count_windows, get_leaf_windows) + (foreach_window_1): Simplify the loop. + * alloc.c (mark_object): Do not check for the leaf window because + internal windows has no glyph matrices anyway. + * dispnew.c (clear_window_matrices, showing_window_margins_p) + (allocate_matrices_for_window_redisplay, fake_current_matrices) + (allocate_matrices_for_frame_redisplay, free_window_matrices) + (build_frame_matrix_from_window_tree, mirror_make_current) + (frame_row_to_window, mirror_line_dance, check_window_matrix_pointers) + (update_window_tree, set_window_update_flags): Simplify the loop. + (sync_window_with_frame_matrix_rows): Enforce live window. + Use contents slot, not buffer, where appropriate. + * frame.c (set_menu_bar_lines_1): Use WINDOW_VERTICAL_COMBINATION_P + and WINDOW_HORIZONTAL_COMBINATION_P. + (make_frame_visible_1): Simplify the loop. + Use contents slot, not buffer, where appropriate. + * xdisp.c (hscroll_window_tree, mark_window_display_accurate) + (redisplay_windows, redisplay_mode_lines, update_cursor_in_window_tree) + (expose_window_tree): Likewise. + Use contents slot, not buffer, where appropriate. + * textprop.c (get_char_property_and_overlay): Add CHECK_LIVE_WINDOW + to avoid deleted windows. Use contents slot instead of buffer. + * buffer.c, dispextern.h, editfns.c, fileio.c, font.c, fringe.c: + * indent.c, insdel.c, keyboard.c, keymap.c, minibuf.c, msdos.c: + * nsfns.m, nsmenu.m, nsterm.m, print.c, w32fns.c, w32menu.c, xfaces.c: + * xfns.c, xmenu.c: Use contents slot, not buffer, where appropriate. + 2013-03-28 Eli Zaretskii * w32fns.c (w32_wnd_proc) [ENABLE_CHECKING]: Add code to help === modified file 'src/alloc.c' --- src/alloc.c 2013-03-24 12:59:45 +0000 +++ src/alloc.c 2013-03-28 14:04:49 +0000 @@ -5810,14 +5810,13 @@ case PVEC_WINDOW: { struct window *w = (struct window *) ptr; - bool leaf = NILP (w->hchild) && NILP (w->vchild); mark_vectorlike (ptr); - /* Mark glyphs for leaf windows. Marking window + /* Mark glyph matrices, if any. Marking window matrices is sufficient because frame matrices use the same glyph memory. */ - if (leaf && w->current_matrix) + if (w->current_matrix) { mark_glyph_matrix (w->current_matrix); mark_glyph_matrix (w->desired_matrix); === modified file 'src/buffer.c' --- src/buffer.c 2013-03-28 09:25:25 +0000 +++ src/buffer.c 2013-03-28 14:04:49 +0000 @@ -1769,7 +1769,7 @@ since anything can happen within do_yes_or_no_p. */ /* Don't kill the minibuffer now current. */ - if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) + if (EQ (buffer, XWINDOW (minibuf_window)->contents)) return Qnil; /* When we kill an ordinary buffer which shares it's buffer text @@ -1820,7 +1820,7 @@ /* If the buffer now current is shown in the minibuffer and our buffer is the sole other buffer give up. */ XSETBUFFER (tem, current_buffer); - if (EQ (tem, XWINDOW (minibuf_window)->buffer) + if (EQ (tem, XWINDOW (minibuf_window)->contents) && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) return Qnil; @@ -2406,19 +2406,19 @@ { ws = Fcons (w, ws); if (MARKERP (XWINDOW (w)->pointm) - && (EQ (XWINDOW (w)->buffer, buf1) - || EQ (XWINDOW (w)->buffer, buf2))) + && (EQ (XWINDOW (w)->contents, buf1) + || EQ (XWINDOW (w)->contents, buf2))) Fset_marker (XWINDOW (w)->pointm, make_number - (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), - XWINDOW (w)->buffer); + (BUF_BEGV (XBUFFER (XWINDOW (w)->contents))), + XWINDOW (w)->contents); if (MARKERP (XWINDOW (w)->start) - && (EQ (XWINDOW (w)->buffer, buf1) - || EQ (XWINDOW (w)->buffer, buf2))) + && (EQ (XWINDOW (w)->contents, buf1) + || EQ (XWINDOW (w)->contents, buf2))) Fset_marker (XWINDOW (w)->start, make_number - (XBUFFER (XWINDOW (w)->buffer)->last_window_start), - XWINDOW (w)->buffer); + (XBUFFER (XWINDOW (w)->contents)->last_window_start), + XWINDOW (w)->contents); w = Fnext_window (w, Qt, Qt); } } @@ -3901,7 +3901,7 @@ if (buffer_window_count (buf) > 0) { /* ... it's visible in other window than selected, */ - if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) + if (buf != XBUFFER (XWINDOW (selected_window)->contents)) windows_or_buffers_changed = 1; /* ... or if we modify an overlay at the end of the buffer and so we cannot be sure that window end is still valid. */ === modified file 'src/dispextern.h' --- src/dispextern.h 2013-03-19 04:41:53 +0000 +++ src/dispextern.h 2013-03-28 14:04:49 +0000 @@ -1412,25 +1412,24 @@ /* Value is non-zero if window W wants a mode line. */ -#define WINDOW_WANTS_MODELINE_P(W) \ - (!MINI_WINDOW_P ((W)) \ - && !(W)->pseudo_window_p \ - && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ - && BUFFERP (W->buffer) \ - && !NILP (BVAR (XBUFFER (W->buffer), mode_line_format)) \ - && WINDOW_TOTAL_LINES (W) > 1) +#define WINDOW_WANTS_MODELINE_P(W) \ + (!MINI_WINDOW_P ((W)) \ + && !(W)->pseudo_window_p \ + && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ + && BUFFERP (W->contents) \ + && !NILP (BVAR (XBUFFER (W->contents), mode_line_format)) \ + && WINDOW_TOTAL_LINES (W) > 1) /* Value is true if window W wants a header line. */ -#define WINDOW_WANTS_HEADER_LINE_P(W) \ - (!MINI_WINDOW_P ((W)) \ - && !(W)->pseudo_window_p \ - && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ - && BUFFERP (W->buffer) \ - && !NILP (BVAR (XBUFFER (W->buffer), header_line_format)) \ - && WINDOW_TOTAL_LINES (W) > 1 \ - + !NILP (BVAR (XBUFFER (W->buffer), mode_line_format))) - +#define WINDOW_WANTS_HEADER_LINE_P(W) \ + (!MINI_WINDOW_P ((W)) \ + && !(W)->pseudo_window_p \ + && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ + && BUFFERP (W->contents) \ + && !NILP (BVAR (XBUFFER (W->contents), header_line_format)) \ + && WINDOW_TOTAL_LINES (W) > 1 \ + + !NILP (BVAR (XBUFFER (W->contents), mode_line_format))) /* Return proper value to be used as baseline offset of font that has ASCENT and DESCENT to draw characters by the font at the vertical === modified file 'src/dispnew.c' --- src/dispnew.c 2013-03-24 12:59:45 +0000 +++ src/dispnew.c 2013-03-28 14:04:49 +0000 @@ -223,9 +223,9 @@ "%"pMu": window %p (`%s')%s\n%s", history_tick++, w, - ((BUFFERP (w->buffer) - && STRINGP (BVAR (XBUFFER (w->buffer), name))) - ? SSDATA (BVAR (XBUFFER (w->buffer), name)) + ((BUFFERP (w->contents) + && STRINGP (BVAR (XBUFFER (w->contents), name))) + ? SSDATA (BVAR (XBUFFER (w->contents), name)) : "???"), paused_p ? " ***paused***" : "", msg); @@ -842,16 +842,8 @@ { while (w) { - if (!NILP (w->hchild)) - { - eassert (WINDOWP (w->hchild)); - clear_window_matrices (XWINDOW (w->hchild), desired_p); - } - else if (!NILP (w->vchild)) - { - eassert (WINDOWP (w->vchild)); - clear_window_matrices (XWINDOW (w->vchild), desired_p); - } + if (WINDOWP (w->contents)) + clear_window_matrices (XWINDOW (w->contents), desired_p); else { if (desired_p) @@ -1472,7 +1464,7 @@ struct glyph_row *row = matrix->rows; struct glyph_row *last_text_row = NULL; struct buffer *saved = current_buffer; - struct buffer *buffer = XBUFFER (w->buffer); + struct buffer *buffer = XBUFFER (w->contents); int c; /* This can sometimes happen for a fresh window. */ @@ -1636,7 +1628,7 @@ vertically below other windows. */ in_horz_combination_p = (!NILP (XWINDOW (window)->parent) - && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild)); + && WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (XWINDOW (window)->parent))); /* For WINDOW and all windows on the same level. */ do @@ -1645,12 +1637,8 @@ /* Get the dimension of the window sub-matrix for W, depending on whether this is a combination or a leaf window. */ - if (!NILP (w->hchild)) - dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y, - dim_only_p, - window_change_flags); - else if (!NILP (w->vchild)) - dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y, + if (WINDOWP (w->contents)) + dim = allocate_matrices_for_frame_redisplay (w->contents, x, y, dim_only_p, window_change_flags); else @@ -1792,10 +1780,8 @@ { while (w) { - if (!NILP (w->vchild)) - allocate_matrices_for_window_redisplay (XWINDOW (w->vchild)); - else if (!NILP (w->hchild)) - allocate_matrices_for_window_redisplay (XWINDOW (w->hchild)); + if (WINDOWP (w->contents)) + allocate_matrices_for_window_redisplay (XWINDOW (w->contents)); else { /* W is a leaf window. */ @@ -1867,18 +1853,12 @@ { while (w) { - if (!NILP (w->hchild)) - { - if (showing_window_margins_p (XWINDOW (w->hchild))) - return 1; - } - else if (!NILP (w->vchild)) - { - if (showing_window_margins_p (XWINDOW (w->vchild))) - return 1; - } - else if (!NILP (w->left_margin_cols) - || !NILP (w->right_margin_cols)) + if (WINDOWP (w->contents)) + { + if (showing_window_margins_p (XWINDOW (w->contents))) + return 1; + } + else if (!NILP (w->left_margin_cols) || !NILP (w->right_margin_cols)) return 1; w = NILP (w->next) ? 0 : XWINDOW (w->next); @@ -1899,10 +1879,8 @@ { w = XWINDOW (window); - if (!NILP (w->hchild)) - fake_current_matrices (w->hchild); - else if (!NILP (w->vchild)) - fake_current_matrices (w->vchild); + if (WINDOWP (w->contents)) + fake_current_matrices (w->contents); else { int i; @@ -2242,10 +2220,8 @@ { while (w) { - if (!NILP (w->hchild)) - free_window_matrices (XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - free_window_matrices (XWINDOW (w->vchild)); + if (WINDOWP (w->contents)) + free_window_matrices (XWINDOW (w->contents)); else { /* This is a leaf window. Free its memory and reset fields @@ -2378,10 +2354,8 @@ { while (w) { - if (!NILP (w->hchild)) - build_frame_matrix_from_window_tree (matrix, XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - build_frame_matrix_from_window_tree (matrix, XWINDOW (w->vchild)); + if (WINDOWP (w->contents)) + build_frame_matrix_from_window_tree (matrix, XWINDOW (w->contents)); else build_frame_matrix_from_leaf_window (matrix, w); @@ -2645,10 +2619,8 @@ { while (w) { - if (!NILP (w->hchild)) - mirror_make_current (XWINDOW (w->hchild), frame_row); - else if (!NILP (w->vchild)) - mirror_make_current (XWINDOW (w->vchild), frame_row); + if (WINDOWP (w->contents)) + mirror_make_current (XWINDOW (w->contents), frame_row); else { /* Row relative to window W. Don't use FRAME_TO_WINDOW_VPOS @@ -2744,8 +2716,8 @@ struct glyph_row *window_row, *window_row_end, *frame_row; int left, right, x, width; - /* Preconditions: W must be a leaf window on a tty frame. */ - eassert (NILP (w->hchild) && NILP (w->vchild)); + /* Preconditions: W must be a live window on a tty frame. */ + eassert (BUFFERP (w->contents)); eassert (!FRAME_WINDOW_P (f)); left = margin_glyphs_to_reserve (w, 1, w->left_margin_cols); @@ -2781,10 +2753,8 @@ while (w && !found) { - if (!NILP (w->hchild)) - found = frame_row_to_window (XWINDOW (w->hchild), row); - else if (!NILP (w->vchild)) - found = frame_row_to_window (XWINDOW (w->vchild), row); + if (WINDOWP (w->contents)) + found = frame_row_to_window (XWINDOW (w->contents), row); else if (row >= WINDOW_TOP_EDGE_LINE (w) && row < WINDOW_BOTTOM_EDGE_LINE (w)) found = w; @@ -2812,11 +2782,8 @@ { while (w) { - if (!NILP (w->hchild)) - mirror_line_dance (XWINDOW (w->hchild), unchanged_at_top, - nlines, copy_from, retained_p); - else if (!NILP (w->vchild)) - mirror_line_dance (XWINDOW (w->vchild), unchanged_at_top, + if (WINDOWP (w->contents)) + mirror_line_dance (XWINDOW (w->contents), unchanged_at_top, nlines, copy_from, retained_p); else { @@ -2925,10 +2892,8 @@ { while (w) { - if (!NILP (w->hchild)) - check_window_matrix_pointers (XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - check_window_matrix_pointers (XWINDOW (w->vchild)); + if (WINDOWP (w->contents)) + check_window_matrix_pointers (XWINDOW (w->contents)); else { struct frame *f = XFRAME (w->frame); @@ -3194,10 +3159,8 @@ while (w && !paused_p) { - if (!NILP (w->hchild)) - paused_p |= update_window_tree (XWINDOW (w->hchild), force_p); - else if (!NILP (w->vchild)) - paused_p |= update_window_tree (XWINDOW (w->vchild), force_p); + if (WINDOWP (w->contents)) + paused_p |= update_window_tree (XWINDOW (w->contents), force_p); else if (w->must_be_updated_p) paused_p |= update_window (w, force_p); @@ -3975,10 +3938,8 @@ { while (w) { - if (!NILP (w->hchild)) - set_window_update_flags (XWINDOW (w->hchild), on_p); - else if (!NILP (w->vchild)) - set_window_update_flags (XWINDOW (w->vchild), on_p); + if (WINDOWP (w->contents)) + set_window_update_flags (XWINDOW (w->contents), on_p); else w->must_be_updated_p = on_p; @@ -5125,7 +5086,7 @@ /* We used to set current_buffer directly here, but that does the wrong thing with `face-remapping-alist' (bug#2044). */ - Fset_buffer (w->buffer); + Fset_buffer (w->contents); itdata = bidi_shelve_cache (); SET_TEXT_POS_FROM_MARKER (startp, w->start); CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); @@ -5171,7 +5132,7 @@ *dx = x0 + it.first_visible_x - it.current_x; *dy = *y - it.current_y; - string = w->buffer; + string = w->contents; if (STRINGP (it.string)) string = it.string; *pos = it.current; @@ -5189,7 +5150,7 @@ if (STRINGP (it.string)) BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos)); else - BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (w->buffer), + BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (w->contents), CHARPOS (pos->pos)); } === modified file 'src/editfns.c' --- src/editfns.c 2013-03-28 02:41:05 +0000 +++ src/editfns.c 2013-03-28 14:04:49 +0000 @@ -373,7 +373,7 @@ if (NILP (object)) XSETBUFFER (object, current_buffer); else if (WINDOWP (object)) - object = XWINDOW (object)->buffer; + object = XWINDOW (object)->contents; if (!BUFFERP (object)) /* pos-property only makes sense in buffers right now, since strings @@ -846,7 +846,7 @@ ? Fcopy_marker (BVAR (current_buffer, mark), Qnil) : Qnil), /* Selected window if current buffer is shown in it, nil otherwise. */ - (EQ (XWINDOW (selected_window)->buffer, Fcurrent_buffer ()) + (EQ (XWINDOW (selected_window)->contents, Fcurrent_buffer ()) ? selected_window : Qnil), BVAR (current_buffer, mark_active)); } @@ -915,7 +915,7 @@ tem = XSAVE_OBJECT (info, 2); if (WINDOWP (tem) && !EQ (tem, selected_window) - && (tem1 = XWINDOW (tem)->buffer, + && (tem1 = XWINDOW (tem)->contents, (/* Window is live... */ BUFFERP (tem1) /* ...and it shows the current buffer. */ === modified file 'src/fileio.c' --- src/fileio.c 2013-03-24 12:59:45 +0000 +++ src/fileio.c 2013-03-28 14:04:49 +0000 @@ -3958,7 +3958,7 @@ /* If display currently starts at beginning of line, keep it that way. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) + if (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer) XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); replace_handled = 1; @@ -4108,7 +4108,7 @@ /* If display currently starts at beginning of line, keep it that way. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) + if (XBUFFER (XWINDOW (selected_window)->contents) == current_buffer) XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); /* Replace the chars that we need to replace, === modified file 'src/font.c' --- src/font.c 2013-03-24 12:59:45 +0000 +++ src/font.c 2013-03-28 14:04:49 +0000 @@ -4761,7 +4761,7 @@ if (NILP (string)) { - if (XBUFFER (w->buffer) != current_buffer) + if (XBUFFER (w->contents) != current_buffer) error ("Specified window is not displaying the current buffer."); CHECK_NUMBER_COERCE_MARKER (position); if (! (BEGV <= XINT (position) && XINT (position) < ZV)) === modified file 'src/frame.c' --- src/frame.c 2013-03-24 12:59:45 +0000 +++ src/frame.c 2013-03-28 14:04:49 +0000 @@ -159,15 +159,15 @@ w->total_lines -= n; /* Handle just the top child in a vertical split. */ - if (!NILP (w->vchild)) - set_menu_bar_lines_1 (w->vchild, n); - - /* Adjust all children in a horizontal split. */ - for (window = w->hchild; !NILP (window); window = w->next) - { - w = XWINDOW (window); - set_menu_bar_lines_1 (window, n); - } + if (WINDOW_VERTICAL_COMBINATION_P (w)) + set_menu_bar_lines_1 (w->contents, n); + else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) + /* Adjust all children in a horizontal split. */ + for (window = w->contents; !NILP (window); window = w->next) + { + w = XWINDOW (window); + set_menu_bar_lines_1 (window, n); + } } void @@ -421,7 +421,7 @@ /* Make the chosen minibuffer window display the proper minibuffer, unless it is already showing a minibuffer. */ - if (NILP (Fmemq (XWINDOW (mini_window)->buffer, Vminibuffer_list))) + if (NILP (Fmemq (XWINDOW (mini_window)->contents, Vminibuffer_list))) /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ set_window_buffer (mini_window, @@ -1189,7 +1189,7 @@ /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ set_window_buffer (sf->minibuffer_window, - XWINDOW (minibuf_window)->buffer, 0, 0); + XWINDOW (minibuf_window)->contents, 0, 0); minibuf_window = sf->minibuffer_window; /* If the dying minibuffer window was selected, @@ -1593,17 +1593,13 @@ { struct window *w; - for (;!NILP (window); window = w->next) + for (; !NILP (window); window = w->next) { w = XWINDOW (window); - - if (!NILP (w->buffer)) - bset_display_time (XBUFFER (w->buffer), Fcurrent_time ()); - - if (!NILP (w->vchild)) - make_frame_visible_1 (w->vchild); - if (!NILP (w->hchild)) - make_frame_visible_1 (w->hchild); + if (WINDOWP (w->contents)) + make_frame_visible_1 (w->contents); + else + bset_display_time (XBUFFER (w->contents), Fcurrent_time ()); } } @@ -1634,7 +1630,7 @@ /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ set_window_buffer (sf->minibuffer_window, - XWINDOW (minibuf_window)->buffer, 0, 0); + XWINDOW (minibuf_window)->contents, 0, 0); minibuf_window = sf->minibuffer_window; } @@ -1665,7 +1661,7 @@ /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ set_window_buffer (sf->minibuffer_window, - XWINDOW (minibuf_window)->buffer, 0, 0); + XWINDOW (minibuf_window)->contents, 0, 0); minibuf_window = sf->minibuffer_window; } === modified file 'src/fringe.c' --- src/fringe.c 2013-01-02 16:13:04 +0000 +++ src/fringe.c 2013-03-28 14:04:49 +0000 @@ -699,7 +699,7 @@ { Lisp_Object cmap, bm = Qnil; - if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap)) + if ((cmap = BVAR (XBUFFER (w->contents), fringe_cursor_alist)), !NILP (cmap)) { bm = Fassq (cursor, cmap); if (CONSP (bm)) @@ -736,7 +736,7 @@ If partial, lookup partial bitmap in default value if not found here. If not partial, or no partial spec is present, use non-partial bitmap. */ - if ((cmap = BVAR (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap)) + if ((cmap = BVAR (XBUFFER (w->contents), fringe_indicator_alist)), !NILP (cmap)) { bm1 = Fassq (bitmap, cmap); if (CONSP (bm1)) @@ -963,7 +963,7 @@ return 0; if (!MINI_WINDOW_P (w) - && (ind = BVAR (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind))) + && (ind = BVAR (XBUFFER (w->contents), indicate_buffer_boundaries), !NILP (ind))) { if (EQ (ind, Qleft) || EQ (ind, Qright)) boundary_top = boundary_bot = arrow_top = arrow_bot = ind; @@ -1004,7 +1004,7 @@ { if (top_ind_rn < 0 && row->visible_height > 0) { - if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)) + if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->contents)) && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) row->indicate_bob_p = !NILP (boundary_top); else @@ -1014,7 +1014,7 @@ if (bot_ind_rn < 0) { - if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)) + if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->contents)) && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn; else if (y + row->height >= yb) @@ -1024,7 +1024,7 @@ } } - empty_pos = BVAR (XBUFFER (w->buffer), indicate_empty_lines); + empty_pos = BVAR (XBUFFER (w->contents), indicate_empty_lines); if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; === modified file 'src/indent.c' --- src/indent.c 2013-03-28 13:54:21 +0000 +++ src/indent.c 2013-03-28 14:04:49 +0000 @@ -254,7 +254,7 @@ the next property change */ prop = Fget_char_property (position, Qinvisible, (!NILP (window) - && EQ (XWINDOW (window)->buffer, buffer)) + && EQ (XWINDOW (window)->contents, buffer)) ? window : buffer); inv_p = TEXT_PROP_MEANS_INVISIBLE (prop); /* When counting columns (window == nil), don't skip over ellipsis text. */ @@ -1826,7 +1826,7 @@ /* If the window contains this buffer, use it for getting text properties. Otherwise use the current buffer as arg for doing that. */ - if (EQ (w->buffer, Fcurrent_buffer ())) + if (EQ (w->contents, Fcurrent_buffer ())) text_prop_object = window; else text_prop_object = Fcurrent_buffer (); @@ -1979,14 +1979,14 @@ old_buffer = Qnil; GCPRO1 (old_buffer); - if (XBUFFER (w->buffer) != current_buffer) + if (XBUFFER (w->contents) != current_buffer) { /* Set the window's buffer temporarily to the current buffer. */ - old_buffer = w->buffer; + old_buffer = w->contents; old_charpos = marker_position (w->pointm); old_bytepos = marker_byte_position (w->pointm); wset_buffer (w, Fcurrent_buffer ()); - set_marker_both (w->pointm, w->buffer, + set_marker_both (w->pointm, w->contents, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); } @@ -2139,7 +2139,7 @@ if (BUFFERP (old_buffer)) { wset_buffer (w, old_buffer); - set_marker_both (w->pointm, w->buffer, + set_marker_both (w->pointm, w->contents, old_charpos, old_bytepos); } === modified file 'src/insdel.c' --- src/insdel.c 2013-03-15 16:03:54 +0000 +++ src/insdel.c 2013-03-28 14:04:49 +0000 @@ -1798,7 +1798,7 @@ /* If we're modifying the buffer other than shown in a selected window, let redisplay consider other windows if this buffer is visible. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer + if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer && buffer_window_count (current_buffer)) ++windows_or_buffers_changed; === modified file 'src/keyboard.c' --- src/keyboard.c 2013-03-24 12:59:45 +0000 +++ src/keyboard.c 2013-03-28 14:04:49 +0000 @@ -833,7 +833,7 @@ update_mode_lines = 1; if (command_loop_level - && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) + && current_buffer != XBUFFER (XWINDOW (selected_window)->contents)) buffer = Fcurrent_buffer (); else buffer = Qnil; @@ -1395,7 +1395,7 @@ Fkill_emacs (Qnil); /* Make sure the current window's buffer is selected. */ - set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); + set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents)); /* Display any malloc warning that just came out. Use while because displaying one warning can cause another. */ @@ -1461,7 +1461,7 @@ /* A filter may have run while we were reading the input. */ if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); - set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); + set_buffer_internal (XBUFFER (XWINDOW (selected_window)->contents)); ++num_input_keys; @@ -1492,7 +1492,7 @@ { struct buffer *b; XWINDOW (selected_window)->force_start = 0; - b = XBUFFER (XWINDOW (selected_window)->buffer); + b = XBUFFER (XWINDOW (selected_window)->contents); BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; } @@ -5142,7 +5142,7 @@ if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); textpos = (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) + && current_buffer == XBUFFER (w->contents)) ? PT : marker_position (w->pointm); xret = wx; @@ -9145,9 +9145,9 @@ { if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); - if (XBUFFER (XWINDOW (selected_window)->buffer) + if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer) - Fset_buffer (XWINDOW (selected_window)->buffer); + Fset_buffer (XWINDOW (selected_window)->contents); } goto replay_sequence; @@ -9195,9 +9195,9 @@ special-event-map, ...) might have switched the current buffer or the selected window from under us in the mean time. */ if (fix_current_buffer - && (XBUFFER (XWINDOW (selected_window)->buffer) + && (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer)) - Fset_buffer (XWINDOW (selected_window)->buffer); + Fset_buffer (XWINDOW (selected_window)->contents); current_binding = active_maps (first_event); } @@ -9246,8 +9246,8 @@ not the current buffer. If we're at the beginning of a key sequence, switch buffers. */ if (WINDOWP (window) - && BUFFERP (XWINDOW (window)->buffer) - && XBUFFER (XWINDOW (window)->buffer) != current_buffer) + && BUFFERP (XWINDOW (window)->contents) + && XBUFFER (XWINDOW (window)->contents) != current_buffer) { ASET (raw_keybuf, raw_keybuf_count, key); raw_keybuf_count++; @@ -9268,7 +9268,7 @@ if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); - set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); + set_buffer_internal (XBUFFER (XWINDOW (window)->contents)); goto replay_sequence; } } === modified file 'src/keymap.c' --- src/keymap.c 2013-03-24 12:59:45 +0000 +++ src/keymap.c 2013-03-28 14:04:49 +0000 @@ -1556,8 +1556,8 @@ window = POSN_WINDOW (position); if (WINDOWP (window) - && BUFFERP (XWINDOW (window)->buffer) - && XBUFFER (XWINDOW (window)->buffer) != current_buffer) + && BUFFERP (XWINDOW (window)->contents) + && XBUFFER (XWINDOW (window)->contents) != current_buffer) { /* Arrange to go back to the original buffer once we're done processing the key sequence. We don't use @@ -1567,7 +1567,7 @@ things the same. */ record_unwind_current_buffer (); - set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); + set_buffer_internal (XBUFFER (XWINDOW (window)->contents)); } } === modified file 'src/minibuf.c' --- src/minibuf.c 2013-03-24 12:59:45 +0000 +++ src/minibuf.c 2013-03-28 14:04:49 +0000 @@ -114,7 +114,7 @@ /* Under X, we come here with minibuf_window being the minibuffer window of the unused termcap window created in init_window_once. That window doesn't have a buffer. */ - buffer = XWINDOW (minibuf_window)->buffer; + buffer = XWINDOW (minibuf_window)->contents; if (BUFFERP (buffer)) /* Use set_window_buffer instead of Fset_window_buffer (see discussion of bug#11984, bug#12025, bug#12026). */ @@ -844,7 +844,7 @@ window = minibuf_window; /* To keep things predictable, in case it matters, let's be in the minibuffer when we reset the relevant variables. */ - Fset_buffer (XWINDOW (window)->buffer); + Fset_buffer (XWINDOW (window)->contents); /* Restore prompt, etc, from outer minibuffer level. */ minibuf_prompt = Fcar (minibuf_save_list); === modified file 'src/msdos.c' --- src/msdos.c 2013-03-06 16:21:26 +0000 +++ src/msdos.c 2013-03-28 14:04:49 +0000 @@ -1261,7 +1261,7 @@ /* If the mouse highlight is in the window that was deleted (e.g., if it was popped by completion), clear highlight unconditionally. */ - if (NILP (w->buffer)) + if (NILP (w->contents)) hlinfo->mouse_face_window = Qnil; else { @@ -1271,7 +1271,7 @@ break; } - if (NILP (w->buffer) || i < w->desired_matrix->nrows) + if (NILP (w->contents) || i < w->desired_matrix->nrows) clear_mouse_face (hlinfo); } } @@ -1321,7 +1321,7 @@ new_cursor = frame_desired_cursor; else { - struct buffer *b = XBUFFER (sw->buffer); + struct buffer *b = XBUFFER (sw->contents); if (EQ (BVAR (b,cursor_type), Qt)) new_cursor = frame_desired_cursor; === modified file 'src/nsfns.m' --- src/nsfns.m 2013-03-20 09:56:19 +0000 +++ src/nsfns.m 2013-03-28 14:04:49 +0000 @@ -619,7 +619,7 @@ { NSView *view; Lisp_Object name, filename; - Lisp_Object buf = XWINDOW (f->selected_window)->buffer; + Lisp_Object buf = XWINDOW (f->selected_window)->contents; const char *title; NSAutoreleasePool *pool; struct gcpro gcpro1; === modified file 'src/nsmenu.m' --- src/nsmenu.m 2013-02-05 12:16:35 +0000 +++ src/nsmenu.m 2013-03-28 14:04:49 +0000 @@ -191,7 +191,7 @@ = alloca (previous_menu_items_used * sizeof *previous_items); /* lisp preliminaries */ - buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; + buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents; specbind (Qinhibit_quit, Qt); specbind (Qdebug_on_next_call, Qnil); record_unwind_save_match_data (); === modified file 'src/nsterm.m' --- src/nsterm.m 2013-03-16 14:22:37 +0000 +++ src/nsterm.m 2013-03-28 14:04:49 +0000 @@ -6532,7 +6532,7 @@ { Lisp_Object str = Qnil; struct frame *f = SELECTED_FRAME (); - struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer); + struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->contents); if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) return NSAccessibilityTextFieldRole; === modified file 'src/print.c' --- src/print.c 2013-03-24 12:59:45 +0000 +++ src/print.c 2013-03-28 14:04:49 +0000 @@ -1769,10 +1769,10 @@ strout ("#buffer)) + if (BUFFERP (XWINDOW (obj)->contents)) { strout (" on ", -1, -1, printcharfun); - print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), + print_string (BVAR (XBUFFER (XWINDOW (obj)->contents), name), printcharfun); } PRINTCHAR ('>'); === modified file 'src/textprop.c' --- src/textprop.c 2013-03-11 01:17:40 +0000 +++ src/textprop.c 2013-03-28 14:04:49 +0000 @@ -597,8 +597,9 @@ if (WINDOWP (object)) { + CHECK_LIVE_WINDOW (object); w = XWINDOW (object); - object = w->buffer; + object = w->contents; } if (BUFFERP (object)) { === modified file 'src/w32fns.c' --- src/w32fns.c 2013-03-28 13:45:27 +0000 +++ src/w32fns.c 2013-03-28 14:04:49 +0000 @@ -5816,7 +5816,7 @@ /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; - set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); + set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->contents)); bset_truncate_lines (current_buffer, Qnil); clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); === modified file 'src/w32menu.c' --- src/w32menu.c 2013-01-02 16:13:04 +0000 +++ src/w32menu.c 2013-03-28 14:04:49 +0000 @@ -396,7 +396,7 @@ if (! menubar_widget) previous_menu_items_used = 0; - buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; + buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents; specbind (Qinhibit_quit, Qt); /* Don't let the debugger step into this code because it is not reentrant. */ === modified file 'src/window.c' --- src/window.c 2013-03-24 12:59:45 +0000 +++ src/window.c 2013-03-28 14:04:49 +0000 @@ -147,11 +147,6 @@ w->display_table = val; } static void -wset_hchild (struct window *w, Lisp_Object val) -{ - w->hchild = val; -} -static void wset_left_fringe_width (struct window *w, Lisp_Object val) { w->left_fringe_width = val; @@ -217,11 +212,6 @@ w->temslot = val; } static void -wset_vchild (struct window *w, Lisp_Object val) -{ - w->vchild = val; -} -static void wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val) { w->vertical_scroll_bar_type = val; @@ -231,6 +221,18 @@ { w->window_parameters = val; } +static void +wset_combination (struct window *w, bool horflag, Lisp_Object val) +{ + /* Since leaf windows never becomes non-leaf, there should + be no buffer and markers in start and pointm fields of W. */ + eassert (!BUFFERP (w->contents) && NILP (w->start) && NILP (w->pointm)); + w->contents = val; + /* When an internal window is deleted and VAL is nil, HORFLAG + is meaningless. */ + if (!NILP (val)) + w->horizontal = horflag; +} struct window * decode_live_window (register Lisp_Object window) @@ -275,9 +277,9 @@ adjust_window_count (struct window *w, int arg) { eassert (eabs (arg) == 1); - if (BUFFERP (w->buffer)) + if (BUFFERP (w->contents)) { - struct buffer *b = XBUFFER (w->buffer); + struct buffer *b = XBUFFER (w->contents); if (b->base_buffer) b = b->base_buffer; @@ -296,7 +298,11 @@ wset_buffer (struct window *w, Lisp_Object val) { adjust_window_count (w, -1); - w->buffer = val; + if (BUFFERP (val)) + /* Make sure that we do not assign the buffer + to an internal window. */ + eassert (MARKERP (w->start) && MARKERP (w->pointm)); + w->contents = val; adjust_window_count (w, 1); } @@ -394,15 +400,8 @@ window = XFRAME (frame_or_window)->root_window; } - while (NILP (XWINDOW (window)->buffer)) - { - if (! NILP (XWINDOW (window)->hchild)) - window = XWINDOW (window)->hchild; - else if (! NILP (XWINDOW (window)->vchild)) - window = XWINDOW (window)->vchild; - else - emacs_abort (); - } + while (WINDOWP (XWINDOW (window)->contents)) + window = XWINDOW (window)->contents; return window; } @@ -489,11 +488,11 @@ if (NILP (norecord)) { w->use_time = ++window_select_count; - record_buffer (w->buffer); + record_buffer (w->contents); } /* Make the selected window's buffer current. */ - Fset_buffer (w->buffer); + Fset_buffer (w->contents); if (EQ (window, selected_window) && !inhibit_point_swap) return window; @@ -516,7 +515,7 @@ select_window_1 (window, inhibit_point_swap); - bset_last_selected_window (XBUFFER (w->buffer), window); + bset_last_selected_window (XBUFFER (w->contents), window); windows_or_buffers_changed++; return window; } @@ -533,10 +532,10 @@ if (!inhibit_point_swap) { struct window *ow = XWINDOW (selected_window); - if (! NILP (ow->buffer)) - set_marker_both (ow->pointm, ow->buffer, - BUF_PT (XBUFFER (ow->buffer)), - BUF_PT_BYTE (XBUFFER (ow->buffer))); + if (BUFFERP (ow->contents)) + set_marker_both (ow->pointm, ow->contents, + BUF_PT (XBUFFER (ow->contents)), + BUF_PT_BYTE (XBUFFER (ow->contents))); } selected_window = window; @@ -581,7 +580,8 @@ Return nil for an internal window or a deleted window. */) (Lisp_Object window) { - return decode_any_window (window)->buffer; + struct window *w = decode_any_window (window); + return WINDOW_LEAF_P (w) ? w->contents : Qnil; } DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, @@ -601,7 +601,8 @@ horizontal combination. */) (Lisp_Object window) { - return decode_valid_window (window)->vchild; + struct window *w = decode_valid_window (window); + return WINDOW_VERTICAL_COMBINATION_P (w) ? w->contents : Qnil; } DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, @@ -612,7 +613,8 @@ vertical combination. */) (Lisp_Object window) { - return decode_valid_window (window)->hchild; + struct window *w = decode_valid_window (window); + return WINDOW_HORIZONTAL_COMBINATION_P (w) ? w->contents : Qnil; } DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, @@ -645,9 +647,9 @@ CHECK_VALID_WINDOW (window); w = XWINDOW (window); - if (!NILP (w->buffer)) + if (WINDOW_LEAF_P (w)) error ("Combination limit is meaningful for internal windows only"); - return XWINDOW (window)->combination_limit; + return w->combination_limit; } DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, @@ -663,7 +665,7 @@ CHECK_VALID_WINDOW (window); w = XWINDOW (window); - if (!NILP (w->buffer)) + if (WINDOW_LEAF_P (w)) error ("Combination limit is meaningful for internal windows only"); wset_combination_limit (w, limit); return limit; @@ -860,7 +862,7 @@ /* Prevent redisplay shortcuts when changing the hscroll. */ if (w->hscroll != new_hscroll) - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; w->hscroll = new_hscroll; return make_number (new_hscroll); @@ -1441,7 +1443,7 @@ register struct window *w = decode_live_window (window); if (w == XWINDOW (selected_window)) - return make_number (BUF_PT (XBUFFER (w->buffer))); + return make_number (BUF_PT (XBUFFER (w->contents))); else return Fmarker_position (w->pointm); } @@ -1483,7 +1485,7 @@ Lisp_Object buf; struct buffer *b; - buf = w->buffer; + buf = w->contents; CHECK_BUFFER (buf); b = XBUFFER (buf); @@ -1546,7 +1548,7 @@ if (w == XWINDOW (selected_window)) { - if (XBUFFER (w->buffer) == current_buffer) + if (XBUFFER (w->contents) == current_buffer) Fgoto_char (pos); else { @@ -1554,14 +1556,14 @@ /* ... but here we want to catch type error before buffer change. */ CHECK_NUMBER_COERCE_MARKER (pos); - set_buffer_internal (XBUFFER (w->buffer)); + set_buffer_internal (XBUFFER (w->contents)); Fgoto_char (pos); set_buffer_internal (old_buffer); } } else { - set_marker_restricted (w->pointm, pos, w->buffer); + set_marker_restricted (w->pointm, pos, w->contents); /* We have to make sure that redisplay updates the window to show the new value of point. */ ++windows_or_buffers_changed; @@ -1579,7 +1581,7 @@ { register struct window *w = decode_live_window (window); - set_marker_restricted (w->start, pos, w->buffer); + set_marker_restricted (w->start, pos, w->contents); /* This is not right, but much easier than doing what is right. */ w->start_at_line_beg = 0; if (NILP (noforce)) @@ -1623,7 +1625,7 @@ int x, y; w = decode_live_window (window); - buf = XBUFFER (w->buffer); + buf = XBUFFER (w->contents); SET_TEXT_POS_FROM_MARKER (top, w->start); if (EQ (pos, Qt)) @@ -1692,8 +1694,8 @@ if (noninteractive || w->pseudo_window_p) return Qnil; - CHECK_BUFFER (w->buffer); - b = XBUFFER (w->buffer); + CHECK_BUFFER (w->contents); + b = XBUFFER (w->contents); /* Fail if current matrix is not up-to-date. */ if (!w->window_end_valid @@ -1919,9 +1921,9 @@ if (DISP_TABLE_P (w->display_table)) dp = XCHAR_TABLE (w->display_table); - else if (BUFFERP (w->buffer)) + else if (BUFFERP (w->contents)) { - struct buffer *b = XBUFFER (w->buffer); + struct buffer *b = XBUFFER (w->contents); if (DISP_TABLE_P (BVAR (b, display_table))) dp = XCHAR_TABLE (BVAR (b, display_table)); @@ -1946,17 +1948,14 @@ static void unshow_buffer (register struct window *w) { - Lisp_Object buf; - struct buffer *b; + Lisp_Object buf = w->contents; + struct buffer *b = XBUFFER (buf); - buf = w->buffer; - b = XBUFFER (buf); - if (b != XMARKER (w->pointm)->buffer) - emacs_abort (); + eassert (b == XMARKER (w->pointm)->buffer); #if 0 if (w == XWINDOW (selected_window) - || ! EQ (buf, XWINDOW (selected_window)->buffer)) + || ! EQ (buf, XWINDOW (selected_window)->contents)) /* Do this except when the selected window's buffer is being removed from some other window. */ #endif @@ -1972,14 +1971,14 @@ /* Point in the selected window's buffer is actually stored in that buffer, and the window's pointm isn't used. So don't clobber point in that buffer. */ - if (! EQ (buf, XWINDOW (selected_window)->buffer) + if (! EQ (buf, XWINDOW (selected_window)->contents) /* Don't clobber point in current buffer either (this could be useful in connection with bug#12208). && XBUFFER (buf) != current_buffer */ /* This line helps to fix Horsley's testbug.el bug. */ && !(WINDOWP (BVAR (b, last_selected_window)) && w != XWINDOW (BVAR (b, last_selected_window)) - && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) + && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->contents))) temp_set_point_both (b, clip_to_bounds (BUF_BEGV (b), marker_position (w->pointm), @@ -2044,13 +2043,8 @@ tem = o->parent; wset_parent (n, tem); - if (!NILP (tem)) - { - if (EQ (XWINDOW (tem)->vchild, old)) - wset_vchild (XWINDOW (tem), new); - if (EQ (XWINDOW (tem)->hchild, old)) - wset_hchild (XWINDOW (tem), new); - } + if (!NILP (tem) && EQ (XWINDOW (tem)->contents, old)) + wset_combination (XWINDOW (tem), XWINDOW (tem)->horizontal, new); } /* If window WINDOW and its parent window are iso-combined, merge @@ -2069,22 +2063,19 @@ if (!NILP (parent) && NILP (w->combination_limit)) { p = XWINDOW (parent); - if (((!NILP (p->vchild) && !NILP (w->vchild)) - || (!NILP (p->hchild) && !NILP (w->hchild)))) + if (WINDOWP (p->contents) && WINDOWP (w->contents) + && p->horizontal == w->horizontal) /* WINDOW and PARENT are both either a vertical or a horizontal combination. */ { - horflag = NILP (w->vchild); - child = horflag ? w->hchild : w->vchild; + horflag = WINDOW_HORIZONTAL_COMBINATION_P (w); + child = w->contents; c = XWINDOW (child); /* Splice WINDOW's children into its parent's children and assign new normal sizes. */ if (NILP (w->prev)) - if (horflag) - wset_hchild (p, child); - else - wset_vchild (p, child); + wset_combination (p, horflag, child); else { wset_prev (c, w->prev); @@ -2122,8 +2113,7 @@ } /* WINDOW can be deleted now. */ - wset_vchild (w, Qnil); - wset_hchild (w, Qnil); + wset_combination (w, 0, Qnil); } } } @@ -2209,7 +2199,7 @@ struct frame *f = XFRAME (w->frame); int candidate_p = 1; - if (!BUFFERP (w->buffer)) + if (!BUFFERP (w->contents)) candidate_p = 0; else if (MINI_WINDOW_P (w) && (EQ (minibuf, Qlambda) @@ -2549,7 +2539,7 @@ GET_BUFFER_WINDOW, /* Arg is buffer */ REPLACE_BUFFER_IN_WINDOWS_SAFELY, /* Arg is buffer */ REDISPLAY_BUFFER_WINDOWS, /* Arg is buffer */ - CHECK_ALL_WINDOWS + CHECK_ALL_WINDOWS /* Arg is ignored */ }; static Lisp_Object @@ -2613,7 +2603,7 @@ switch (type) { case GET_BUFFER_WINDOW: - if (EQ (w->buffer, obj) + if (EQ (w->contents, obj) /* Don't find any minibuffer window except the one that is currently in use. */ && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) @@ -2637,25 +2627,25 @@ case REPLACE_BUFFER_IN_WINDOWS_SAFELY: /* We could simply check whether the buffer shown by window is live, and show another buffer in case it isn't. */ - if (EQ (w->buffer, obj)) + if (EQ (w->contents, obj)) { /* Undedicate WINDOW. */ wset_dedicated (w, Qnil); /* Make WINDOW show the buffer returned by other_buffer_safely, don't run any hooks. */ set_window_buffer - (window, other_buffer_safely (w->buffer), 0, 0); + (window, other_buffer_safely (w->contents), 0, 0); /* If WINDOW is the selected window, make its buffer current. But do so only if the window shows the current buffer (Bug#6454). */ if (EQ (window, selected_window) - && XBUFFER (w->buffer) == current_buffer) - Fset_buffer (w->buffer); + && XBUFFER (w->contents) == current_buffer) + Fset_buffer (w->contents); } break; case REDISPLAY_BUFFER_WINDOWS: - if (EQ (w->buffer, obj)) + if (EQ (w->contents, obj)) { mark_window_display_accurate (window, 0); w->update_mode_line = 1; @@ -2665,11 +2655,20 @@ } break; - /* Check for a window that has a killed buffer. */ + /* Check for a leaf window that has a killed buffer + or broken markers. */ case CHECK_ALL_WINDOWS: - if (! NILP (w->buffer) - && !BUFFER_LIVE_P (XBUFFER (w->buffer))) - emacs_abort (); + if (BUFFERP (w->contents)) + { + struct buffer *b = XBUFFER (w->contents); + + if (!BUFFER_LIVE_P (b)) + emacs_abort (); + if (!MARKERP (w->start) || XMARKER (w->start)->buffer != b) + emacs_abort (); + if (!MARKERP (w->pointm) || XMARKER (w->pointm)->buffer != b) + emacs_abort (); + } break; case WINDOW_LOOP_UNUSED: @@ -2786,7 +2785,7 @@ else if (MINI_WINDOW_P (w)) /* && top > 0) */ error ("Can't expand minibuffer to full frame"); - if (!NILP (w->buffer)) + if (BUFFERP (w->contents)) { startpos = marker_position (w->start); startbyte = marker_byte_position (w->start); @@ -2858,7 +2857,7 @@ FRAME_WINDOW_SIZES_CHANGED (f) = 1; resize_failed = 0; - if (NILP (w->buffer)) + if (!WINDOW_LEAF_P (w)) { /* Resize child windows vertically. */ XSETINT (delta, r->total_lines - w->total_lines); @@ -2917,28 +2916,21 @@ sibling = w->next; s = XWINDOW (sibling); wset_prev (s, Qnil); - if (!NILP (XWINDOW (w->parent)->vchild)) - wset_vchild (XWINDOW (w->parent), sibling); - else - wset_hchild (XWINDOW (w->parent), sibling); + wset_combination (XWINDOW (w->parent), + XWINDOW (w->parent)->horizontal, sibling); } /* Delete ROOT and all child windows of ROOT. */ - if (!NILP (r->vchild)) - { - delete_all_child_windows (r->vchild); - wset_vchild (r, Qnil); - } - else if (!NILP (r->hchild)) - { - delete_all_child_windows (r->hchild); - wset_hchild (r, Qnil); + if (WINDOWP (r->contents)) + { + delete_all_child_windows (r->contents); + wset_combination (r, 0, Qnil); } replace_window (root, window, 1); /* This must become SWINDOW anyway ....... */ - if (!NILP (w->buffer) && !resize_failed) + if (BUFFERP (w->contents) && !resize_failed) { /* Try to minimize scrolling, by setting the window start to the point will cause the text at the old window start to be at the @@ -2947,18 +2939,18 @@ when the display is not current, due to typeahead). */ new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); if (new_top != top - && startpos >= BUF_BEGV (XBUFFER (w->buffer)) - && startpos <= BUF_ZV (XBUFFER (w->buffer))) + && startpos >= BUF_BEGV (XBUFFER (w->contents)) + && startpos <= BUF_ZV (XBUFFER (w->contents))) { struct position pos; struct buffer *obuf = current_buffer; - Fset_buffer (w->buffer); + Fset_buffer (w->contents); /* This computation used to temporarily move point, but that can have unwanted side effects due to text properties. */ pos = *vmotion (startpos, startbyte, -top, w); - set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); + set_marker_both (w->start, w->contents, pos.bufpos, pos.bytepos); w->window_end_valid = 0; w->start_at_line_beg = (pos.bytepos == BEGV_BYTE || FETCH_BYTE (pos.bytepos - 1) == '\n'); @@ -3158,7 +3150,7 @@ struct window *w = XWINDOW (window); struct buffer *b = XBUFFER (buffer); ptrdiff_t count = SPECPDL_INDEX (); - int samebuf = EQ (buffer, w->buffer); + int samebuf = EQ (buffer, w->contents); wset_buffer (w, buffer); @@ -3277,7 +3269,7 @@ if (!BUFFER_LIVE_P (XBUFFER (buffer))) error ("Attempt to display deleted buffer"); - tem = w->buffer; + tem = w->contents; if (NILP (tem)) error ("Window is deleted"); else @@ -3330,8 +3322,8 @@ struct window *w = XWINDOW (object); mark_window_display_accurate (object, 0); w->update_mode_line = 1; - if (BUFFERP (w->buffer)) - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + if (BUFFERP (w->contents)) + XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; ++update_mode_lines; return Qt; } @@ -3400,7 +3392,7 @@ record_unwind_protect (Fset_buffer, prev_buffer); record_unwind_protect (select_window_norecord, prev_window); Fselect_window (window, Qt); - Fset_buffer (w->buffer); + Fset_buffer (w->contents); Frun_hooks (1, &Qtemp_buffer_show_hook); unbind_to (count, Qnil); } @@ -3421,7 +3413,7 @@ memcpy ((char *) p + sizeof (struct vectorlike_header), (char *) o + sizeof (struct vectorlike_header), word_size * VECSIZE (struct window)); - /* P's buffer slot may change from nil to a buffer. */ + /* P's buffer slot may change from nil to a buffer... */ adjust_window_count (p, 1); XSETWINDOW (parent, p); @@ -3430,12 +3422,11 @@ wset_next (o, Qnil); wset_prev (o, Qnil); wset_parent (o, parent); - - wset_hchild (p, horflag ? window : Qnil); - wset_vchild (p, horflag ? Qnil : window); + /* ...but now P becomes an internal window. */ wset_start (p, Qnil); wset_pointm (p, Qnil); wset_buffer (p, Qnil); + wset_combination (p, horflag, window); wset_combination_limit (p, Qnil); wset_window_parameters (p, Qnil); } @@ -3524,10 +3515,10 @@ { struct window *c; - if (!NILP (w->vchild)) + if (WINDOW_VERTICAL_COMBINATION_P (w)) /* W is a vertical combination. */ { - c = XWINDOW (w->vchild); + c = XWINDOW (w->contents); if (horflag) /* All child windows of W must have the same width as W. */ { @@ -3555,10 +3546,10 @@ return (sum_of_sizes == XINT (w->new_total)); } } - else if (!NILP (w->hchild)) + else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) /* W is a horizontal combination. */ { - c = XWINDOW (w->hchild); + c = XWINDOW (w->contents); if (horflag) /* The sum of the widths of the child windows of W must equal W's width. */ @@ -3625,10 +3616,10 @@ pos = w->top_line; } - if (!NILP (w->vchild)) + if (WINDOW_VERTICAL_COMBINATION_P (w)) /* W is a vertical combination. */ { - c = XWINDOW (w->vchild); + c = XWINDOW (w->contents); while (c) { if (horflag) @@ -3641,10 +3632,10 @@ c = NILP (c->next) ? 0 : XWINDOW (c->next); } } - else if (!NILP (w->hchild)) + else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) /* W is a horizontal combination. */ { - c = XWINDOW (w->hchild); + c = XWINDOW (w->contents); while (c) { if (horflag) @@ -3727,7 +3718,7 @@ ? 1 : 0))); r->top_line = FRAME_TOP_MARGIN (f); - if (NILP (r->vchild) && NILP (r->hchild)) + if (WINDOW_LEAF_P (r)) /* For a leaf root window just set the size. */ if (horflag) r->total_cols = new_size; @@ -3842,9 +3833,9 @@ combination_limit = EQ (Vwindow_combination_limit, Qt) || NILP (o->parent) - || NILP (horflag - ? (XWINDOW (o->parent)->hchild) - : (XWINDOW (o->parent)->vchild)); + || (horflag + ? WINDOW_VERTICAL_COMBINATION_P (XWINDOW (o->parent)) + : WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (o->parent))); /* We need a live reference window to initialize some parameters. */ if (WINDOW_LIVE_P (old)) @@ -3914,17 +3905,12 @@ n = XWINDOW (new); wset_frame (n, frame); wset_parent (n, o->parent); - wset_vchild (n, Qnil); - wset_hchild (n, Qnil); if (EQ (side, Qabove) || EQ (side, Qleft)) { wset_prev (n, o->prev); if (NILP (n->prev)) - if (horflag) - wset_hchild (p, new); - else - wset_vchild (p, new); + wset_combination (p, horflag, new); else wset_next (XWINDOW (n->prev), new); wset_next (n, old); @@ -3973,7 +3959,7 @@ adjust_glyphs (f); /* Set buffer of NEW to buffer of reference window. Don't run any hooks. */ - set_window_buffer (new, r->buffer, 0, 1); + set_window_buffer (new, r->contents, 0, 1); unblock_input (); /* Maybe we should run the scroll functions in Elisp (which already @@ -3995,13 +3981,11 @@ register Lisp_Object parent, sibling, frame, root; struct window *w, *p, *s, *r; struct frame *f; - bool horflag; - int before_sibling = 0; + bool horflag, before_sibling = 0; w = decode_any_window (window); XSETWINDOW (window, w); - if (NILP (w->buffer) - && NILP (w->hchild) && NILP (w->vchild)) + if (NILP (w->contents)) /* It's a no-op to delete an already deleted window. */ return Qnil; @@ -4015,7 +3999,7 @@ error ("Attempt to delete sole window of parent"); p = XWINDOW (parent); - horflag = NILP (p->vchild); + horflag = WINDOW_HORIZONTAL_COMBINATION_P (p); frame = WINDOW_FRAME (w); f = XFRAME (frame); @@ -4033,10 +4017,7 @@ sibling = w->next; s = XWINDOW (sibling); wset_prev (s, Qnil); - if (horflag) - wset_hchild (p, sibling); - else - wset_vchild (p, sibling); + wset_combination (p, horflag, sibling); } else /* Get SIBLING above (on the left of) WINDOW. */ @@ -4075,17 +4056,12 @@ wset_next (w, Qnil); /* Don't delete w->next too. */ free_window_matrices (w); - if (!NILP (w->vchild)) - { - delete_all_child_windows (w->vchild); - wset_vchild (w, Qnil); - } - else if (!NILP (w->hchild)) - { - delete_all_child_windows (w->hchild); - wset_hchild (w, Qnil); - } - else if (!NILP (w->buffer)) + if (WINDOWP (w->contents)) + { + delete_all_child_windows (w->contents); + wset_combination (w, 0, Qnil); + } + else { unshow_buffer (w); unchain_marker (XMARKER (w->pointm)); @@ -4104,8 +4080,7 @@ wset_normal_cols (s, p->normal_cols); wset_normal_lines (s, p->normal_lines); /* Mark PARENT as deleted. */ - wset_vchild (p, Qnil); - wset_hchild (p, Qnil); + wset_combination (p, 0, Qnil); /* Try to merge SIBLING into its new parent. */ recombine_windows (sibling); } @@ -4153,10 +4128,7 @@ if (before_sibling) { wset_prev (s, window); - if (horflag) - wset_hchild (p, window); - else - wset_vchild (p, window); + wset_combination (p, horflag, window); } else { @@ -4299,10 +4271,8 @@ { while (w) { - if (!NILP (w->hchild)) - mark_window_cursors_off (XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - mark_window_cursors_off (XWINDOW (w->vchild)); + if (WINDOWP (w->contents)) + mark_window_cursors_off (XWINDOW (w->contents)); else w->phys_cursor_on_p = 0; @@ -4321,8 +4291,7 @@ if (!MINI_WINDOW_P (w)) { if (!NILP (w->parent) - || !NILP (w->vchild) - || !NILP (w->hchild) + || WINDOWP (w->contents) || !NILP (w->next) || !NILP (w->prev) || WINDOW_WANTS_MODELINE_P (w)) @@ -4461,7 +4430,7 @@ else spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); set_marker_restricted (w->start, make_number (spos), - w->buffer); + w->contents); w->start_at_line_beg = 1; w->update_mode_line = 1; w->last_modified = 0; @@ -4585,7 +4554,7 @@ /* If control gets here, then we vscrolled. */ - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; /* Don't try to change the window start below. */ vscrolled = 1; @@ -4605,7 +4574,7 @@ } /* Set the window start, and set up the window for redisplay. */ - set_marker_restricted_both (w->start, w->buffer, IT_CHARPOS (it), + set_marker_restricted_both (w->start, w->contents, IT_CHARPOS (it), IT_BYTEPOS (it)); bytepos = marker_byte_position (w->start); w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); @@ -4805,7 +4774,7 @@ int this_scroll_margin = max (0, min (scroll_margin, w->total_lines / 4)); - set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); + set_marker_restricted_both (w->start, w->contents, pos, pos_byte); w->start_at_line_beg = !NILP (bolp); w->update_mode_line = 1; w->last_modified = 0; @@ -4899,10 +4868,10 @@ /* If selected window's buffer isn't current, make it current for the moment. But don't screw up if window_scroll gets an error. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) + if (XBUFFER (XWINDOW (selected_window)->contents) != current_buffer) { record_unwind_protect (save_excursion_restore, save_excursion_save ()); - Fset_buffer (XWINDOW (selected_window)->buffer); + Fset_buffer (XWINDOW (selected_window)->contents); /* Make redisplay consider other windows than just selected_window. */ ++windows_or_buffers_changed; @@ -5017,7 +4986,7 @@ record_unwind_protect (save_excursion_restore, save_excursion_save ()); ++windows_or_buffers_changed; - Fset_buffer (w->buffer); + Fset_buffer (w->contents); SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); if (NILP (arg)) @@ -5111,10 +5080,10 @@ int bottom_y; void *itdata = NULL; - if (XBUFFER (w->buffer) != current_buffer) + if (XBUFFER (w->contents) != current_buffer) { old_buffer = current_buffer; - set_buffer_internal (XBUFFER (w->buffer)); + set_buffer_internal (XBUFFER (w->contents)); } else old_buffer = NULL; @@ -5176,7 +5145,7 @@ (register Lisp_Object arg) { struct window *w = XWINDOW (selected_window); - struct buffer *buf = XBUFFER (w->buffer); + struct buffer *buf = XBUFFER (w->contents); struct buffer *obuf = current_buffer; int center_p = 0; ptrdiff_t charpos, bytepos; @@ -5342,7 +5311,7 @@ } /* Set the new window start. */ - set_marker_both (w->start, w->buffer, charpos, bytepos); + set_marker_both (w->start, w->contents, charpos, bytepos); w->window_end_valid = 0; w->optional_new_start = 1; @@ -5386,9 +5355,8 @@ int this_scroll_margin; #endif - if (!(BUFFERP (w->buffer) - && XBUFFER (w->buffer) == current_buffer)) - /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer + if (!(BUFFERP (w->contents) && XBUFFER (w->contents) == current_buffer)) + /* This test is needed to make sure PT/PT_BYTE make sense in w->contents when passed below to set_marker_both. */ error ("move-to-window-line called from unrelated buffer"); @@ -5398,7 +5366,7 @@ { int height = window_internal_height (w); Fvertical_motion (make_number (- (height / 2)), window); - set_marker_both (w->start, w->buffer, PT, PT_BYTE); + set_marker_both (w->start, w->contents, PT, PT_BYTE); w->start_at_line_beg = !NILP (Fbolp ()); w->force_start = 1; } @@ -5548,9 +5516,9 @@ window-point of the final-selected-window to the window-point of the current-selected-window. So we have to be careful which point of the current-buffer we copy into old_point. */ - if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) + if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) && WINDOWP (selected_window) - && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) + && EQ (XWINDOW (selected_window)->contents, new_current_buffer) && !EQ (selected_window, data->current_window)) old_point = marker_position (XWINDOW (data->current_window)->pointm); else @@ -5564,7 +5532,7 @@ So if possible we want this arbitrary choice of "which point" to be the one from the to-be-selected-window so as to prevent this window's cursor from being copied from another window. */ - if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) + if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer) /* If current_window = selected_window, its point is in BUF_PT. */ && !EQ (selected_window, data->current_window)) old_point = marker_position (XWINDOW (data->current_window)->pointm); @@ -5606,8 +5574,8 @@ p = SAVED_WINDOW_N (saved_windows, k); window = p->window; w = XWINDOW (window); - if (!NILP (w->buffer) - && !EQ (w->buffer, p->buffer) + if (BUFFERP (w->contents) + && !EQ (w->contents, p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) /* If a window we restore gets another buffer, record the window's old buffer. */ @@ -5640,13 +5608,13 @@ window holds garbage.) We do this now, before restoring the window contents, and prevent it from being done later on when we select a new window. */ - if (! NILP (XWINDOW (selected_window)->buffer)) + if (! NILP (XWINDOW (selected_window)->contents)) { w = XWINDOW (selected_window); set_marker_both (w->pointm, - w->buffer, - BUF_PT (XBUFFER (w->buffer)), - BUF_PT_BYTE (XBUFFER (w->buffer))); + w->contents, + BUF_PT (XBUFFER (w->contents)), + BUF_PT_BYTE (XBUFFER (w->contents))); } windows_or_buffers_changed++; @@ -5693,18 +5661,10 @@ { wset_prev (w, Qnil); if (!NILP (w->parent)) - { - if (XINT (p->total_cols) == XWINDOW (w->parent)->total_cols) - { - wset_vchild (XWINDOW (w->parent), p->window); - wset_hchild (XWINDOW (w->parent), Qnil); - } - else - { - wset_hchild (XWINDOW (w->parent), p->window); - wset_vchild (XWINDOW (w->parent), Qnil); - } - } + wset_combination (XWINDOW (w->parent), + (XINT (p->total_cols) + != XWINDOW (w->parent)->total_cols), + p->window); } /* If we squirreled away the buffer, restore it now. */ @@ -5753,20 +5713,16 @@ w->last_modified = 0; w->last_overlay_modified = 0; - /* Reinstall the saved buffer and pointers into it. */ - if (NILP (p->buffer)) - /* An internal window. */ - wset_buffer (w, p->buffer); - else if (BUFFER_LIVE_P (XBUFFER (p->buffer))) + if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer))) /* If saved buffer is alive, install it. */ { wset_buffer (w, p->buffer); w->start_at_line_beg = !NILP (p->start_at_line_beg); - set_marker_restricted (w->start, p->start, w->buffer); + set_marker_restricted (w->start, p->start, w->contents); set_marker_restricted (w->pointm, p->pointm, - w->buffer); - Fset_marker (BVAR (XBUFFER (w->buffer), mark), - p->mark, w->buffer); + w->contents); + Fset_marker (BVAR (XBUFFER (w->contents), mark), + p->mark, w->contents); /* As documented in Fcurrent_window_configuration, don't restore the location of point in the buffer which was @@ -5775,23 +5731,21 @@ && XBUFFER (p->buffer) == current_buffer) Fgoto_char (w->pointm); } - else if (!NILP (w->buffer) - && BUFFER_LIVE_P (XBUFFER (w->buffer))) - /* Keep window's old buffer; make sure the markers are - real. */ - { - /* Set window markers at start of visible range. */ - if (XMARKER (w->start)->buffer == 0) - set_marker_restricted_both (w->start, w->buffer, 0, 0); - if (XMARKER (w->pointm)->buffer == 0) - set_marker_restricted_both - (w->pointm, w->buffer, - BUF_PT (XBUFFER (w->buffer)), - BUF_PT_BYTE (XBUFFER (w->buffer))); - w->start_at_line_beg = 1; - } - else - /* Window has no live buffer, get one. */ + else if (BUFFERP (w->contents) && BUFFER_LIVE_P (XBUFFER (w->contents))) + /* Keep window's old buffer; make sure the markers are real. */ + { + /* Set window markers at start of visible range. */ + if (XMARKER (w->start)->buffer == 0) + set_marker_restricted_both (w->start, w->contents, 0, 0); + if (XMARKER (w->pointm)->buffer == 0) + set_marker_restricted_both + (w->pointm, w->contents, + BUF_PT (XBUFFER (w->contents)), + BUF_PT_BYTE (XBUFFER (w->contents))); + w->start_at_line_beg = 1; + } + else if (!NILP (w->start)) + /* Leaf window has no live buffer, get one. */ { /* Get the buffer via other_buffer_safely in order to avoid showing an unimportant buffer and, if necessary, to @@ -5800,8 +5754,8 @@ wset_buffer (w, other_buffer_safely (Fcurrent_buffer ())); /* This will set the markers to beginning of visible range. */ - set_marker_restricted_both (w->start, w->buffer, 0, 0); - set_marker_restricted_both (w->pointm, w->buffer, 0, 0); + set_marker_restricted_both (w->start, w->contents, 0, 0); + set_marker_restricted_both (w->pointm, w->contents, 0, 0); w->start_at_line_beg = 1; if (!NILP (w->dedicated)) /* Record this window as dead. */ @@ -5814,17 +5768,17 @@ fset_root_window (f, data->root_window); /* Arrange *not* to restore point in the buffer that was current when the window configuration was saved. */ - if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) + if (EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) set_marker_restricted (XWINDOW (data->current_window)->pointm, make_number (old_point), - XWINDOW (data->current_window)->buffer); + XWINDOW (data->current_window)->contents); /* In the following call to `select-window', prevent "swapping out point" in the old selected window using the buffer that has been restored into it. We already swapped out that point from that window's old buffer. */ select_window (data->current_window, Qnil, 1); - BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) + BVAR (XBUFFER (XWINDOW (selected_window)->contents), last_selected_window) = selected_window; if (NILP (data->focus_frame) @@ -5851,14 +5805,9 @@ /* Now, free glyph matrices in windows that were not reused. */ for (i = n = 0; i < n_leaf_windows; ++i) { - if (NILP (leaf_windows[i]->buffer)) - { - /* Assert it's not reused as a combination. */ - eassert (NILP (leaf_windows[i]->hchild) - && NILP (leaf_windows[i]->vchild)); - free_window_matrices (leaf_windows[i]); - } - else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) + if (NILP (leaf_windows[i]->contents)) + free_window_matrices (leaf_windows[i]); + else if (EQ (leaf_windows[i]->contents, new_current_buffer)) ++n; } @@ -5889,7 +5838,7 @@ Fset_buffer (new_current_buffer); /* If the new current buffer doesn't appear in the selected window, go to its old point (see bug#12208). */ - if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) + if (!EQ (XWINDOW (data->current_window)->contents, new_current_buffer)) Fgoto_char (make_number (old_point)); } @@ -5900,8 +5849,10 @@ } -/* Recursively delete all child windows reachable via the next, vchild, - and hchild slots of WINDOW. */ +/* If WINDOW is an internal window, recursively delete all child windows + reachable via the next and contents slots of WINDOW. Otherwise setup + WINDOW to not show any buffer. */ + void delete_all_child_windows (Lisp_Object window) { @@ -5913,17 +5864,12 @@ /* Delete WINDOW's siblings (we traverse postorderly). */ delete_all_child_windows (w->next); - if (!NILP (w->vchild)) - { - delete_all_child_windows (w->vchild); - wset_vchild (w, Qnil); - } - else if (!NILP (w->hchild)) - { - delete_all_child_windows (w->hchild); - wset_hchild (w, Qnil); - } - else if (!NILP (w->buffer)) + if (WINDOWP (w->contents)) + { + delete_all_child_windows (w->contents); + wset_combination (w, 0, Qnil); + } + else if (BUFFERP (w->contents)) { unshow_buffer (w); unchain_marker (XMARKER (w->pointm)); @@ -5931,7 +5877,7 @@ /* Since combination limit makes sense for an internal windows only, we use this slot to save the buffer for the sake of possible resurrection in Fset_window_configuration. */ - wset_combination_limit (w, w->buffer); + wset_combination_limit (w, w->contents); wset_buffer (w, Qnil); } @@ -5944,10 +5890,8 @@ register int count = 1; if (!NILP (window->next)) count += count_windows (XWINDOW (window->next)); - if (!NILP (window->vchild)) - count += count_windows (XWINDOW (window->vchild)); - if (!NILP (window->hchild)) - count += count_windows (XWINDOW (window->hchild)); + if (WINDOWP (window->contents)) + count += count_windows (XWINDOW (window->contents)); return count; } @@ -5959,10 +5903,8 @@ { while (w) { - if (!NILP (w->hchild)) - i = get_leaf_windows (XWINDOW (w->hchild), flat, i); - else if (!NILP (w->vchild)) - i = get_leaf_windows (XWINDOW (w->vchild), flat, i); + if (WINDOWP (w->contents)) + i = get_leaf_windows (XWINDOW (w->contents), flat, i); else flat[i++] = w; @@ -6018,14 +5960,14 @@ register struct window *w; register Lisp_Object tem, pers, par; - for (;!NILP (window); window = w->next) + for (; !NILP (window); window = w->next) { p = SAVED_WINDOW_N (vector, i); w = XWINDOW (window); wset_temslot (w, make_number (i)); i++; p->window = window; - p->buffer = w->buffer; + p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil); p->left_col = make_number (w->left_col); p->top_line = make_number (w->top_line); p->total_cols = make_number (w->total_cols); @@ -6092,15 +6034,15 @@ } } - if (!NILP (w->buffer)) + if (BUFFERP (w->contents)) { /* Save w's value of point in the window configuration. If w is the selected window, then get the value of point from the buffer; pointm is garbage in the selected window. */ if (EQ (window, selected_window)) - p->pointm = build_marker (XBUFFER (w->buffer), - BUF_PT (XBUFFER (w->buffer)), - BUF_PT_BYTE (XBUFFER (w->buffer))); + p->pointm = build_marker (XBUFFER (w->contents), + BUF_PT (XBUFFER (w->contents)), + BUF_PT_BYTE (XBUFFER (w->contents))); else p->pointm = Fcopy_marker (w->pointm, Qnil); XMARKER (p->pointm)->insertion_type @@ -6109,7 +6051,7 @@ p->start = Fcopy_marker (w->start, Qnil); p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; - tem = BVAR (XBUFFER (w->buffer), mark); + tem = BVAR (XBUFFER (w->contents), mark); p->mark = Fcopy_marker (tem, Qnil); } else @@ -6130,10 +6072,8 @@ else p->prev = XWINDOW (w->prev)->temslot; - if (!NILP (w->vchild)) - i = save_window_save (w->vchild, vector, i); - if (!NILP (w->hchild)) - i = save_window_save (w->hchild, vector, i); + if (WINDOWP (w->contents)) + i = save_window_save (w->contents, vector, i); } return i; @@ -6450,7 +6390,7 @@ adjust_glyphs (f); /* Prevent redisplay shortcuts. */ - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; } } @@ -6484,10 +6424,8 @@ for (cont = 1; w && cont;) { - if (!NILP (w->hchild)) - cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); - else if (!NILP (w->vchild)) - cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); + if (WINDOWP (w->contents)) + cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data); else cont = fn (w, user_data); === modified file 'src/window.h' --- src/window.h 2013-03-22 12:41:34 +0000 +++ src/window.h 2013-03-28 14:04:49 +0000 @@ -41,14 +41,13 @@ this can be done implicitly). Combination windows can be created and deleted at any time. -A leaf window has a non-nil buffer field, and also - has markers in its start and pointm fields. Non-leaf windows - have nil in these fields. +A leaf window has a buffer stored in contents field and markers in its start +and pointm fields. Non-leaf windows have nil in the latter two fields. Non-leaf windows are either vertical or horizontal combinations. A vertical combination window has children that are arranged on the frame -one above the next. Its vchild field points to the uppermost child. +one above the next. Its contents field points to the uppermost child. The parent field of each of the children points to the vertical combination window. The next field of each child points to the child below it, or is nil for the lowest child. The prev field @@ -56,7 +55,7 @@ highest child. A horizontal combination window has children that are side by side. -Its hchild field points to the leftmost child. In each child +Its contents field points to the leftmost child. In each child the next field points to the child to the right and the prev field points to the child to the left. @@ -78,7 +77,7 @@ minibuffer-only screens, the root window and the minibuffer window are one and the same, so its prev and next members are nil. -A dead window has its buffer, hchild, and vchild windows all nil. */ +A dead window has its contents field set to nil. */ struct cursor_pos { @@ -102,13 +101,6 @@ Lisp_Object next; Lisp_Object prev; - /* First child of this window: vchild is used if this is a vertical - combination, hchild if this is a horizontal combination. Of the - fields vchild, hchild and buffer, one and only one is non-nil - unless the window is dead. */ - Lisp_Object hchild; - Lisp_Object vchild; - /* The window this one is a child of. */ Lisp_Object parent; @@ -123,10 +115,8 @@ Lisp_Object new_total; Lisp_Object new_normal; - /* The buffer displayed in this window. Of the fields vchild, - hchild and buffer, one and only one is non-nil unless the window - is dead. */ - Lisp_Object buffer; + /* May be buffer, window, or nil. */ + Lisp_Object contents; /* A marker pointing to where in the text to start displaying. BIDI Note: This is the _logical-order_ start, i.e. the smallest @@ -282,6 +272,10 @@ /* Non-zero if this window is a minibuffer window. */ unsigned mini : 1; + /* Meaningful only if contents is a window, non-zero if this + internal window is used in horizontal combination. */ + unsigned horizontal : 1; + /* Non-zero means must regenerate mode line of this window. */ unsigned update_mode_line : 1; @@ -428,6 +422,21 @@ /* A handy macro. */ +/* Non-zero if W is leaf (carry the buffer). */ + +#define WINDOW_LEAF_P(W) \ + (BUFFERP ((W)->contents)) + +/* Non-zero if W is a member of horizontal combination. */ + +#define WINDOW_HORIZONTAL_COMBINATION_P(W) \ + (WINDOWP ((W)->contents) && (W)->horizontal) + +/* Non-zero if W is a member of vertical combination. */ + +#define WINDOW_VERTICAL_COMBINATION_P(W) \ + (WINDOWP ((W)->contents) && !(W)->horizontal) + #define WINDOW_XFRAME(W) \ (XFRAME (WINDOW_FRAME ((W)))) @@ -931,20 +940,17 @@ struct glyph *get_phys_cursor_glyph (struct window *w); /* Value is non-zero if WINDOW is a valid window. */ -#define WINDOW_VALID_P(WINDOW) \ - (WINDOWP (WINDOW) \ - && (!NILP (XWINDOW (WINDOW)->buffer) \ - || !NILP (XWINDOW (WINDOW)->vchild) \ - || !NILP (XWINDOW (WINDOW)->hchild))) +#define WINDOW_VALID_P(WINDOW) \ + (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->contents)) \ -/* A window of any sort, leaf or interior, is "valid" if one - of its buffer, vchild, or hchild members is non-nil. */ +/* A window of any sort, leaf or interior, is "valid" if its + contents slot is non-nil. */ #define CHECK_VALID_WINDOW(WINDOW) \ CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW) /* Value is non-zero if WINDOW is a live window. */ #define WINDOW_LIVE_P(WINDOW) \ - (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) + (WINDOWP (WINDOW) && BUFFERP (XWINDOW (WINDOW)->contents)) /* A window is "live" if and only if it shows a buffer. */ #define CHECK_LIVE_WINDOW(WINDOW) \ === modified file 'src/xdisp.c' --- src/xdisp.c 2013-03-28 02:41:05 +0000 +++ src/xdisp.c 2013-03-28 14:04:49 +0000 @@ -1283,10 +1283,10 @@ if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w)))) return visible_p; - if (XBUFFER (w->buffer) != current_buffer) + if (XBUFFER (w->contents) != current_buffer) { old_buffer = current_buffer; - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (w->contents)); } SET_TEXT_POS_FROM_MARKER (top, w->start); @@ -4458,7 +4458,7 @@ if it was a text property. */ if (!STRINGP (it->string)) - object = it->w->buffer; + object = it->w->contents; display_replaced_p = handle_display_spec (it, propval, object, overlay, position, bufpos, @@ -4866,7 +4866,7 @@ it->what = IT_IMAGE; it->image_id = -1; /* no image */ it->position = start_pos; - it->object = NILP (object) ? it->w->buffer : object; + it->object = NILP (object) ? it->w->contents : object; it->method = GET_FROM_IMAGE; it->from_overlay = Qnil; it->face_id = face_id; @@ -5012,7 +5012,7 @@ it->what = IT_IMAGE; it->image_id = lookup_image (it->f, value); it->position = start_pos; - it->object = NILP (object) ? it->w->buffer : object; + it->object = NILP (object) ? it->w->contents : object; it->method = GET_FROM_IMAGE; /* Say that we haven't consumed the characters with @@ -5836,7 +5836,7 @@ it->object = p->u.stretch.object; break; case GET_FROM_BUFFER: - it->object = it->w->buffer; + it->object = it->w->contents; break; case GET_FROM_STRING: it->object = it->string; @@ -5849,7 +5849,7 @@ else { it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = it->w->contents; } } it->end_charpos = p->end_charpos; @@ -6290,7 +6290,7 @@ IT_STRING_BYTEPOS (*it) = -1; it->string = Qnil; it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = it->w->contents; it->area = TEXT_AREA; it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); it->sp = 0; @@ -7141,7 +7141,7 @@ else { it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = it->w->contents; } it->dpvec = NULL; @@ -7714,7 +7714,7 @@ setting face_before_selective_p. */ it->saved_face_id = it->face_id; it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = it->w->contents; reseat_at_next_visible_line_start (it, 1); it->face_before_selective_p = 1; } @@ -7978,7 +7978,7 @@ /* Record what we have and where it came from. */ it->what = IT_CHARACTER; - it->object = it->w->buffer; + it->object = it->w->contents; it->position = it->current.pos; /* Normally we return the character found above, except when we @@ -8084,7 +8084,7 @@ return 0; } it->position = it->current.pos; - it->object = it->w->buffer; + it->object = it->w->contents; it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it), IT_BYTEPOS (*it), Qnil); } @@ -10003,7 +10003,7 @@ if (w) { XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i; - ASET (vector, i, w->buffer); ++i; + ASET (vector, i, w->contents); ++i; ASET (vector, i, make_number (marker_position (w->pointm))); ++i; ASET (vector, i, make_number (marker_byte_position (w->pointm))); ++i; ASET (vector, i, make_number (marker_position (w->start))); ++i; @@ -10259,9 +10259,9 @@ eassert (MINI_WINDOW_P (w)); /* By default, start display at the beginning. */ - set_marker_both (w->start, w->buffer, - BUF_BEGV (XBUFFER (w->buffer)), - BUF_BEGV_BYTE (XBUFFER (w->buffer))); + set_marker_both (w->start, w->contents, + BUF_BEGV (XBUFFER (w->contents)), + BUF_BEGV_BYTE (XBUFFER (w->contents))); /* Don't resize windows while redisplaying a window; it would confuse redisplay functions when the size of the window they are @@ -10288,10 +10288,10 @@ struct text_pos start; struct buffer *old_current_buffer = NULL; - if (current_buffer != XBUFFER (w->buffer)) + if (current_buffer != XBUFFER (w->contents)) { old_current_buffer = current_buffer; - set_buffer_internal (XBUFFER (w->buffer)); + set_buffer_internal (XBUFFER (w->contents)); } init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); @@ -10740,7 +10740,7 @@ /* Nonzero if W doesn't reflect the actual state of current buffer due to its text or overlays change. FIXME: this may be called when - XBUFFER (w->buffer) != current_buffer, which looks suspicious. */ + XBUFFER (w->contents) != current_buffer, which looks suspicious. */ static int window_outdated (struct window *w) @@ -10755,7 +10755,7 @@ static int window_buffer_changed (struct window *w) { - struct buffer *b = XBUFFER (w->buffer); + struct buffer *b = XBUFFER (w->contents); eassert (BUFFER_LIVE_P (b)); @@ -11009,7 +11009,7 @@ Fselect_window (f->selected_window, Qt); set_buffer_internal_1 - (XBUFFER (XWINDOW (f->selected_window)->buffer)); + (XBUFFER (XWINDOW (f->selected_window)->contents)); fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; mode_line_target = MODE_LINE_TITLE; @@ -11128,7 +11128,7 @@ if (windows_or_buffers_changed && FRAME_NS_P (f)) ns_set_doc_edited - (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->buffer)); + (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->contents)); #endif UNGCPRO; } @@ -11200,7 +11200,7 @@ specbind (Qinhibit_menubar_update, Qt); - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (w->contents)); if (save_match_data) record_unwind_save_match_data (); if (NILP (Voverriding_local_map_menu_flag)) @@ -11404,7 +11404,7 @@ /* Set current_buffer to the buffer of the selected window of the frame, so that we get the right local keymaps. */ - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (w->contents)); /* Save match data, if we must. */ if (save_match_data) @@ -12271,10 +12271,8 @@ { struct window *w = XWINDOW (window); - if (WINDOWP (w->hchild)) - hscrolled_p |= hscroll_window_tree (w->hchild); - else if (WINDOWP (w->vchild)) - hscrolled_p |= hscroll_window_tree (w->vchild); + if (WINDOWP (w->contents)) + hscrolled_p |= hscroll_window_tree (w->contents); else if (w->cursor.vpos >= 0) { int h_margin; @@ -12294,7 +12292,7 @@ /* Scroll when cursor is inside this scroll margin. */ h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); - if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer)) + if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->contents)) /* For left-to-right rows, hscroll when cursor is either (i) inside the right hscroll margin, or (ii) if it is inside the left margin and the window is already @@ -12329,7 +12327,7 @@ /* Find point in a display of infinite width. */ saved_current_buffer = current_buffer; - current_buffer = XBUFFER (w->buffer); + current_buffer = XBUFFER (w->contents); if (w == XWINDOW (selected_window)) pt = PT; @@ -12382,7 +12380,7 @@ redisplay. */ if (w->hscroll != hscroll) { - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; w->hscroll = hscroll; hscrolled_p = 1; } @@ -12471,9 +12469,9 @@ if (trace_redisplay_p) fprintf (stderr, "%p (%s): %s\n", w, - ((BUFFERP (w->buffer) - && STRINGP (BVAR (XBUFFER (w->buffer), name))) - ? SSDATA (BVAR (XBUFFER (w->buffer), name)) + ((BUFFERP (w->contents) + && STRINGP (BVAR (XBUFFER (w->contents), name))) + ? SSDATA (BVAR (XBUFFER (w->contents), name)) : "no buffer"), method + len); } @@ -12537,8 +12535,8 @@ require to redisplay the whole paragraph. It might be worthwhile to find the paragraph limits and widen the range of redisplayed lines to that, but for now just give up this optimization. */ - if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) - && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) + if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) + && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction))) unchanged_p = 0; } @@ -12761,7 +12759,7 @@ we set b->clip_changed to 1 to force updating the screen. If b->clip_changed has already been set to 1, we can skip this check. */ - if (!b->clip_changed && BUFFERP (w->buffer) && w->window_end_valid) + if (!b->clip_changed && BUFFERP (w->contents) && w->window_end_valid) { ptrdiff_t pt; @@ -12770,11 +12768,11 @@ else pt = marker_position (w->pointm); - if ((w->current_matrix->buffer != XBUFFER (w->buffer) + if ((w->current_matrix->buffer != XBUFFER (w->contents) || pt != w->last_point) && check_point_in_composition (w->current_matrix->buffer, w->last_point, - XBUFFER (w->buffer), pt)) + XBUFFER (w->contents), pt)) b->clip_changed = 1; } } @@ -13029,11 +13027,11 @@ the whole window. The assignment to this_line_start_pos prevents the optimization directly below this if-statement. */ if (((!NILP (Vtransient_mark_mode) - && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) + && !NILP (BVAR (XBUFFER (w->contents), mark_active))) != (w->region_showing > 0)) || (w->region_showing && w->region_showing - != XINT (Fmarker_position (BVAR (XBUFFER (w->buffer), mark))))) + != XINT (Fmarker_position (BVAR (XBUFFER (w->contents), mark))))) CHARPOS (this_line_start_pos) = 0; /* Optimize the case that only the line containing the cursor in the @@ -13051,7 +13049,7 @@ && !FRAME_OBSCURED_P (XFRAME (w->frame)) /* Make sure recorded data applies to current buffer, etc. */ && this_line_buffer == current_buffer - && current_buffer == XBUFFER (w->buffer) + && current_buffer == XBUFFER (w->contents) && !w->force_start && !w->optional_new_start /* Point must be on the line that we have info recorded about. */ @@ -13342,7 +13340,7 @@ Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); struct frame *mini_frame; - displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); + displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ internal_condition_case_1 (redisplay_window_1, selected_window, @@ -13552,7 +13550,7 @@ static void mark_window_display_accurate_1 (struct window *w, int accurate_p) { - struct buffer *b = XBUFFER (w->buffer); + struct buffer *b = XBUFFER (w->contents); w->last_modified = accurate_p ? BUF_MODIFF (b) : 0; w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF (b) : 0; @@ -13599,11 +13597,9 @@ for (; !NILP (window); window = w->next) { w = XWINDOW (window); - if (!NILP (w->vchild)) - mark_window_display_accurate (w->vchild, accurate_p); - else if (!NILP (w->hchild)) - mark_window_display_accurate (w->hchild, accurate_p); - else if (BUFFERP (w->buffer)) + if (WINDOWP (w->contents)) + mark_window_display_accurate (w->contents, accurate_p); + else mark_window_display_accurate_1 (w, accurate_p); } @@ -13660,13 +13656,11 @@ { struct window *w = XWINDOW (window); - if (!NILP (w->hchild)) - redisplay_windows (w->hchild); - else if (!NILP (w->vchild)) - redisplay_windows (w->vchild); - else if (!NILP (w->buffer)) + if (WINDOWP (w->contents)) + redisplay_windows (w->contents); + else if (BUFFERP (w->contents)) { - displayed_buffer = XBUFFER (w->buffer); + displayed_buffer = XBUFFER (w->contents); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ internal_condition_case_1 (redisplay_window_0, window, @@ -14313,7 +14307,7 @@ && !MATRIX_ROW_CONTINUATION_LINE_P (row) && row->x == 0) { - this_line_buffer = XBUFFER (w->buffer); + this_line_buffer = XBUFFER (w->contents); CHARPOS (this_line_start_pos) = MATRIX_ROW_START_CHARPOS (row) + delta; @@ -14349,7 +14343,7 @@ struct window *w = XWINDOW (window); SET_MARKER_FROM_TEXT_POS (w->start, startp); - if (current_buffer != XBUFFER (w->buffer)) + if (current_buffer != XBUFFER (w->contents)) emacs_abort (); if (!NILP (Vwindow_scroll_functions)) @@ -14358,7 +14352,7 @@ make_number (CHARPOS (startp))); SET_TEXT_POS_FROM_MARKER (startp, w->start); /* In case the hook functions switch buffers. */ - set_buffer_internal (XBUFFER (w->buffer)); + set_buffer_internal (XBUFFER (w->contents)); } return startp; @@ -15009,7 +15003,7 @@ must_scroll = 1; } else if (rc != CURSOR_MOVEMENT_SUCCESS - && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) + && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))) { struct glyph_row *row1; @@ -15072,7 +15066,7 @@ else if (scroll_p) rc = CURSOR_MOVEMENT_MUST_SCROLL; else if (rc != CURSOR_MOVEMENT_SUCCESS - && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) + && !NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))) { /* With bidi-reordered rows, there could be more than one candidate row whose start and end positions @@ -15179,7 +15173,7 @@ || (w == XWINDOW (minibuf_window) && NILP (echo_area_buffer[0]))) { - struct buffer *buf = XBUFFER (w->buffer); + struct buffer *buf = XBUFFER (w->contents); whole = BUF_ZV (buf) - BUF_BEGV (buf); start = marker_position (w->start) - BUF_BEGV (buf); /* I don't think this is guaranteed to be right. For the @@ -15213,7 +15207,7 @@ { struct window *w = XWINDOW (window); struct frame *f = XFRAME (w->frame); - struct buffer *buffer = XBUFFER (w->buffer); + struct buffer *buffer = XBUFFER (w->contents); struct buffer *old = current_buffer; struct text_pos lpoint, opoint, startp; int update_mode_line; @@ -15268,10 +15262,10 @@ else if ((w != XWINDOW (minibuf_window) || minibuf_level == 0) /* When buffer is nonempty, redisplay window normally. */ - && BUF_Z (XBUFFER (w->buffer)) == BUF_BEG (XBUFFER (w->buffer)) + && BUF_Z (XBUFFER (w->contents)) == BUF_BEG (XBUFFER (w->contents)) /* Quail displays non-mini buffers in minibuffer window. In that case, redisplay the window normally. */ - && !NILP (Fmemq (w->buffer, Vminibuffer_list))) + && !NILP (Fmemq (w->contents, Vminibuffer_list))) { /* W is a mini-buffer window, but it's not active, so clear it. */ @@ -15293,7 +15287,7 @@ value. */ /* Really select the buffer, for the sake of buffer-local variables. */ - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (w->contents)); current_matrix_up_to_date_p = (w->window_end_valid @@ -16584,7 +16578,7 @@ bidi-reordered glyph rows. Let set_cursor_from_row figure out where to put the cursor, and if it fails, give up. */ - if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) + if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering))) { if (!set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0)) @@ -16835,7 +16829,7 @@ /* Preconditions: W must be a leaf window and full-width. Its frame must have a frame matrix. */ - eassert (NILP (w->hchild) && NILP (w->vchild)); + eassert (BUFFERP (w->contents)); eassert (WINDOW_FULL_WIDTH_P (w)); eassert (!FRAME_WINDOW_P (f)); @@ -16877,7 +16871,7 @@ { struct glyph_row *row = start; struct glyph_row *best_row = NULL; - ptrdiff_t mindif = BUF_ZV (XBUFFER (w->buffer)) + 1; + ptrdiff_t mindif = BUF_ZV (XBUFFER (w->contents)) + 1; int last_y; /* If we happen to start on a header-line, skip that. */ @@ -16913,7 +16907,7 @@ { struct glyph *g; - if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) + if (NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) || (!best_row && !row->continued_p)) return row; /* In bidi-reordered rows, there could be several rows @@ -17079,7 +17073,7 @@ wrapped line can change the wrap position, altering the line above it. It might be worthwhile to handle this more intelligently, but for now just redisplay from scratch. */ - if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap))) + if (!NILP (BVAR (XBUFFER (w->contents), word_wrap))) GIVE_UP (21); /* Under bidi reordering, adding or deleting a character in the @@ -17090,8 +17084,8 @@ to find the paragraph limits and widen the range of redisplayed lines to that, but for now just give up this optimization and redisplay from scratch. */ - if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) - && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) + if (!NILP (BVAR (XBUFFER (w->contents), bidi_display_reordering)) + && NILP (BVAR (XBUFFER (w->contents), bidi_paragraph_direction))) GIVE_UP (22); /* Make sure beg_unchanged and end_unchanged are up to date. Do it @@ -17956,7 +17950,7 @@ (Lisp_Object glyphs) { struct window *w = XWINDOW (selected_window); - struct buffer *buffer = XBUFFER (w->buffer); + struct buffer *buffer = XBUFFER (w->contents); fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n", BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer)); @@ -18062,7 +18056,7 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct buffer *buffer = XBUFFER (w->buffer); + struct buffer *buffer = XBUFFER (w->contents); struct buffer *old = current_buffer; const unsigned char *arrow_string = SDATA (overlay_arrow_string); int arrow_len = SCHARS (overlay_arrow_string); @@ -19269,7 +19263,7 @@ row->glyphs[TEXT_AREA]->charpos = -1; row->displays_text_p = 0; - if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines)) + if (!NILP (BVAR (XBUFFER (it->w->contents), indicate_empty_lines)) && (!MINI_WINDOW_P (it->w) || (minibuf_level && EQ (it->window, minibuf_window)))) row->indicate_empty_line_p = 1; @@ -20084,10 +20078,8 @@ { struct window *w = XWINDOW (window); - if (WINDOWP (w->hchild)) - nwindows += redisplay_mode_lines (w->hchild, force); - else if (WINDOWP (w->vchild)) - nwindows += redisplay_mode_lines (w->vchild, force); + if (WINDOWP (w->contents)) + nwindows += redisplay_mode_lines (w->contents, force); else if (force || FRAME_GARBAGED_P (XFRAME (w->frame)) || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p) @@ -20097,7 +20089,7 @@ /* Set the window's buffer for the mode line display. */ SET_TEXT_POS (lpoint, PT, PT_BYTE); - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (w->contents)); /* Point refers normally to the selected window. For any other window, set up appropriate value. */ @@ -20879,7 +20871,7 @@ XSETWINDOW (window, w); if (NILP (buffer)) - buffer = w->buffer; + buffer = w->contents; CHECK_BUFFER (buffer); /* Make formatting the modeline a non-op when noninteractive, otherwise @@ -22185,7 +22177,7 @@ return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w)); } - prop = buffer_local_value_1 (prop, it->w->buffer); + prop = buffer_local_value_1 (prop, it->w->contents); if (EQ (prop, Qunbound)) prop = Qnil; } @@ -22237,7 +22229,7 @@ return OK_PIXELS (pixels); } - car = buffer_local_value_1 (car, it->w->buffer); + car = buffer_local_value_1 (car, it->w->contents); if (EQ (car, Qunbound)) car = Qnil; } @@ -24089,7 +24081,7 @@ int n = width; if (!STRINGP (object)) - object = it->w->buffer; + object = it->w->contents; #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (it->f)) append_stretch_glyph (it, object, width, height, ascent); @@ -25485,7 +25477,7 @@ int *active_cursor) { struct frame *f = XFRAME (w->frame); - struct buffer *b = XBUFFER (w->buffer); + struct buffer *b = XBUFFER (w->contents); int cursor_type = DEFAULT_CURSOR; Lisp_Object alt_cursor; int non_selected = 0; @@ -26036,10 +26028,8 @@ { while (w) { - if (!NILP (w->hchild)) - update_cursor_in_window_tree (XWINDOW (w->hchild), on_p); - else if (!NILP (w->vchild)) - update_cursor_in_window_tree (XWINDOW (w->vchild), on_p); + if (WINDOWP (w->contents)) + update_cursor_in_window_tree (XWINDOW (w->contents), on_p); else update_window_cursor (w, on_p); @@ -27285,7 +27275,7 @@ { help_echo_string = help; XSETWINDOW (help_echo_window, w); - help_echo_object = w->buffer; + help_echo_object = w->contents; help_echo_pos = charpos; } } @@ -27321,7 +27311,7 @@ { Lisp_Object default_help = buffer_local_value_1 (Qmode_line_default_help_echo, - w->buffer); + w->contents); if (STRINGP (default_help)) { @@ -27596,7 +27586,7 @@ /* Are we in a window whose display is up to date? And verify the buffer's text has not changed. */ - b = XBUFFER (w->buffer); + b = XBUFFER (w->contents); if (part == ON_TEXT && w->window_end_valid && w->last_modified == BUF_MODIFF (b) @@ -27805,8 +27795,8 @@ if (pos > 0) { mouse_face = get_char_property_and_overlay - (make_number (pos), Qmouse_face, w->buffer, &overlay); - buffer = w->buffer; + (make_number (pos), Qmouse_face, w->contents, &overlay); + buffer = w->contents; disp_string = object; } } @@ -27919,11 +27909,11 @@ if (p > 0) { help = Fget_char_property (make_number (p), - Qhelp_echo, w->buffer); + Qhelp_echo, w->contents); if (!NILP (help)) { charpos = p; - obj = w->buffer; + obj = w->contents; } } } @@ -27974,7 +27964,7 @@ ptrdiff_t p = string_buffer_position (obj, start); if (p > 0) pointer = Fget_char_property (make_number (p), - Qpointer, w->buffer); + Qpointer, w->contents); } } else if (BUFFERP (obj) @@ -28417,12 +28407,9 @@ while (w && !FRAME_GARBAGED_P (f)) { - if (!NILP (w->hchild)) - mouse_face_overwritten_p - |= expose_window_tree (XWINDOW (w->hchild), r); - else if (!NILP (w->vchild)) - mouse_face_overwritten_p - |= expose_window_tree (XWINDOW (w->vchild), r); + if (WINDOWP (w->contents)) + mouse_face_overwritten_p + |= expose_window_tree (XWINDOW (w->contents), r); else mouse_face_overwritten_p |= expose_window (w, r); === modified file 'src/xfaces.c' --- src/xfaces.c 2013-03-24 05:29:35 +0000 +++ src/xfaces.c 2013-03-28 14:04:49 +0000 @@ -5964,7 +5964,7 @@ /* W must display the current buffer. We could write this function to use the frame and buffer of W, but right now it doesn't. */ - /* eassert (XBUFFER (w->buffer) == current_buffer); */ + /* eassert (XBUFFER (w->contents) == current_buffer); */ XSETFASTINT (position, pos); @@ -5974,9 +5974,9 @@ /* Get the `face' or `mouse_face' text property at POS, and determine the next position at which the property changes. */ - prop = Fget_text_property (position, propname, w->buffer); + prop = Fget_text_property (position, propname, w->contents); XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); - end = Fnext_single_property_change (position, propname, w->buffer, limit1); + end = Fnext_single_property_change (position, propname, w->contents, limit1); if (INTEGERP (end)) endpos = XINT (end); @@ -6072,7 +6072,7 @@ /* W must display the current buffer. We could write this function to use the frame and buffer of W, but right now it doesn't. */ - /* eassert (XBUFFER (w->buffer) == current_buffer); */ + /* eassert (XBUFFER (w->contents) == current_buffer); */ XSETFASTINT (position, pos); @@ -6082,9 +6082,9 @@ /* Get the `face' or `mouse_face' text property at POS, and determine the next position at which the property changes. */ - prop = Fget_text_property (position, propname, w->buffer); + prop = Fget_text_property (position, propname, w->contents); XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); - end = Fnext_single_property_change (position, propname, w->buffer, limit1); + end = Fnext_single_property_change (position, propname, w->contents, limit1); if (INTEGERP (end)) endpos = XINT (end); === modified file 'src/xfns.c' --- src/xfns.c 2013-03-27 05:13:31 +0000 +++ src/xfns.c 2013-03-28 14:04:49 +0000 @@ -5043,7 +5043,7 @@ /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; - set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); + set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->contents)); bset_truncate_lines (current_buffer, Qnil); clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); === modified file 'src/xmenu.c' --- src/xmenu.c 2013-03-24 12:59:45 +0000 +++ src/xmenu.c 2013-03-28 14:04:49 +0000 @@ -976,7 +976,7 @@ if (! menubar_widget) previous_menu_items_used = 0; - buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; + buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents; specbind (Qinhibit_quit, Qt); /* Don't let the debugger step into this code because it is not reentrant. */ ------------------------------------------------------------ revno: 112170 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-03-28 15:54:21 +0200 message: Fix inaccuracy in a comment. diff: === modified file 'src/indent.c' --- src/indent.c 2013-03-24 12:59:45 +0000 +++ src/indent.c 2013-03-28 13:54:21 +0000 @@ -1088,8 +1088,8 @@ : (window_width + window_left != frame_cols)) where - window_width is XFASTINT (w->total_cols), - window_left is XFASTINT (w->left_col), + window_width is w->total_cols, + window_left is w->left_col, has_vertical_scroll_bars is WINDOW_HAS_VERTICAL_SCROLL_BAR (window) and frame_cols = FRAME_COLS (XFRAME (window->frame)) ------------------------------------------------------------ revno: 112169 fixes bug: http://debbugs.gnu.org/14073 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-03-28 15:45:27 +0200 message: Fix bug #14073 with referencing window total number of columns. src/w32fns.c (Fx_show_tip): Fix compilation error under "--enable-check-lisp-object-type". diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-28 09:25:25 +0000 +++ src/ChangeLog 2013-03-28 13:45:27 +0000 @@ -3,6 +3,8 @@ * w32fns.c (w32_wnd_proc) [ENABLE_CHECKING]: Add code to help identify the reasons for assertion violations in bug#14062 and similar ones. + (Fx_show_tip): Fix compilation error under + "--enable-check-lisp-object-type". (Bug#14073) * image.c (g_error_free) [WINDOWSNT]: Add DEF_IMGLIB_FN. Reported by . === modified file 'src/w32fns.c' --- src/w32fns.c 2013-03-28 09:18:16 +0000 +++ src/w32fns.c 2013-03-28 13:45:27 +0000 @@ -5810,7 +5810,7 @@ w->total_lines = 40; } - FRAME_TOTAL_COLS (f) = XINT (w->total_cols); + FRAME_TOTAL_COLS (f) = WINDOW_TOTAL_COLS (w); adjust_glyphs (f); w->pseudo_window_p = 1; ------------------------------------------------------------ revno: 112168 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2013-03-28 13:25:25 +0400 message: Fix commit 112164 which brokes Fbuffer_swap_text. * buffer.c (Fbuffer_swap_text): Adjust window start markers. Fix comment. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-28 09:18:16 +0000 +++ src/ChangeLog 2013-03-28 09:25:25 +0000 @@ -17,6 +17,8 @@ which is verified by eassert. * editfns.c (save_excursion_save): Do not assume that selected_window always displays the buffer. + * buffer.c (Fbuffer_swap_text): Adjust window start markers. + Fix comment. 2013-03-27 Stefan Monnier === modified file 'src/buffer.c' --- src/buffer.c 2013-01-19 20:04:33 +0000 +++ src/buffer.c 2013-03-28 09:25:25 +0000 @@ -2394,8 +2394,9 @@ BUF_MARKERS(buf) should either be for `buf' or dead. */ eassert (!m->buffer); } - { /* Some of the C code expects that w->buffer == w->pointm->buffer. - So since we just swapped the markers between the two buffers, we need + { /* Some of the C code expects that both window markers of a + live window points to that window's buffer. So since we + just swapped the markers between the two buffers, we need to undo the effect of this swap for window markers. */ Lisp_Object w = Fselected_window (), ws = Qnil; Lisp_Object buf1, buf2; @@ -2411,6 +2412,13 @@ make_number (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), XWINDOW (w)->buffer); + if (MARKERP (XWINDOW (w)->start) + && (EQ (XWINDOW (w)->buffer, buf1) + || EQ (XWINDOW (w)->buffer, buf2))) + Fset_marker (XWINDOW (w)->start, + make_number + (XBUFFER (XWINDOW (w)->buffer)->last_window_start), + XWINDOW (w)->buffer); w = Fnext_window (w, Qt, Qt); } } ------------------------------------------------------------ revno: 112167 fixes bug: http://debbugs.gnu.org/14062 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-03-28 11:18:16 +0200 message: Add debugging code to w32fns.c. src/w32fns.c (w32_wnd_proc) [ENABLE_CHECKING]: Add code to help identify the reasons for assertion violations in bug#14062 and similar ones. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-28 06:40:01 +0000 +++ src/ChangeLog 2013-03-28 09:18:16 +0000 @@ -1,5 +1,9 @@ 2013-03-28 Eli Zaretskii + * w32fns.c (w32_wnd_proc) [ENABLE_CHECKING]: Add code to help + identify the reasons for assertion violations in bug#14062 and + similar ones. + * image.c (g_error_free) [WINDOWSNT]: Add DEF_IMGLIB_FN. Reported by . === modified file 'src/w32fns.c' --- src/w32fns.c 2013-03-24 00:48:49 +0000 +++ src/w32fns.c 2013-03-28 09:18:16 +0000 @@ -3155,8 +3155,26 @@ form.ptCurrentPos.y = w32_system_caret_y; form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0); + +#ifdef ENABLE_CHECKING + /* Temporary code to catch crashes in computing form.rcArea.top. */ + { + int wmbp = WINDOW_MENU_BAR_P (w); + int wtbp = WINDOW_TOOL_BAR_P (w); + struct frame *wf = WINDOW_XFRAME (w); + int fibw = FRAME_INTERNAL_BORDER_WIDTH (wf); + int wtel = WINDOW_TOP_EDGE_LINE (w); + int wflh = FRAME_LINE_HEIGHT (wf); + int wwhlp= WINDOW_WANTS_HEADER_LINE_P (w); + int chlh = CURRENT_HEADER_LINE_HEIGHT (w); + int whlh = (wwhlp ? chlh : 0); + + form.rcArea.top = ((wmbp || wtbp) ? 0 : fibw) + wtel * wflh + whlh; + } +#else form.rcArea.top = (WINDOW_TOP_EDGE_Y (w) + WINDOW_HEADER_LINE_HEIGHT (w)); +#endif form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w) - WINDOW_RIGHT_MARGIN_WIDTH (w) - WINDOW_RIGHT_FRINGE_WIDTH (w)); ------------------------------------------------------------ revno: 112166 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-03-28 08:40:01 +0200 message: Add DEF_IMGLIB_FN for g_error_free to image.c. src/image.c (g_error_free) [WINDOWSNT]: Add DEF_IMGLIB_FN. Reported by . diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-28 02:41:05 +0000 +++ src/ChangeLog 2013-03-28 06:40:01 +0000 @@ -1,3 +1,8 @@ +2013-03-28 Eli Zaretskii + + * image.c (g_error_free) [WINDOWSNT]: Add DEF_IMGLIB_FN. + Reported by . + 2013-03-28 Dmitry Antipov * xdisp.c (with_echo_area_buffer_unwind_data): Save window === modified file 'src/image.c' --- src/image.c 2013-03-27 13:26:34 +0000 +++ src/image.c 2013-03-28 06:40:01 +0000 @@ -8138,6 +8138,7 @@ DEF_IMGLIB_FN (void, g_type_init, (void)); DEF_IMGLIB_FN (void, g_object_unref, (gpointer)); +DEF_IMGLIB_FN (void, g_error_free, (GError *)); Lisp_Object Qgdk_pixbuf, Qglib, Qgobject;