aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong2011-11-08 15:25:56 +0800
committerChong Yidong2011-11-08 15:25:56 +0800
commit105216ed03e65f32a7477ba3d27ab05c94bd3449 (patch)
tree3e43f81d57d93cc600c80e729bc03abbd68b5ff1 /lisp
parent0a9f9ab528d1b73d033e2cd93e89e6f42e6ad132 (diff)
downloademacs-105216ed03e65f32a7477ba3d27ab05c94bd3449.tar.gz
emacs-105216ed03e65f32a7477ba3d27ab05c94bd3449.zip
Move low-level window width/height functions to C, and high-level functions to Lisp.
* lisp/window.el (window-total-height, window-total-width): Doc fix. (window-body-size): Move from C. (window-body-height, window-body-width): Move to C. * src/window.c (Fwindow_left_column, Fwindow_top_line): Doc fix. (Fwindow_body_height, Fwindow_body_width): Move from Lisp. Signal an error if not a live window. (Fwindow_total_width, Fwindow_total_height): Move from Lisp. (Fwindow_total_size, Fwindow_body_size): Move to Lisp.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/window.el74
2 files changed, 26 insertions, 54 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 28e3f79ba6e..394559563e9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12011-11-08 Chong Yidong <cyd@gnu.org>
2
3 * window.el (window-total-height, window-total-width): Doc fix.
4 (window-body-size): Move from C.
5 (window-body-height, window-body-width): Move to C.
6
12011-11-08 Stefan Monnier <monnier@iro.umontreal.ca> 72011-11-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * window.el: Make special-display like display-buffer-alist (bug#9532). 9 * window.el: Make special-display like display-buffer-alist (bug#9532).
diff --git a/lisp/window.el b/lisp/window.el
index 931d265ebab..2f1b2a99a41 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -920,17 +920,16 @@ doc-string of `window-resizable'."
920 (<= (window-resizable window delta horizontal ignore trail noup nodown) 920 (<= (window-resizable window delta horizontal ignore trail noup nodown)
921 delta))) 921 delta)))
922 922
923(defsubst window-total-height (&optional window) 923(defun window-total-size (&optional window horizontal)
924 "Return the total number of lines of WINDOW. 924 "Return the total height or width of window WINDOW.
925WINDOW can be any window and defaults to the selected one. The 925If WINDOW is omitted or nil, it defaults to the selected window.
926return value includes WINDOW's mode line and header line, if any. 926
927If WINDOW is internal the return value is the sum of the total 927If HORIZONTAL is omitted or nil, return the total height of
928number of lines of WINDOW's child windows if these are vertically 928WINDOW, in lines, like `window-total-height'. Otherwise return
929combined and the height of WINDOW's first child otherwise. 929the total width, in columns, like `window-total-width'."
930 930 (if horizontal
931Note: This function does not take into account the value of 931 (window-total-width window)
932`line-spacing' when calculating the number of lines in WINDOW." 932 (window-total-height window)))
933 (window-total-size window))
934 933
935;; Eventually we should make `window-height' obsolete. 934;; Eventually we should make `window-height' obsolete.
936(defalias 'window-height 'window-total-height) 935(defalias 'window-height 'window-total-height)
@@ -946,16 +945,6 @@ one."
946 (= (window-total-size window) 945 (= (window-total-size window)
947 (window-total-size (frame-root-window window)))) 946 (window-total-size (frame-root-window window))))
948 947
949(defsubst window-total-width (&optional window)
950 "Return the total number of columns of WINDOW.
951WINDOW can be any window and defaults to the selected one. The
952return value includes any vertical dividers or scrollbars of
953WINDOW. If WINDOW is internal, the return value is the sum of
954the total number of columns of WINDOW's child windows if these
955are horizontally combined and the width of WINDOW's first child
956otherwise."
957 (window-total-size window t))
958
959(defsubst window-full-width-p (&optional window) 948(defsubst window-full-width-p (&optional window)
960 "Return t if WINDOW is as wide as the containing frame. 949 "Return t if WINDOW is as wide as the containing frame.
961More precisely, return t if and only if the total width of WINDOW 950More precisely, return t if and only if the total width of WINDOW
@@ -965,40 +954,17 @@ WINDOW can be any window and defaults to the selected one."
965 (= (window-total-size window t) 954 (= (window-total-size window t)
966 (window-total-size (frame-root-window window) t))) 955 (window-total-size (frame-root-window window) t)))
967 956
968(defsubst window-body-height (&optional window) 957(defun window-body-size (&optional window horizontal)
969 "Return the number of lines of WINDOW's body. 958 "Return the height or width of WINDOW's text area.
970WINDOW must be a live window and defaults to the selected one. 959If WINDOW is omitted or nil, it defaults to the selected window.
971 960Signal an error if the window is not live.
972The return value does not include WINDOW's mode line and header
973line, if any. If a line at the bottom of the window is only
974partially visible, that line is included in the return value. If
975you do not want to include a partially visible bottom line in the
976return value, use `window-text-height' instead.
977
978Note that the return value is measured in canonical units, i.e. for
979the default frame's face. If the window shows some characters with
980non-default face, e.g., if the font of some characters is larger or
981smaller than the default font, the value returned by this function
982will not match the actual number of lines shown in the window. To
983get the actual number of lines, use `posn-at-point'."
984 (window-body-size window))
985
986(defsubst window-body-width (&optional window)
987 "Return the number of columns of WINDOW's body.
988WINDOW must be a live window and defaults to the selected one.
989 961
990The return value does not include any vertical dividers or scroll 962If HORIZONTAL is omitted or nil, return the height of the text
991bars owned by WINDOW. On a window-system the return value does 963area, like `window-body-height'. Otherwise, return the width of
992not include the number of columns used for WINDOW's fringes or 964the text area, like `window-body-width'."
993display margins either. 965 (if horizontal
994 966 (window-body-width window)
995Note that the return value is measured in canonical units, i.e. for 967 (window-body-height window)))
996the default frame's face. If the window shows some characters with
997non-default face, e.g., if the font of some characters is larger or
998smaller than the default font, the value returned by this function
999will not match the actual number of characters per line shown in the
1000window. To get the actual number of columns, use `posn-at-point'."
1001 (window-body-size window t))
1002 968
1003;; Eventually we should make `window-height' obsolete. 969;; Eventually we should make `window-height' obsolete.
1004(defalias 'window-width 'window-body-width) 970(defalias 'window-width 'window-body-width)