Commit e995d23a authored by Richard M. Stallman's avatar Richard M. Stallman

(decode_any_window): New function.

(Fwindow_height, Fwindow_width, Fwindow_edges)
(Fwindow_pixel_edges, Fwindow_inside_edges)
(Fwindow_inside_pixel_edges): Use decode_any_window.
parent 972c0c49
...@@ -392,6 +392,17 @@ decode_window (window) ...@@ -392,6 +392,17 @@ decode_window (window)
return XWINDOW (window); return XWINDOW (window);
} }
static struct window *
decode_any_window (window)
register Lisp_Object window;
{
if (NILP (window))
return XWINDOW (selected_window);
CHECK_WINDOW (window);
return XWINDOW (window);
}
DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0,
doc: /* Return the buffer that WINDOW is displaying. */) doc: /* Return the buffer that WINDOW is displaying. */)
(window) (window)
...@@ -405,7 +416,7 @@ DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0, ...@@ -405,7 +416,7 @@ DEFUN ("window-height", Fwindow_height, Swindow_height, 0, 1, 0,
(window) (window)
Lisp_Object window; Lisp_Object window;
{ {
return decode_window (window)->total_lines; return decode_any_window (window)->total_lines;
} }
DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0, DEFUN ("window-width", Fwindow_width, Swindow_width, 0, 1, 0,
...@@ -416,7 +427,7 @@ use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */) ...@@ -416,7 +427,7 @@ use (let ((edges (window-edges))) (- (nth 2 edges) (nth 0 edges))). */)
(window) (window)
Lisp_Object window; Lisp_Object window;
{ {
return make_number (window_box_text_cols (decode_window (window))); return make_number (window_box_text_cols (decode_any_window (window)));
} }
DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
...@@ -489,7 +500,7 @@ To get the edges of the actual text area, use `window-inside-edges'. */) ...@@ -489,7 +500,7 @@ To get the edges of the actual text area, use `window-inside-edges'. */)
(window) (window)
Lisp_Object window; Lisp_Object window;
{ {
register struct window *w = decode_window (window); register struct window *w = decode_any_window (window);
return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)),
Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)),
...@@ -509,7 +520,7 @@ To get the edges of the actual text area, use `window-inside-pixel-edges'. */) ...@@ -509,7 +520,7 @@ To get the edges of the actual text area, use `window-inside-pixel-edges'. */)
(window) (window)
Lisp_Object window; Lisp_Object window;
{ {
register struct window *w = decode_window (window); register struct window *w = decode_any_window (window);
return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)),
Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), Fcons (make_number (WINDOW_TOP_EDGE_Y (w)),
...@@ -528,7 +539,7 @@ display margins, fringes, header line, and/or mode line. */) ...@@ -528,7 +539,7 @@ display margins, fringes, header line, and/or mode line. */)
(window) (window)
Lisp_Object window; Lisp_Object window;
{ {
register struct window *w = decode_window (window); register struct window *w = decode_any_window (window);
return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w)
+ WINDOW_LEFT_MARGIN_COLS (w) + WINDOW_LEFT_MARGIN_COLS (w)
...@@ -552,7 +563,7 @@ display margins, fringes, header line, and/or mode line. */) ...@@ -552,7 +563,7 @@ display margins, fringes, header line, and/or mode line. */)
(window) (window)
Lisp_Object window; Lisp_Object window;
{ {
register struct window *w = decode_window (window); register struct window *w = decode_any_window (window);
return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w)
+ WINDOW_LEFT_MARGIN_WIDTH (w) + WINDOW_LEFT_MARGIN_WIDTH (w)
...@@ -771,7 +782,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ ...@@ -771,7 +782,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
int x, y; int x, y;
Lisp_Object lx, ly; Lisp_Object lx, ly;
CHECK_LIVE_WINDOW (window); CHECK_WINDOW (window);
w = XWINDOW (window); w = XWINDOW (window);
f = XFRAME (w->frame); f = XFRAME (w->frame);
CHECK_CONS (coordinates); CHECK_CONS (coordinates);
......
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