Commit d68443dc authored by Martin Rudalics's avatar Martin Rudalics

Use better names for window-next/-prev and window-vchild/-hchild.

* window.c (Fwindow_vchild): Rename to Fwindow_top_child.
(Fwindow_hchild): Rename to Fwindow_left_child.
(Fwindow_next): Rename to Fwindow_next_sibling.
(Fwindow_prev): Rename to Fwindow_prev_sibling.

* window.el (window-right, window-left, window-child)
(window-child-count, window-last-child)
(window-iso-combination-p, walk-window-tree-1)
(window-atom-check-1, window-tree-1, delete-window)
(window-state-get-1, display-buffer-even-window-sizes): Adapt to
new naming conventions - window-vchild, window-hchild,
window-next and window-prev are now called window-top-child,
window-left-child, window-next-sibling and window-prev-sibling
respectively.
parent 4a834b86
2011-06-27 Martin Rudalics <rudalics@gmx.at>
* window.el (window-right, window-left, window-child)
(window-child-count, window-last-child)
(window-iso-combination-p, walk-window-tree-1)
(window-atom-check-1, window-tree-1, delete-window)
(window-state-get-1, display-buffer-even-window-sizes): Adapt to
new naming conventions - window-vchild, window-hchild,
window-next and window-prev are now called window-top-child,
window-left-child, window-next-sibling and window-prev-sibling
respectively.
2011-06-27 Vincent Belaïche <vincentb1@users.sourceforge.net>
* ses.el (ses-destroy-cell-variable-range): Fix heading comment
......
......@@ -63,25 +63,26 @@ are not altered by this macro (unless they are altered in BODY)."
(when (window-live-p save-selected-window-window)
(select-window save-selected-window-window 'norecord))))))
;; The following two functions are like `window-next' and `window-prev'
;; but the WINDOW argument is _not_ optional (so they don't substitute
;; the selected window for nil), and they return nil when WINDOW doesn't
;; have a parent (like a frame's root window or a minibuffer window).
;; The following two functions are like `window-next-sibling' and
;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so
;; they don't substitute the selected window for nil), and they return
;; nil when WINDOW doesn't have a parent (like a frame's root window or
;; a minibuffer window).
(defsubst window-right (window)
"Return WINDOW's right sibling.
Return nil if WINDOW is the root window of its frame. WINDOW can
be any window."
(and window (window-parent window) (window-next window)))
(and window (window-parent window) (window-next-sibling window)))
(defsubst window-left (window)
"Return WINDOW's left sibling.
Return nil if WINDOW is the root window of its frame. WINDOW can
be any window."
(and window (window-parent window) (window-prev window)))
(and window (window-parent window) (window-prev-sibling window)))
(defsubst window-child (window)
"Return WINDOW's first child window."
(or (window-vchild window) (window-hchild window)))
(or (window-top-child window) (window-left-child window)))
(defun window-child-count (window)
"Return number of WINDOW's child windows."
......@@ -89,14 +90,14 @@ be any window."
(when (and (windowp window) (setq window (window-child window)))
(while window
(setq count (1+ count))
(setq window (window-next window))))
(setq window (window-next-sibling window))))
count))
(defun window-last-child (window)
"Return last child window of WINDOW."
(when (and (windowp window) (setq window (window-child window)))
(while (window-next window)
(setq window (window-next window))))
(while (window-next-sibling window)
(setq window (window-next-sibling window))))
window)
(defsubst window-any-p (object)
......@@ -203,8 +204,8 @@ Optional argument HORIZONTAL non-nil means return WINDOW's first
child if WINDOW is a horizontal combination."
(setq window (normalize-any-window window))
(if horizontal
(window-hchild window)
(window-vchild window)))
(window-left-child window)
(window-top-child window)))
(defsubst window-iso-combined-p (&optional window horizontal)
"Return non-nil if and only if WINDOW is vertically combined.
......@@ -258,9 +259,9 @@ number of horizontally arranged subwindows of WINDOW."
(funcall proc walk-window-tree-window))
(unless walk-window-tree-buffer
(walk-window-tree-1
proc (window-hchild walk-window-tree-window) any)
proc (window-left-child walk-window-tree-window) any)
(walk-window-tree-1
proc (window-vchild walk-window-tree-window) any))
proc (window-top-child walk-window-tree-window) any))
(if sub-only
(setq walk-window-tree-window nil)
(setq walk-window-tree-window
......@@ -375,8 +376,8 @@ WINDOW must be an internal window. Return WINDOW."
window t)))
;; Check children.
(unless (window-buffer window)
(window-atom-check-1 (window-hchild window))
(window-atom-check-1 (window-vchild window))))
(window-atom-check-1 (window-left-child window))
(window-atom-check-1 (window-top-child window))))
;; Check right sibling
(window-atom-check-1 (window-right window))))
......@@ -2119,15 +2120,15 @@ return value."
(setq list
(cons
(cond
((window-vchild window)
((window-top-child window)
(cons t (cons (window-edges window)
(window-tree-1 (window-vchild window) t))))
((window-hchild window)
(window-tree-1 (window-top-child window) t))))
((window-left-child window)
(cons nil (cons (window-edges window)
(window-tree-1 (window-hchild window) t))))
(window-tree-1 (window-left-child window) t))))
(t window))
list))
(setq window (when next (window-next window))))
(setq window (when next (window-next-sibling window))))
(nreverse list)))
(defun window-tree (&optional frame)
......@@ -2363,7 +2364,7 @@ non-side window, signal an error."
((not parent)
(error "Attempt to delete minibuffer or sole ordinary window")))
(let* ((horizontal (window-hchild parent))
(let* ((horizontal (window-left-child parent))
(size (window-total-size window horizontal))
(frame-selected
(window-or-subwindow-p (frame-selected-window frame) window))
......@@ -3524,15 +3525,15 @@ specific buffers."
"Helper function for `window-state-get'."
(let* ((type
(cond
((window-vchild window) 'vc)
((window-hchild window) 'hc)
((window-top-child window) 'vc)
((window-left-child window) 'hc)
(t 'leaf)))
(buffer (window-buffer window))
(selected (eq window (selected-window)))
(head
(window-list-no-nils
type
(unless (window-next window) (cons 'last t))
(unless (window-next-sibling window) (cons 'last t))
(cons 'clone-number (window-clone-number window))
(cons 'total-height (window-total-size window))
(cons 'total-width (window-total-size window t))
......@@ -4666,8 +4667,8 @@ larger than WINDOW."
;; Don't resize minibuffer windows.
(window-minibuffer-p)
;; WINDOW must be adjacent to the selected one.
(not (or (eq window (window-prev))
(eq window (window-next))))))
(not (or (eq window (window-prev-sibling))
(eq window (window-next-sibling))))))
((and (window-iso-combined-p window)
;; Resize iff the selected window is higher than WINDOW.
(> (window-total-height) (window-total-height window)))
......
......@@ -5,6 +5,11 @@
matches the window's clone number process the overlay even if
the overlay's window property doesn't match the current window.
* window.c (Fwindow_vchild): Rename to Fwindow_top_child.
(Fwindow_hchild): Rename to Fwindow_left_child.
(Fwindow_next): Rename to Fwindow_next_sibling.
(Fwindow_prev): Rename to Fwindow_prev_sibling.
2011-06-26 Jan Djärv <jan.h.d@swipnet.se>
* emacsgtkfixed.h: State that this is only used with Gtk+3.
......
......@@ -434,37 +434,37 @@ Return nil if WINDOW has no parent. */)
return decode_any_window (window)->parent;
}
DEFUN ("window-vchild", Fwindow_vchild, Swindow_vchild, 0, 1, 0,
doc: /* Return WINDOW's first vertical child window.
DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0,
doc: /* Return WINDOW's topmost child window.
WINDOW can be any window and defaults to the selected one.
Return nil if WINDOW has no vertical child. */)
Return nil if WINDOW is not a vertical combination. */)
(Lisp_Object window)
{
return decode_any_window (window)->vchild;
}
DEFUN ("window-hchild", Fwindow_hchild, Swindow_hchild, 0, 1, 0,
doc: /* Return WINDOW's first horizontal child window.
DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0,
doc: /* Return WINDOW's leftmost child window.
WINDOW can be any window and defaults to the selected one.
Return nil if WINDOW has no horizontal child. */)
Return nil if WINDOW is not a horizontal combination. */)
(Lisp_Object window)
{
return decode_any_window (window)->hchild;
}
DEFUN ("window-next", Fwindow_next, Swindow_next, 0, 1, 0,
doc: /* Return WINDOW's right sibling window.
DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0,
doc: /* Return WINDOW's next sibling window.
WINDOW can be any window and defaults to the selected one.
Return nil if WINDOW has no right sibling. */)
Return nil if WINDOW has no next sibling. */)
(Lisp_Object window)
{
return decode_any_window (window)->next;
}
DEFUN ("window-prev", Fwindow_prev, Swindow_prev, 0, 1, 0,
doc: /* Return WINDOW's left sibling window.
DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0,
doc: /* Return WINDOW's previous sibling window.
WINDOW can be any window and defaults to the selected one.
Return nil if WINDOW has no left sibling. */)
Return nil if WINDOW has no previous sibling. */)
(Lisp_Object window)
{
return decode_any_window (window)->prev;
......@@ -6598,10 +6598,10 @@ function `window-nest' and altered by the function `set-window-nest'. */);
defsubr (&Swindow_clone_number);
defsubr (&Swindow_buffer);
defsubr (&Swindow_parent);
defsubr (&Swindow_vchild);
defsubr (&Swindow_hchild);
defsubr (&Swindow_next);
defsubr (&Swindow_prev);
defsubr (&Swindow_top_child);
defsubr (&Swindow_left_child);
defsubr (&Swindow_next_sibling);
defsubr (&Swindow_prev_sibling);
defsubr (&Swindow_splits);
defsubr (&Sset_window_splits);
defsubr (&Swindow_nest);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment