diff options
| author | Martin Rudalics | 2012-08-16 09:58:24 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2012-08-16 09:58:24 +0200 |
| commit | 52162052fd8ccf8b74685e161530cc9324358a22 (patch) | |
| tree | 20b1bc3285ad8b5fd3a106a108d08fc2c436a2e3 /src | |
| parent | 2751c80fd3127c572462a2de82c2206d71a4e43e (diff) | |
| download | emacs-52162052fd8ccf8b74685e161530cc9324358a22.tar.gz emacs-52162052fd8ccf8b74685e161530cc9324358a22.zip | |
Consistently check windows for validity/liveness (Bug#11984, Bug#12025, Bug#12026).
* lisp.h (CHECK_VALID_WINDOW): New macro.
* window.c (decode_window): Rename to decode_live_window.
(decode_valid_window, Fwindow_valid_p): New functions.
(Fwindow_frame, Fframe_root_window, Fwindow_minibuffer_p)
(Fframe_first_window, Fframe_selected_window, Fwindow_parent)
(Fwindow_top_child, Fwindow_left_child, Fwindow_next_sibling)
(Fwindow_prev_sibling, Fwindow_combination_limit)
(Fset_window_combination_limit, Fwindow_use_time)
(Fwindow_total_height, Fwindow_total_width, Fwindow_new_total)
(Fwindow_normal_size, Fwindow_new_normal, Fwindow_left_column)
(Fwindow_top_line, Fwindow_body_height, Fwindow_body_width)
(Fwindow_hscroll, Fset_window_hscroll)
(Fwindow_redisplay_end_trigger)
(Fset_window_redisplay_end_trigger, Fwindow_edges)
(Fwindow_pixel_edges, Fwindow_absolute_pixel_edges)
(Fwindow_inside_edges, Fwindow_inside_pixel_edges)
(Fcoordinates_in_window_p, Fwindow_point, Fwindow_start)
(Fwindow_end, Fset_window_point, Fset_window_start)
(Fpos_visible_in_window_p, Fwindow_line_height)
(Fwindow_dedicated_p, Fset_window_dedicated_p)
(Fwindow_prev_buffers, Fset_window_prev_buffers)
(Fwindow_next_buffers, Fwindow_parameters, Fwindow_parameter)
(Fset_window_parameter, Fwindow_display_table)
(Fset_window_display_table, Fdelete_other_windows_internal)
(Fset_window_buffer, Fset_window_new_total)
(Fset_window_new_normal, Fdelete_window_internal)
(Fwindow_text_height, Fset_window_margins, Fwindow_margins)
(Fset_window_fringes, Fwindow_fringes, Fset_window_scroll_bars)
(Fwindow_scroll_bars): Check whether argument window is a valid or
live window. Update doc-strings.
(syms_of_window): New symbol Qwindow_valid_p.
* keyboard.c (Fposn_at_x_y): Check whether argument
frame_or_window denotes a valid window.
* window.el (window-valid-p): Move to window.c.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 38 | ||||
| -rw-r--r-- | src/keyboard.c | 5 | ||||
| -rw-r--r-- | src/lisp.h | 21 | ||||
| -rw-r--r-- | src/window.c | 357 | ||||
| -rw-r--r-- | src/window.h | 11 |
5 files changed, 260 insertions, 172 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3f2a46794a7..95140401eb2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,41 @@ | |||
| 1 | 2012-08-16 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | Consistently check windows for validity/liveness | ||
| 4 | (Bug#11984, Bug#12025, Bug#12026). | ||
| 5 | * lisp.h (CHECK_VALID_WINDOW): New macro. | ||
| 6 | * window.c (decode_window): Rename to decode_live_window. | ||
| 7 | (decode_valid_window, Fwindow_valid_p): New functions. | ||
| 8 | (Fwindow_frame, Fframe_root_window, Fwindow_minibuffer_p) | ||
| 9 | (Fframe_first_window, Fframe_selected_window, Fwindow_parent) | ||
| 10 | (Fwindow_top_child, Fwindow_left_child, Fwindow_next_sibling) | ||
| 11 | (Fwindow_prev_sibling, Fwindow_combination_limit) | ||
| 12 | (Fset_window_combination_limit, Fwindow_use_time) | ||
| 13 | (Fwindow_total_height, Fwindow_total_width, Fwindow_new_total) | ||
| 14 | (Fwindow_normal_size, Fwindow_new_normal, Fwindow_left_column) | ||
| 15 | (Fwindow_top_line, Fwindow_body_height, Fwindow_body_width) | ||
| 16 | (Fwindow_hscroll, Fset_window_hscroll) | ||
| 17 | (Fwindow_redisplay_end_trigger) | ||
| 18 | (Fset_window_redisplay_end_trigger, Fwindow_edges) | ||
| 19 | (Fwindow_pixel_edges, Fwindow_absolute_pixel_edges) | ||
| 20 | (Fwindow_inside_edges, Fwindow_inside_pixel_edges) | ||
| 21 | (Fcoordinates_in_window_p, Fwindow_point, Fwindow_start) | ||
| 22 | (Fwindow_end, Fset_window_point, Fset_window_start) | ||
| 23 | (Fpos_visible_in_window_p, Fwindow_line_height) | ||
| 24 | (Fwindow_dedicated_p, Fset_window_dedicated_p) | ||
| 25 | (Fwindow_prev_buffers, Fset_window_prev_buffers) | ||
| 26 | (Fwindow_next_buffers, Fwindow_parameters, Fwindow_parameter) | ||
| 27 | (Fset_window_parameter, Fwindow_display_table) | ||
| 28 | (Fset_window_display_table, Fdelete_other_windows_internal) | ||
| 29 | (Fset_window_buffer, Fset_window_new_total) | ||
| 30 | (Fset_window_new_normal, Fdelete_window_internal) | ||
| 31 | (Fwindow_text_height, Fset_window_margins, Fwindow_margins) | ||
| 32 | (Fset_window_fringes, Fwindow_fringes, Fset_window_scroll_bars) | ||
| 33 | (Fwindow_scroll_bars): Check whether argument window is a valid or | ||
| 34 | live window. Update doc-strings. | ||
| 35 | (syms_of_window): New symbol Qwindow_valid_p. | ||
| 36 | * keyboard.c (Fposn_at_x_y): Check whether argument | ||
| 37 | frame_or_window denotes a valid window. | ||
| 38 | |||
| 1 | 2012-08-16 Dmitry Antipov <dmantipov@yandex.ru> | 39 | 2012-08-16 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 40 | ||
| 3 | Fix previous char table change. | 41 | Fix previous char table change. |
diff --git a/src/keyboard.c b/src/keyboard.c index 4d0c98f3529..b26a2c88e5d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -11200,11 +11200,8 @@ The `posn-' functions access elements of such lists. */) | |||
| 11200 | 11200 | ||
| 11201 | if (WINDOWP (frame_or_window)) | 11201 | if (WINDOWP (frame_or_window)) |
| 11202 | { | 11202 | { |
| 11203 | struct window *w; | 11203 | struct window *w = decode_valid_window (frame_or_window); |
| 11204 | 11204 | ||
| 11205 | CHECK_LIVE_WINDOW (frame_or_window); | ||
| 11206 | |||
| 11207 | w = XWINDOW (frame_or_window); | ||
| 11208 | XSETINT (x, (XINT (x) | 11205 | XSETINT (x, (XINT (x) |
| 11209 | + WINDOW_LEFT_EDGE_X (w) | 11206 | + WINDOW_LEFT_EDGE_X (w) |
| 11210 | + (NILP (whole) | 11207 | + (NILP (whole) |
diff --git a/src/lisp.h b/src/lisp.h index 426bcb263fd..fb0e44520d6 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1758,15 +1758,18 @@ typedef struct { | |||
| 1758 | #define CHECK_WINDOW_CONFIGURATION(x) \ | 1758 | #define CHECK_WINDOW_CONFIGURATION(x) \ |
| 1759 | CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x) | 1759 | CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x) |
| 1760 | 1760 | ||
| 1761 | /* This macro rejects windows on the interior of the window tree as | 1761 | /* A window of any sort, leaf or interior, is "valid" if one of its |
| 1762 | "dead", which is what we want; this is an argument-checking macro, and | 1762 | buffer, vchild, or hchild members is non-nil. */ |
| 1763 | the user should never get access to interior windows. | 1763 | #define CHECK_VALID_WINDOW(x) \ |
| 1764 | 1764 | CHECK_TYPE (WINDOWP (x) \ | |
| 1765 | A window of any sort, leaf or interior, is dead if the buffer, | 1765 | && (!NILP (XWINDOW (x)->buffer) \ |
| 1766 | vchild, and hchild members are all nil. */ | 1766 | || !NILP (XWINDOW (x)->vchild) \ |
| 1767 | 1767 | || !NILP (XWINDOW (x)->hchild)), \ | |
| 1768 | #define CHECK_LIVE_WINDOW(x) \ | 1768 | Qwindow_valid_p, x) |
| 1769 | CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \ | 1769 | |
| 1770 | /* A window is "live" if and only if it shows a buffer. */ | ||
| 1771 | #define CHECK_LIVE_WINDOW(x) \ | ||
| 1772 | CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \ | ||
| 1770 | Qwindow_live_p, x) | 1773 | Qwindow_live_p, x) |
| 1771 | 1774 | ||
| 1772 | #define CHECK_PROCESS(x) \ | 1775 | #define CHECK_PROCESS(x) \ |
diff --git a/src/window.c b/src/window.c index f5622b217d7..7874105df1e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -51,7 +51,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 51 | #include "nsterm.h" | 51 | #include "nsterm.h" |
| 52 | #endif | 52 | #endif |
| 53 | 53 | ||
| 54 | Lisp_Object Qwindowp, Qwindow_live_p; | 54 | Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_valid_p; |
| 55 | static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; | 55 | static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer; |
| 56 | static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; | 56 | static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; |
| 57 | static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; | 57 | static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; |
| @@ -61,7 +61,6 @@ static Lisp_Object Qsafe, Qabove, Qbelow; | |||
| 61 | static Lisp_Object Qauto_buffer_name, Qclone_of; | 61 | static Lisp_Object Qauto_buffer_name, Qclone_of; |
| 62 | 62 | ||
| 63 | static int displayed_window_lines (struct window *); | 63 | static int displayed_window_lines (struct window *); |
| 64 | static struct window *decode_window (Lisp_Object); | ||
| 65 | static int count_windows (struct window *); | 64 | static int count_windows (struct window *); |
| 66 | static int get_leaf_windows (struct window *, struct window **, int); | 65 | static int get_leaf_windows (struct window *, struct window **, int); |
| 67 | static void window_scroll (Lisp_Object, EMACS_INT, int, int); | 66 | static void window_scroll (Lisp_Object, EMACS_INT, int, int); |
| @@ -131,8 +130,8 @@ static int window_scroll_pixel_based_preserve_y; | |||
| 131 | static EMACS_INT window_scroll_preserve_hpos; | 130 | static EMACS_INT window_scroll_preserve_hpos; |
| 132 | static EMACS_INT window_scroll_preserve_vpos; | 131 | static EMACS_INT window_scroll_preserve_vpos; |
| 133 | 132 | ||
| 134 | static struct window * | 133 | struct window * |
| 135 | decode_window (register Lisp_Object window) | 134 | decode_live_window (register Lisp_Object window) |
| 136 | { | 135 | { |
| 137 | if (NILP (window)) | 136 | if (NILP (window)) |
| 138 | return XWINDOW (selected_window); | 137 | return XWINDOW (selected_window); |
| @@ -154,6 +153,19 @@ decode_any_window (register Lisp_Object window) | |||
| 154 | return w; | 153 | return w; |
| 155 | } | 154 | } |
| 156 | 155 | ||
| 156 | struct window * | ||
| 157 | decode_valid_window (register Lisp_Object window) | ||
| 158 | { | ||
| 159 | struct window *w; | ||
| 160 | |||
| 161 | if (NILP (window)) | ||
| 162 | return XWINDOW (selected_window); | ||
| 163 | |||
| 164 | CHECK_VALID_WINDOW (window); | ||
| 165 | w = XWINDOW (window); | ||
| 166 | return w; | ||
| 167 | } | ||
| 168 | |||
| 157 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | 169 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, |
| 158 | doc: /* Return t if OBJECT is a window and nil otherwise. */) | 170 | doc: /* Return t if OBJECT is a window and nil otherwise. */) |
| 159 | (Lisp_Object object) | 171 | (Lisp_Object object) |
| @@ -161,6 +173,15 @@ DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | |||
| 161 | return WINDOWP (object) ? Qt : Qnil; | 173 | return WINDOWP (object) ? Qt : Qnil; |
| 162 | } | 174 | } |
| 163 | 175 | ||
| 176 | DEFUN ("window-valid-p", Fwindow_valid_p, Swindow_valid_p, 1, 1, 0, | ||
| 177 | doc: /* Return t if OBJECT is a valid window and nil otherwise. | ||
| 178 | A valid window is either a window that displays a buffer or an internal | ||
| 179 | window. Deleted windows are not live. */) | ||
| 180 | (Lisp_Object object) | ||
| 181 | { | ||
| 182 | return WINDOW_VALID_P (object) ? Qt : Qnil; | ||
| 183 | } | ||
| 184 | |||
| 164 | DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, | 185 | DEFUN ("window-live-p", Fwindow_live_p, Swindow_live_p, 1, 1, 0, |
| 165 | doc: /* Return t if OBJECT is a live window and nil otherwise. | 186 | doc: /* Return t if OBJECT is a live window and nil otherwise. |
| 166 | A live window is a window that displays a buffer. | 187 | A live window is a window that displays a buffer. |
| @@ -173,10 +194,10 @@ Internal windows and deleted windows are not live. */) | |||
| 173 | /* Frames and windows. */ | 194 | /* Frames and windows. */ |
| 174 | DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, | 195 | DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, |
| 175 | doc: /* Return the frame that window WINDOW is on. | 196 | doc: /* Return the frame that window WINDOW is on. |
| 176 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 197 | WINDOW must be a valid window and defaults to the selected one. */) |
| 177 | (Lisp_Object window) | 198 | (Lisp_Object window) |
| 178 | { | 199 | { |
| 179 | return decode_any_window (window)->frame; | 200 | return decode_valid_window (window)->frame; |
| 180 | } | 201 | } |
| 181 | 202 | ||
| 182 | DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, | 203 | DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, |
| @@ -190,8 +211,8 @@ With a window argument, return the root window of that window's frame. */) | |||
| 190 | 211 | ||
| 191 | if (NILP (frame_or_window)) | 212 | if (NILP (frame_or_window)) |
| 192 | window = SELECTED_FRAME ()->root_window; | 213 | window = SELECTED_FRAME ()->root_window; |
| 193 | else if (WINDOWP (frame_or_window)) | 214 | else if (WINDOW_VALID_P (frame_or_window)) |
| 194 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; | 215 | window = XFRAME (XWINDOW (frame_or_window)->frame)->root_window; |
| 195 | else | 216 | else |
| 196 | { | 217 | { |
| 197 | CHECK_LIVE_FRAME (frame_or_window); | 218 | CHECK_LIVE_FRAME (frame_or_window); |
| @@ -215,18 +236,18 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) | |||
| 215 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, | 236 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, |
| 216 | Swindow_minibuffer_p, 0, 1, 0, | 237 | Swindow_minibuffer_p, 0, 1, 0, |
| 217 | doc: /* Return non-nil if WINDOW is a minibuffer window. | 238 | doc: /* Return non-nil if WINDOW is a minibuffer window. |
| 218 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 239 | WINDOW must be a valid window and defaults to the selected one. */) |
| 219 | (Lisp_Object window) | 240 | (Lisp_Object window) |
| 220 | { | 241 | { |
| 221 | return MINI_WINDOW_P (decode_any_window (window)) ? Qt : Qnil; | 242 | return MINI_WINDOW_P (decode_valid_window (window)) ? Qt : Qnil; |
| 222 | } | 243 | } |
| 223 | 244 | ||
| 224 | /* Don't move this to window.el - this must be a safe routine. */ | 245 | /* Don't move this to window.el - this must be a safe routine. */ |
| 225 | DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, | 246 | DEFUN ("frame-first-window", Fframe_first_window, Sframe_first_window, 0, 1, 0, |
| 226 | doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW. | 247 | doc: /* Return the topmost, leftmost live window on FRAME-OR-WINDOW. |
| 227 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. | 248 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. |
| 228 | Else if FRAME-OR-WINDOW denotes any window, return the first window of | 249 | Else if FRAME-OR-WINDOW denotes a valid window, return the first window |
| 229 | that window's frame. If FRAME-OR-WINDOW denotes a live frame, return | 250 | of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return |
| 230 | the first window of that frame. */) | 251 | the first window of that frame. */) |
| 231 | (Lisp_Object frame_or_window) | 252 | (Lisp_Object frame_or_window) |
| 232 | { | 253 | { |
| @@ -234,7 +255,7 @@ the first window of that frame. */) | |||
| 234 | 255 | ||
| 235 | if (NILP (frame_or_window)) | 256 | if (NILP (frame_or_window)) |
| 236 | window = SELECTED_FRAME ()->root_window; | 257 | window = SELECTED_FRAME ()->root_window; |
| 237 | else if (WINDOWP (frame_or_window)) | 258 | else if (WINDOW_VALID_P (frame_or_window)) |
| 238 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; | 259 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; |
| 239 | else | 260 | else |
| 240 | { | 261 | { |
| @@ -259,16 +280,16 @@ DEFUN ("frame-selected-window", Fframe_selected_window, | |||
| 259 | Sframe_selected_window, 0, 1, 0, | 280 | Sframe_selected_window, 0, 1, 0, |
| 260 | doc: /* Return the selected window of FRAME-OR-WINDOW. | 281 | doc: /* Return the selected window of FRAME-OR-WINDOW. |
| 261 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. | 282 | If omitted, FRAME-OR-WINDOW defaults to the currently selected frame. |
| 262 | Else if FRAME-OR-WINDOW denotes any window, return the selected window | 283 | Else if FRAME-OR-WINDOW denotes a valid window, return the selected |
| 263 | of that window's frame. If FRAME-OR-WINDOW denotes a live frame, return | 284 | window of that window's frame. If FRAME-OR-WINDOW denotes a live frame, |
| 264 | the selected window of that frame. */) | 285 | return the selected window of that frame. */) |
| 265 | (Lisp_Object frame_or_window) | 286 | (Lisp_Object frame_or_window) |
| 266 | { | 287 | { |
| 267 | Lisp_Object window; | 288 | Lisp_Object window; |
| 268 | 289 | ||
| 269 | if (NILP (frame_or_window)) | 290 | if (NILP (frame_or_window)) |
| 270 | window = SELECTED_FRAME ()->selected_window; | 291 | window = SELECTED_FRAME ()->selected_window; |
| 271 | else if (WINDOWP (frame_or_window)) | 292 | else if (WINDOW_VALID_P (frame_or_window)) |
| 272 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; | 293 | window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; |
| 273 | else | 294 | else |
| 274 | { | 295 | { |
| @@ -421,88 +442,92 @@ Return nil for an internal window or a deleted window. */) | |||
| 421 | 442 | ||
| 422 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, | 443 | DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, |
| 423 | doc: /* Return the parent window of window WINDOW. | 444 | doc: /* Return the parent window of window WINDOW. |
| 424 | If WINDOW is omitted or nil, it defaults to the selected window. | 445 | WINDOW must be a valid window and defaults to the selected one. |
| 425 | Return nil for a window with no parent (e.g. a root window). */) | 446 | Return nil for a window with no parent (e.g. a root window). */) |
| 426 | (Lisp_Object window) | 447 | (Lisp_Object window) |
| 427 | { | 448 | { |
| 428 | return decode_any_window (window)->parent; | 449 | return decode_valid_window (window)->parent; |
| 429 | } | 450 | } |
| 430 | 451 | ||
| 431 | DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, | 452 | DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, |
| 432 | doc: /* Return the topmost child window of window WINDOW. | 453 | doc: /* Return the topmost child window of window WINDOW. |
| 454 | WINDOW must be a valid window and defaults to the selected one. | ||
| 433 | Return nil if WINDOW is a live window (live windows have no children). | 455 | Return nil if WINDOW is a live window (live windows have no children). |
| 434 | Return nil if WINDOW is an internal window whose children form a | 456 | Return nil if WINDOW is an internal window whose children form a |
| 435 | horizontal combination. */) | 457 | horizontal combination. */) |
| 436 | (Lisp_Object window) | 458 | (Lisp_Object window) |
| 437 | { | 459 | { |
| 438 | CHECK_WINDOW (window); | 460 | CHECK_WINDOW (window); |
| 439 | return decode_any_window (window)->vchild; | 461 | return decode_valid_window (window)->vchild; |
| 440 | } | 462 | } |
| 441 | 463 | ||
| 442 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, | 464 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, |
| 443 | doc: /* Return the leftmost child window of window WINDOW. | 465 | doc: /* Return the leftmost child window of window WINDOW. |
| 466 | WINDOW must be a valid window and defaults to the selected one. | ||
| 444 | Return nil if WINDOW is a live window (live windows have no children). | 467 | Return nil if WINDOW is a live window (live windows have no children). |
| 445 | Return nil if WINDOW is an internal window whose children form a | 468 | Return nil if WINDOW is an internal window whose children form a |
| 446 | vertical combination. */) | 469 | vertical combination. */) |
| 447 | (Lisp_Object window) | 470 | (Lisp_Object window) |
| 448 | { | 471 | { |
| 449 | CHECK_WINDOW (window); | 472 | CHECK_WINDOW (window); |
| 450 | return decode_any_window (window)->hchild; | 473 | return decode_valid_window (window)->hchild; |
| 451 | } | 474 | } |
| 452 | 475 | ||
| 453 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, | 476 | DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, |
| 454 | doc: /* Return the next sibling window of window WINDOW. | 477 | doc: /* Return the next sibling window of window WINDOW. |
| 455 | If WINDOW is omitted or nil, it defaults to the selected window. | 478 | WINDOW must be a valid window and defaults to the selected one. |
| 456 | Return nil if WINDOW has no next sibling. */) | 479 | Return nil if WINDOW has no next sibling. */) |
| 457 | (Lisp_Object window) | 480 | (Lisp_Object window) |
| 458 | { | 481 | { |
| 459 | return decode_any_window (window)->next; | 482 | return decode_valid_window (window)->next; |
| 460 | } | 483 | } |
| 461 | 484 | ||
| 462 | DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, | 485 | DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, |
| 463 | doc: /* Return the previous sibling window of window WINDOW. | 486 | doc: /* Return the previous sibling window of window WINDOW. |
| 464 | If WINDOW is omitted or nil, it defaults to the selected window. | 487 | WINDOW must be a valid window and defaults to the selected one. |
| 465 | Return nil if WINDOW has no previous sibling. */) | 488 | Return nil if WINDOW has no previous sibling. */) |
| 466 | (Lisp_Object window) | 489 | (Lisp_Object window) |
| 467 | { | 490 | { |
| 468 | return decode_any_window (window)->prev; | 491 | return decode_valid_window (window)->prev; |
| 469 | } | 492 | } |
| 470 | 493 | ||
| 471 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, | 494 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, |
| 472 | doc: /* Return combination limit of window WINDOW. | 495 | doc: /* Return combination limit of window WINDOW. |
| 496 | WINDOW must be a valid window and defaults to the selected one. | ||
| 473 | If the return value is nil, child windows of WINDOW can be recombined with | 497 | If the return value is nil, child windows of WINDOW can be recombined with |
| 474 | WINDOW's siblings. A return value of t means that child windows of | 498 | WINDOW's siblings. A return value of t means that child windows of |
| 475 | WINDOW are never \(re-)combined with WINDOW's siblings. */) | 499 | WINDOW are never \(re-)combined with WINDOW's siblings. */) |
| 476 | (Lisp_Object window) | 500 | (Lisp_Object window) |
| 477 | { | 501 | { |
| 478 | return decode_any_window (window)->combination_limit; | 502 | return decode_valid_window (window)->combination_limit; |
| 479 | } | 503 | } |
| 480 | 504 | ||
| 481 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, | 505 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, |
| 482 | doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. | 506 | doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. |
| 507 | WINDOW must be a valid window and defaults to the selected one. | ||
| 483 | If LIMIT is nil, child windows of WINDOW can be recombined with | 508 | If LIMIT is nil, child windows of WINDOW can be recombined with |
| 484 | WINDOW's siblings. LIMIT t means that child windows of WINDOW are | 509 | WINDOW's siblings. LIMIT t means that child windows of WINDOW are |
| 485 | never \(re-)combined with WINDOW's siblings. Other values are reserved | 510 | never \(re-)combined with WINDOW's siblings. Other values are reserved |
| 486 | for future use. */) | 511 | for future use. */) |
| 487 | (Lisp_Object window, Lisp_Object limit) | 512 | (Lisp_Object window, Lisp_Object limit) |
| 488 | { | 513 | { |
| 489 | return WSET (decode_any_window (window), combination_limit, limit); | 514 | return WSET (decode_valid_window (window), combination_limit, limit); |
| 490 | } | 515 | } |
| 491 | 516 | ||
| 492 | DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, | 517 | DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, |
| 493 | doc: /* Return the use time of window WINDOW. | 518 | doc: /* Return the use time of window WINDOW. |
| 494 | If WINDOW is omitted or nil, it defaults to the selected window. | 519 | WINDOW must be a live window and defaults to the selected one. |
| 495 | The window with the highest use time is the most recently selected | 520 | The window with the highest use time is the most recently selected |
| 496 | one. The window with the lowest use time is the least recently | 521 | one. The window with the lowest use time is the least recently |
| 497 | selected one. */) | 522 | selected one. */) |
| 498 | (Lisp_Object window) | 523 | (Lisp_Object window) |
| 499 | { | 524 | { |
| 500 | return make_number (decode_window (window)->use_time); | 525 | return make_number (decode_live_window (window)->use_time); |
| 501 | } | 526 | } |
| 502 | 527 | ||
| 503 | DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, | 528 | DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, |
| 504 | doc: /* Return the total height, in lines, of window WINDOW. | 529 | doc: /* Return the total height, in lines, of window WINDOW. |
| 505 | If WINDOW is omitted or nil, it defaults to the selected window. | 530 | WINDOW must be a valid window and defaults to the selected one. |
| 506 | 531 | ||
| 507 | The return value includes the mode line and header line, if any. | 532 | The return value includes the mode line and header line, if any. |
| 508 | If WINDOW is an internal window, the total height is the height | 533 | If WINDOW is an internal window, the total height is the height |
| @@ -512,12 +537,12 @@ On a graphical display, this total height is reported as an | |||
| 512 | integer multiple of the default character height. */) | 537 | integer multiple of the default character height. */) |
| 513 | (Lisp_Object window) | 538 | (Lisp_Object window) |
| 514 | { | 539 | { |
| 515 | return decode_any_window (window)->total_lines; | 540 | return decode_valid_window (window)->total_lines; |
| 516 | } | 541 | } |
| 517 | 542 | ||
| 518 | DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, | 543 | DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, |
| 519 | doc: /* Return the total width, in columns, of window WINDOW. | 544 | doc: /* Return the total width, in columns, of window WINDOW. |
| 520 | If WINDOW is omitted or nil, it defaults to the selected window. | 545 | WINDOW must be a valid window and defaults to the selected one. |
| 521 | 546 | ||
| 522 | The return value includes any vertical dividers or scroll bars | 547 | The return value includes any vertical dividers or scroll bars |
| 523 | belonging to WINDOW. If WINDOW is an internal window, the total width | 548 | belonging to WINDOW. If WINDOW is an internal window, the total width |
| @@ -527,34 +552,34 @@ On a graphical display, this total width is reported as an | |||
| 527 | integer multiple of the default character width. */) | 552 | integer multiple of the default character width. */) |
| 528 | (Lisp_Object window) | 553 | (Lisp_Object window) |
| 529 | { | 554 | { |
| 530 | return decode_any_window (window)->total_cols; | 555 | return decode_valid_window (window)->total_cols; |
| 531 | } | 556 | } |
| 532 | 557 | ||
| 533 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, | 558 | DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, |
| 534 | doc: /* Return the new total size of window WINDOW. | 559 | doc: /* Return the new total size of window WINDOW. |
| 535 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 560 | WINDOW must be a valid window and defaults to the selected one. */) |
| 536 | (Lisp_Object window) | 561 | (Lisp_Object window) |
| 537 | { | 562 | { |
| 538 | return decode_any_window (window)->new_total; | 563 | return decode_valid_window (window)->new_total; |
| 539 | } | 564 | } |
| 540 | 565 | ||
| 541 | DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, | 566 | DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, |
| 542 | doc: /* Return the normal height of window WINDOW. | 567 | doc: /* Return the normal height of window WINDOW. |
| 543 | If WINDOW is omitted or nil, it defaults to the selected window. | 568 | WINDOW must be a valid window and defaults to the selected one. |
| 544 | If HORIZONTAL is non-nil, return the normal width of WINDOW. */) | 569 | If HORIZONTAL is non-nil, return the normal width of WINDOW. */) |
| 545 | (Lisp_Object window, Lisp_Object horizontal) | 570 | (Lisp_Object window, Lisp_Object horizontal) |
| 546 | { | 571 | { |
| 547 | struct window *w = decode_any_window (window); | 572 | struct window *w = decode_valid_window (window); |
| 548 | 573 | ||
| 549 | return NILP (horizontal) ? w->normal_lines : w->normal_cols; | 574 | return NILP (horizontal) ? w->normal_lines : w->normal_cols; |
| 550 | } | 575 | } |
| 551 | 576 | ||
| 552 | DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, | 577 | DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, |
| 553 | doc: /* Return new normal size of window WINDOW. | 578 | doc: /* Return new normal size of window WINDOW. |
| 554 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 579 | WINDOW must be a valid window and defaults to the selected one. */) |
| 555 | (Lisp_Object window) | 580 | (Lisp_Object window) |
| 556 | { | 581 | { |
| 557 | return decode_any_window (window)->new_normal; | 582 | return decode_valid_window (window)->new_normal; |
| 558 | } | 583 | } |
| 559 | 584 | ||
| 560 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, | 585 | DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, |
| @@ -563,10 +588,10 @@ This is the distance, in columns, between the left edge of WINDOW and | |||
| 563 | the left edge of the frame's window area. For instance, the return | 588 | the left edge of the frame's window area. For instance, the return |
| 564 | value is 0 if there is no window to the left of WINDOW. | 589 | value is 0 if there is no window to the left of WINDOW. |
| 565 | 590 | ||
| 566 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 591 | WINDOW must be a valid window and defaults to the selected one. */) |
| 567 | (Lisp_Object window) | 592 | (Lisp_Object window) |
| 568 | { | 593 | { |
| 569 | return decode_any_window (window)->left_col; | 594 | return decode_valid_window (window)->left_col; |
| 570 | } | 595 | } |
| 571 | 596 | ||
| 572 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, | 597 | DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, |
| @@ -575,10 +600,10 @@ This is the distance, in lines, between the top of WINDOW and the top | |||
| 575 | of the frame's window area. For instance, the return value is 0 if | 600 | of the frame's window area. For instance, the return value is 0 if |
| 576 | there is no window above WINDOW. | 601 | there is no window above WINDOW. |
| 577 | 602 | ||
| 578 | If WINDOW is omitted or nil, it defaults to the selected window. */) | 603 | WINDOW must be a valid window and defaults to the selected one. */) |
| 579 | (Lisp_Object window) | 604 | (Lisp_Object window) |
| 580 | { | 605 | { |
| 581 | return decode_any_window (window)->top_line; | 606 | return decode_valid_window (window)->top_line; |
| 582 | } | 607 | } |
| 583 | 608 | ||
| 584 | /* Return the number of lines of W's body. Don't count any mode or | 609 | /* Return the number of lines of W's body. Don't count any mode or |
| @@ -632,8 +657,7 @@ window_body_cols (struct window *w) | |||
| 632 | 657 | ||
| 633 | DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, | 658 | DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, |
| 634 | doc: /* Return the height, in lines, of WINDOW's text area. | 659 | doc: /* Return the height, in lines, of WINDOW's text area. |
| 635 | If WINDOW is omitted or nil, it defaults to the selected window. | 660 | WINDOW must be a live window and defaults to the selected one. |
| 636 | Signal an error if the window is not live. | ||
| 637 | 661 | ||
| 638 | The returned height does not include the mode line or header line. | 662 | The returned height does not include the mode line or header line. |
| 639 | On a graphical display, the height is expressed as an integer multiple | 663 | On a graphical display, the height is expressed as an integer multiple |
| @@ -642,21 +666,20 @@ area is only partially visible, that counts as a whole line; to | |||
| 642 | exclude partially-visible lines, use `window-text-height'. */) | 666 | exclude partially-visible lines, use `window-text-height'. */) |
| 643 | (Lisp_Object window) | 667 | (Lisp_Object window) |
| 644 | { | 668 | { |
| 645 | struct window *w = decode_window (window); | 669 | struct window *w = decode_live_window (window); |
| 646 | return make_number (window_body_lines (w)); | 670 | return make_number (window_body_lines (w)); |
| 647 | } | 671 | } |
| 648 | 672 | ||
| 649 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, | 673 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, |
| 650 | doc: /* Return the width, in columns, of WINDOW's text area. | 674 | doc: /* Return the width, in columns, of WINDOW's text area. |
| 651 | If WINDOW is omitted or nil, it defaults to the selected window. | 675 | WINDOW must be a live window and defaults to the selected one. |
| 652 | Signal an error if the window is not live. | ||
| 653 | 676 | ||
| 654 | The return value does not include any vertical dividers, fringe or | 677 | The return value does not include any vertical dividers, fringe or |
| 655 | marginal areas, or scroll bars. On a graphical display, the width is | 678 | marginal areas, or scroll bars. On a graphical display, the width is |
| 656 | expressed as an integer multiple of the default character width. */) | 679 | expressed as an integer multiple of the default character width. */) |
| 657 | (Lisp_Object window) | 680 | (Lisp_Object window) |
| 658 | { | 681 | { |
| 659 | struct window *w = decode_window (window); | 682 | struct window *w = decode_live_window (window); |
| 660 | return make_number (window_body_cols (w)); | 683 | return make_number (window_body_cols (w)); |
| 661 | } | 684 | } |
| 662 | 685 | ||
| @@ -665,7 +688,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | |||
| 665 | WINDOW must be a live window and defaults to the selected one. */) | 688 | WINDOW must be a live window and defaults to the selected one. */) |
| 666 | (Lisp_Object window) | 689 | (Lisp_Object window) |
| 667 | { | 690 | { |
| 668 | return make_number (decode_window (window)->hscroll); | 691 | return make_number (decode_live_window (window)->hscroll); |
| 669 | } | 692 | } |
| 670 | 693 | ||
| 671 | /* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable | 694 | /* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable |
| @@ -692,7 +715,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll) | |||
| 692 | 715 | ||
| 693 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, | 716 | DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, |
| 694 | doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. | 717 | doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL. |
| 695 | If WINDOW is nil, the selected window is used. | 718 | WINDOW must be a live window and defaults to the selected one. |
| 696 | Clip the number to a reasonable value if out of range. | 719 | Clip the number to a reasonable value if out of range. |
| 697 | Return the new number. NCOL should be zero or positive. | 720 | Return the new number. NCOL should be zero or positive. |
| 698 | 721 | ||
| @@ -700,7 +723,7 @@ Note that if `automatic-hscrolling' is non-nil, you cannot scroll the | |||
| 700 | window so that the location of point moves off-window. */) | 723 | window so that the location of point moves off-window. */) |
| 701 | (Lisp_Object window, Lisp_Object ncol) | 724 | (Lisp_Object window, Lisp_Object ncol) |
| 702 | { | 725 | { |
| 703 | struct window *w = decode_window (window); | 726 | struct window *w = decode_live_window (window); |
| 704 | 727 | ||
| 705 | CHECK_NUMBER (ncol); | 728 | CHECK_NUMBER (ncol); |
| 706 | return set_window_hscroll (w, XINT (ncol)); | 729 | return set_window_hscroll (w, XINT (ncol)); |
| @@ -709,41 +732,43 @@ window so that the location of point moves off-window. */) | |||
| 709 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, | 732 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, |
| 710 | Swindow_redisplay_end_trigger, 0, 1, 0, | 733 | Swindow_redisplay_end_trigger, 0, 1, 0, |
| 711 | doc: /* Return WINDOW's redisplay end trigger value. | 734 | doc: /* Return WINDOW's redisplay end trigger value. |
| 712 | WINDOW defaults to the selected window. | 735 | WINDOW must be a live window and defaults to the selected one. |
| 713 | See `set-window-redisplay-end-trigger' for more information. */) | 736 | See `set-window-redisplay-end-trigger' for more information. */) |
| 714 | (Lisp_Object window) | 737 | (Lisp_Object window) |
| 715 | { | 738 | { |
| 716 | return decode_window (window)->redisplay_end_trigger; | 739 | return decode_live_window (window)->redisplay_end_trigger; |
| 717 | } | 740 | } |
| 718 | 741 | ||
| 719 | DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, | 742 | DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, |
| 720 | Sset_window_redisplay_end_trigger, 2, 2, 0, | 743 | Sset_window_redisplay_end_trigger, 2, 2, 0, |
| 721 | doc: /* Set WINDOW's redisplay end trigger value to VALUE. | 744 | doc: /* Set WINDOW's redisplay end trigger value to VALUE. |
| 722 | VALUE should be a buffer position (typically a marker) or nil. | 745 | WINDOW must be a live window and defaults to the selected one. VALUE |
| 723 | If it is a buffer position, then if redisplay in WINDOW reaches a position | 746 | should be a buffer position (typically a marker) or nil. If it is a |
| 724 | beyond VALUE, the functions in `redisplay-end-trigger-functions' are called | 747 | buffer position, then if redisplay in WINDOW reaches a position beyond |
| 725 | with two arguments: WINDOW, and the end trigger value. | 748 | VALUE, the functions in `redisplay-end-trigger-functions' are called |
| 726 | Afterwards the end-trigger value is reset to nil. */) | 749 | with two arguments: WINDOW, and the end trigger value. Afterwards the |
| 750 | end-trigger value is reset to nil. */) | ||
| 727 | (register Lisp_Object window, Lisp_Object value) | 751 | (register Lisp_Object window, Lisp_Object value) |
| 728 | { | 752 | { |
| 729 | return WSET (decode_window (window), redisplay_end_trigger, value); | 753 | return WSET (decode_live_window (window), redisplay_end_trigger, value); |
| 730 | } | 754 | } |
| 731 | 755 | ||
| 732 | DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, | 756 | DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, |
| 733 | doc: /* Return a list of the edge coordinates of WINDOW. | 757 | doc: /* Return a list of the edge coordinates of WINDOW. |
| 734 | The list has the form (LEFT TOP RIGHT BOTTOM). | 758 | WINDOW must be a valid window and defaults to the selected one. |
| 735 | TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, | 759 | |
| 736 | all relative to 0, 0 at top left corner of frame. | 760 | The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM |
| 737 | 761 | count by lines, and LEFT and RIGHT count by columns, all relative to 0, | |
| 738 | RIGHT is one more than the rightmost column occupied by WINDOW. | 762 | 0 at top left corner of frame. |
| 739 | BOTTOM is one more than the bottommost row occupied by WINDOW. | 763 | |
| 740 | The edges include the space used by WINDOW's scroll bar, display | 764 | RIGHT is one more than the rightmost column occupied by WINDOW. BOTTOM |
| 741 | margins, fringes, header line, and/or mode line. For the edges of | 765 | is one more than the bottommost row occupied by WINDOW. The edges |
| 742 | just the text area, use `window-inside-edges'. */) | 766 | include the space used by WINDOW's scroll bar, display margins, fringes, |
| 767 | header line, and/or mode line. For the edges of just the text area, use | ||
| 768 | `window-inside-edges'. */) | ||
| 743 | (Lisp_Object window) | 769 | (Lisp_Object window) |
| 744 | { | 770 | { |
| 745 | register struct window *w = decode_any_window (window); | 771 | register struct window *w = decode_valid_window (window); |
| 746 | CHECK_LIVE_FRAME (w->frame); | ||
| 747 | 772 | ||
| 748 | return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), | 773 | return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), |
| 749 | Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), | 774 | Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), |
| @@ -754,8 +779,10 @@ just the text area, use `window-inside-edges'. */) | |||
| 754 | 779 | ||
| 755 | DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, | 780 | DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, |
| 756 | doc: /* Return a list of the edge pixel coordinates of WINDOW. | 781 | doc: /* Return a list of the edge pixel coordinates of WINDOW. |
| 757 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at | 782 | WINDOW must be a valid window and defaults to the selected one. |
| 758 | the top left corner of the frame. | 783 | |
| 784 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 785 | 0, 0 at the top left corner of the frame. | ||
| 759 | 786 | ||
| 760 | RIGHT is one more than the rightmost x position occupied by WINDOW. | 787 | RIGHT is one more than the rightmost x position occupied by WINDOW. |
| 761 | BOTTOM is one more than the bottommost y position occupied by WINDOW. | 788 | BOTTOM is one more than the bottommost y position occupied by WINDOW. |
| @@ -764,8 +791,7 @@ margins, fringes, header line, and/or mode line. For the pixel edges | |||
| 764 | of just the text area, use `window-inside-pixel-edges'. */) | 791 | of just the text area, use `window-inside-pixel-edges'. */) |
| 765 | (Lisp_Object window) | 792 | (Lisp_Object window) |
| 766 | { | 793 | { |
| 767 | register struct window *w = decode_any_window (window); | 794 | register struct window *w = decode_valid_window (window); |
| 768 | CHECK_LIVE_FRAME (w->frame); | ||
| 769 | 795 | ||
| 770 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), | 796 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), |
| 771 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), | 797 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), |
| @@ -799,8 +825,10 @@ calc_absolute_offset (struct window *w, int *add_x, int *add_y) | |||
| 799 | DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, | 825 | DEFUN ("window-absolute-pixel-edges", Fwindow_absolute_pixel_edges, |
| 800 | Swindow_absolute_pixel_edges, 0, 1, 0, | 826 | Swindow_absolute_pixel_edges, 0, 1, 0, |
| 801 | doc: /* Return a list of the edge pixel coordinates of WINDOW. | 827 | doc: /* Return a list of the edge pixel coordinates of WINDOW. |
| 802 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at | 828 | WINDOW must be a valid window and defaults to the selected one. |
| 803 | the top left corner of the display. | 829 | |
| 830 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 831 | 0, 0 at the top left corner of the display. | ||
| 804 | 832 | ||
| 805 | RIGHT is one more than the rightmost x position occupied by WINDOW. | 833 | RIGHT is one more than the rightmost x position occupied by WINDOW. |
| 806 | BOTTOM is one more than the bottommost y position occupied by WINDOW. | 834 | BOTTOM is one more than the bottommost y position occupied by WINDOW. |
| @@ -809,10 +837,8 @@ margins, fringes, header line, and/or mode line. For the pixel edges | |||
| 809 | of just the text area, use `window-inside-absolute-pixel-edges'. */) | 837 | of just the text area, use `window-inside-absolute-pixel-edges'. */) |
| 810 | (Lisp_Object window) | 838 | (Lisp_Object window) |
| 811 | { | 839 | { |
| 812 | register struct window *w = decode_any_window (window); | 840 | register struct window *w = decode_valid_window (window); |
| 813 | int add_x, add_y; | 841 | int add_x, add_y; |
| 814 | |||
| 815 | CHECK_LIVE_FRAME (w->frame); | ||
| 816 | calc_absolute_offset (w, &add_x, &add_y); | 842 | calc_absolute_offset (w, &add_x, &add_y); |
| 817 | 843 | ||
| 818 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), | 844 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), |
| @@ -824,17 +850,19 @@ of just the text area, use `window-inside-absolute-pixel-edges'. */) | |||
| 824 | 850 | ||
| 825 | DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, | 851 | DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, |
| 826 | doc: /* Return a list of the edge coordinates of WINDOW. | 852 | doc: /* Return a list of the edge coordinates of WINDOW. |
| 827 | The list has the form (LEFT TOP RIGHT BOTTOM). | 853 | WINDOW must be a live window and defaults to the selected one. |
| 828 | TOP and BOTTOM count by lines, and LEFT and RIGHT count by columns, | 854 | |
| 829 | all relative to 0, 0 at top left corner of frame. | 855 | The returned list has the form (LEFT TOP RIGHT BOTTOM). TOP and BOTTOM |
| 856 | count by lines, and LEFT and RIGHT count by columns, all relative to 0, | ||
| 857 | 0 at top left corner of frame. | ||
| 830 | 858 | ||
| 831 | RIGHT is one more than the rightmost column of WINDOW's text area. | 859 | RIGHT is one more than the rightmost column of WINDOW's text area. |
| 832 | BOTTOM is one more than the bottommost row of WINDOW's text area. | 860 | BOTTOM is one more than the bottommost row of WINDOW's text area. The |
| 833 | The inside edges do not include the space used by the WINDOW's scroll | 861 | inside edges do not include the space used by the WINDOW's scroll bar, |
| 834 | bar, display margins, fringes, header line, and/or mode line. */) | 862 | display margins, fringes, header line, and/or mode line. */) |
| 835 | (Lisp_Object window) | 863 | (Lisp_Object window) |
| 836 | { | 864 | { |
| 837 | register struct window *w = decode_window (window); | 865 | register struct window *w = decode_live_window (window); |
| 838 | 866 | ||
| 839 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) | 867 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) |
| 840 | + WINDOW_LEFT_MARGIN_COLS (w) | 868 | + WINDOW_LEFT_MARGIN_COLS (w) |
| @@ -850,8 +878,10 @@ bar, display margins, fringes, header line, and/or mode line. */) | |||
| 850 | 878 | ||
| 851 | DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, | 879 | DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, |
| 852 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. | 880 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. |
| 853 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) | 881 | WINDOW must be a live window and defaults to the selected one. |
| 854 | at the top left corner of the frame's window area. | 882 | |
| 883 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 884 | (0,0) at the top left corner of the frame's window area. | ||
| 855 | 885 | ||
| 856 | RIGHT is one more than the rightmost x position of WINDOW's text area. | 886 | RIGHT is one more than the rightmost x position of WINDOW's text area. |
| 857 | BOTTOM is one more than the bottommost y position of WINDOW's text area. | 887 | BOTTOM is one more than the bottommost y position of WINDOW's text area. |
| @@ -859,7 +889,7 @@ The inside edges do not include the space used by WINDOW's scroll bar, | |||
| 859 | display margins, fringes, header line, and/or mode line. */) | 889 | display margins, fringes, header line, and/or mode line. */) |
| 860 | (Lisp_Object window) | 890 | (Lisp_Object window) |
| 861 | { | 891 | { |
| 862 | register struct window *w = decode_window (window); | 892 | register struct window *w = decode_live_window (window); |
| 863 | 893 | ||
| 864 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) | 894 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) |
| 865 | + WINDOW_LEFT_MARGIN_WIDTH (w) | 895 | + WINDOW_LEFT_MARGIN_WIDTH (w) |
| @@ -877,8 +907,10 @@ DEFUN ("window-inside-absolute-pixel-edges", | |||
| 877 | Fwindow_inside_absolute_pixel_edges, | 907 | Fwindow_inside_absolute_pixel_edges, |
| 878 | Swindow_inside_absolute_pixel_edges, 0, 1, 0, | 908 | Swindow_inside_absolute_pixel_edges, 0, 1, 0, |
| 879 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. | 909 | doc: /* Return a list of the edge pixel coordinates of WINDOW's text area. |
| 880 | The list has the form (LEFT TOP RIGHT BOTTOM), all relative to (0,0) | 910 | WINDOW must be a live window and defaults to the selected one. |
| 881 | at the top left corner of the frame's window area. | 911 | |
| 912 | The returned list has the form (LEFT TOP RIGHT BOTTOM), all relative to | ||
| 913 | (0,0) at the top left corner of the frame's window area. | ||
| 882 | 914 | ||
| 883 | RIGHT is one more than the rightmost x position of WINDOW's text area. | 915 | RIGHT is one more than the rightmost x position of WINDOW's text area. |
| 884 | BOTTOM is one more than the bottommost y position of WINDOW's text area. | 916 | BOTTOM is one more than the bottommost y position of WINDOW's text area. |
| @@ -886,7 +918,7 @@ The inside edges do not include the space used by WINDOW's scroll bar, | |||
| 886 | display margins, fringes, header line, and/or mode line. */) | 918 | display margins, fringes, header line, and/or mode line. */) |
| 887 | (Lisp_Object window) | 919 | (Lisp_Object window) |
| 888 | { | 920 | { |
| 889 | register struct window *w = decode_window (window); | 921 | register struct window *w = decode_live_window (window); |
| 890 | int add_x, add_y; | 922 | int add_x, add_y; |
| 891 | calc_absolute_offset (w, &add_x, &add_y); | 923 | calc_absolute_offset (w, &add_x, &add_y); |
| 892 | 924 | ||
| @@ -1065,7 +1097,7 @@ window_relative_x_coord (struct window *w, enum window_part part, int x) | |||
| 1065 | DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, | 1097 | DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, |
| 1066 | Scoordinates_in_window_p, 2, 2, 0, | 1098 | Scoordinates_in_window_p, 2, 2, 0, |
| 1067 | doc: /* Return non-nil if COORDINATES are in WINDOW. | 1099 | doc: /* Return non-nil if COORDINATES are in WINDOW. |
| 1068 | WINDOW must be a live window. | 1100 | WINDOW must be a live window and defaults to the selected one. |
| 1069 | COORDINATES is a cons of the form (X . Y), X and Y being distances | 1101 | COORDINATES is a cons of the form (X . Y), X and Y being distances |
| 1070 | measured in characters from the upper-left corner of the frame. | 1102 | measured in characters from the upper-left corner of the frame. |
| 1071 | \(0 . 0) denotes the character in the upper left corner of the | 1103 | \(0 . 0) denotes the character in the upper left corner of the |
| @@ -1087,8 +1119,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ | |||
| 1087 | int x, y; | 1119 | int x, y; |
| 1088 | Lisp_Object lx, ly; | 1120 | Lisp_Object lx, ly; |
| 1089 | 1121 | ||
| 1090 | CHECK_LIVE_WINDOW (window); | 1122 | w = decode_live_window (window); |
| 1091 | w = XWINDOW (window); | ||
| 1092 | f = XFRAME (w->frame); | 1123 | f = XFRAME (w->frame); |
| 1093 | CHECK_CONS (coordinates); | 1124 | CHECK_CONS (coordinates); |
| 1094 | lx = Fcar (coordinates); | 1125 | lx = Fcar (coordinates); |
| @@ -1266,7 +1297,7 @@ of point, outside of any save-excursion forms. | |||
| 1266 | But that is hard to define. */) | 1297 | But that is hard to define. */) |
| 1267 | (Lisp_Object window) | 1298 | (Lisp_Object window) |
| 1268 | { | 1299 | { |
| 1269 | register struct window *w = decode_window (window); | 1300 | register struct window *w = decode_live_window (window); |
| 1270 | 1301 | ||
| 1271 | if (w == XWINDOW (selected_window) | 1302 | if (w == XWINDOW (selected_window) |
| 1272 | && current_buffer == XBUFFER (w->buffer)) | 1303 | && current_buffer == XBUFFER (w->buffer)) |
| @@ -1280,7 +1311,7 @@ WINDOW must be a live window and defaults to the selected one. | |||
| 1280 | This is updated by redisplay or by calling `set-window-start'. */) | 1311 | This is updated by redisplay or by calling `set-window-start'. */) |
| 1281 | (Lisp_Object window) | 1312 | (Lisp_Object window) |
| 1282 | { | 1313 | { |
| 1283 | return Fmarker_position (decode_window (window)->start); | 1314 | return Fmarker_position (decode_live_window (window)->start); |
| 1284 | } | 1315 | } |
| 1285 | 1316 | ||
| 1286 | /* This is text temporarily removed from the doc string below. | 1317 | /* This is text temporarily removed from the doc string below. |
| @@ -1307,7 +1338,7 @@ if it isn't already recorded. */) | |||
| 1307 | (Lisp_Object window, Lisp_Object update) | 1338 | (Lisp_Object window, Lisp_Object update) |
| 1308 | { | 1339 | { |
| 1309 | Lisp_Object value; | 1340 | Lisp_Object value; |
| 1310 | struct window *w = decode_window (window); | 1341 | struct window *w = decode_live_window (window); |
| 1311 | Lisp_Object buf; | 1342 | Lisp_Object buf; |
| 1312 | struct buffer *b; | 1343 | struct buffer *b; |
| 1313 | 1344 | ||
| @@ -1374,10 +1405,11 @@ if it isn't already recorded. */) | |||
| 1374 | 1405 | ||
| 1375 | DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, | 1406 | DEFUN ("set-window-point", Fset_window_point, Sset_window_point, 2, 2, 0, |
| 1376 | doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer. | 1407 | doc: /* Make point value in WINDOW be at position POS in WINDOW's buffer. |
| 1408 | WINDOW must be a live window and defaults to the selected one. | ||
| 1377 | Return POS. */) | 1409 | Return POS. */) |
| 1378 | (Lisp_Object window, Lisp_Object pos) | 1410 | (Lisp_Object window, Lisp_Object pos) |
| 1379 | { | 1411 | { |
| 1380 | register struct window *w = decode_window (window); | 1412 | register struct window *w = decode_live_window (window); |
| 1381 | 1413 | ||
| 1382 | CHECK_NUMBER_COERCE_MARKER (pos); | 1414 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1383 | if (w == XWINDOW (selected_window) | 1415 | if (w == XWINDOW (selected_window) |
| @@ -1396,12 +1428,12 @@ Return POS. */) | |||
| 1396 | 1428 | ||
| 1397 | DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, | 1429 | DEFUN ("set-window-start", Fset_window_start, Sset_window_start, 2, 3, 0, |
| 1398 | doc: /* Make display in WINDOW start at position POS in WINDOW's buffer. | 1430 | doc: /* Make display in WINDOW start at position POS in WINDOW's buffer. |
| 1399 | If WINDOW is nil, the selected window is used. Return POS. | 1431 | WINDOW must be a live window and defaults to the selected one. Return |
| 1400 | Optional third arg NOFORCE non-nil inhibits next redisplay from | 1432 | POS. Optional third arg NOFORCE non-nil inhibits next redisplay from |
| 1401 | overriding motion of point in order to display at this exact start. */) | 1433 | overriding motion of point in order to display at this exact start. */) |
| 1402 | (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce) | 1434 | (Lisp_Object window, Lisp_Object pos, Lisp_Object noforce) |
| 1403 | { | 1435 | { |
| 1404 | register struct window *w = decode_window (window); | 1436 | register struct window *w = decode_live_window (window); |
| 1405 | 1437 | ||
| 1406 | CHECK_NUMBER_COERCE_MARKER (pos); | 1438 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1407 | set_marker_restricted (w->start, pos, w->buffer); | 1439 | set_marker_restricted (w->start, pos, w->buffer); |
| @@ -1421,12 +1453,14 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1421 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | 1453 | DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, |
| 1422 | Spos_visible_in_window_p, 0, 3, 0, | 1454 | Spos_visible_in_window_p, 0, 3, 0, |
| 1423 | doc: /* Return non-nil if position POS is currently on the frame in WINDOW. | 1455 | doc: /* Return non-nil if position POS is currently on the frame in WINDOW. |
| 1424 | Return nil if that position is scrolled vertically out of view. | 1456 | WINDOW must be a live window and defaults to the selected one. |
| 1425 | If a character is only partially visible, nil is returned, unless the | 1457 | |
| 1426 | optional argument PARTIALLY is non-nil. | 1458 | Return nil if that position is scrolled vertically out of view. If a |
| 1427 | If POS is only out of view because of horizontal scrolling, return non-nil. | 1459 | character is only partially visible, nil is returned, unless the |
| 1428 | If POS is t, it specifies the position of the last visible glyph in WINDOW. | 1460 | optional argument PARTIALLY is non-nil. If POS is only out of view |
| 1429 | POS defaults to point in WINDOW; WINDOW defaults to the selected window. | 1461 | because of horizontal scrolling, return non-nil. If POS is t, it |
| 1462 | specifies the position of the last visible glyph in WINDOW. POS | ||
| 1463 | defaults to point in WINDOW; WINDOW defaults to the selected window. | ||
| 1430 | 1464 | ||
| 1431 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, | 1465 | If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, |
| 1432 | return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), | 1466 | return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), |
| @@ -1445,7 +1479,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1445 | int rtop, rbot, rowh, vpos, fully_p = 1; | 1479 | int rtop, rbot, rowh, vpos, fully_p = 1; |
| 1446 | int x, y; | 1480 | int x, y; |
| 1447 | 1481 | ||
| 1448 | w = decode_window (window); | 1482 | w = decode_live_window (window); |
| 1449 | buf = XBUFFER (w->buffer); | 1483 | buf = XBUFFER (w->buffer); |
| 1450 | SET_TEXT_POS_FROM_MARKER (top, w->start); | 1484 | SET_TEXT_POS_FROM_MARKER (top, w->start); |
| 1451 | 1485 | ||
| @@ -1487,7 +1521,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1487 | DEFUN ("window-line-height", Fwindow_line_height, | 1521 | DEFUN ("window-line-height", Fwindow_line_height, |
| 1488 | Swindow_line_height, 0, 2, 0, | 1522 | Swindow_line_height, 0, 2, 0, |
| 1489 | doc: /* Return height in pixels of text line LINE in window WINDOW. | 1523 | doc: /* Return height in pixels of text line LINE in window WINDOW. |
| 1490 | WINDOW defaults to the selected window. | 1524 | WINDOW must be a live window and defaults to the selected one. |
| 1491 | 1525 | ||
| 1492 | Return height of current line if LINE is omitted or nil. Return height of | 1526 | Return height of current line if LINE is omitted or nil. Return height of |
| 1493 | header or mode line if LINE is `header-line' or `mode-line'. | 1527 | header or mode line if LINE is `header-line' or `mode-line'. |
| @@ -1511,7 +1545,7 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1511 | int max_y, crop, i; | 1545 | int max_y, crop, i; |
| 1512 | EMACS_INT n; | 1546 | EMACS_INT n; |
| 1513 | 1547 | ||
| 1514 | w = decode_window (window); | 1548 | w = decode_live_window (window); |
| 1515 | 1549 | ||
| 1516 | if (noninteractive || w->pseudo_window_p) | 1550 | if (noninteractive || w->pseudo_window_p) |
| 1517 | return Qnil; | 1551 | return Qnil; |
| @@ -1599,8 +1633,8 @@ DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | |||
| 1599 | More precisely, return the value assigned by the last call of | 1633 | More precisely, return the value assigned by the last call of |
| 1600 | `set-window-dedicated-p' for WINDOW. Return nil if that function was | 1634 | `set-window-dedicated-p' for WINDOW. Return nil if that function was |
| 1601 | never called with WINDOW as its argument, or the value set by that | 1635 | never called with WINDOW as its argument, or the value set by that |
| 1602 | function was internally reset since its last call. WINDOW defaults to | 1636 | function was internally reset since its last call. WINDOW must be a |
| 1603 | the selected window. | 1637 | live window and defaults to the selected one. |
| 1604 | 1638 | ||
| 1605 | When a window is dedicated to its buffer, `display-buffer' will refrain | 1639 | When a window is dedicated to its buffer, `display-buffer' will refrain |
| 1606 | from displaying another buffer in it. `get-lru-window' and | 1640 | from displaying another buffer in it. `get-lru-window' and |
| @@ -1613,7 +1647,7 @@ window, unless that window is "strongly" dedicated to its buffer, that | |||
| 1613 | is the value returned by `window-dedicated-p' is t. */) | 1647 | is the value returned by `window-dedicated-p' is t. */) |
| 1614 | (Lisp_Object window) | 1648 | (Lisp_Object window) |
| 1615 | { | 1649 | { |
| 1616 | return decode_window (window)->dedicated; | 1650 | return decode_live_window (window)->dedicated; |
| 1617 | } | 1651 | } |
| 1618 | 1652 | ||
| 1619 | DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, | 1653 | DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, |
| @@ -1637,7 +1671,7 @@ buffer. If and when `set-window-buffer' displays another buffer in a | |||
| 1637 | window, it also makes sure that the window is no more dedicated. */) | 1671 | window, it also makes sure that the window is no more dedicated. */) |
| 1638 | (Lisp_Object window, Lisp_Object flag) | 1672 | (Lisp_Object window, Lisp_Object flag) |
| 1639 | { | 1673 | { |
| 1640 | return WSET (decode_window (window), dedicated, flag); | 1674 | return WSET (decode_live_window (window), dedicated, flag); |
| 1641 | } | 1675 | } |
| 1642 | 1676 | ||
| 1643 | DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, | 1677 | DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, |
| @@ -1650,7 +1684,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the | |||
| 1650 | window for that buffer, and POS is a window-specific point value. */) | 1684 | window for that buffer, and POS is a window-specific point value. */) |
| 1651 | (Lisp_Object window) | 1685 | (Lisp_Object window) |
| 1652 | { | 1686 | { |
| 1653 | return decode_window (window)->prev_buffers; | 1687 | return decode_live_window (window)->prev_buffers; |
| 1654 | } | 1688 | } |
| 1655 | 1689 | ||
| 1656 | DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, | 1690 | DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, |
| @@ -1663,7 +1697,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the | |||
| 1663 | window for that buffer, and POS is a window-specific point value. */) | 1697 | window for that buffer, and POS is a window-specific point value. */) |
| 1664 | (Lisp_Object window, Lisp_Object prev_buffers) | 1698 | (Lisp_Object window, Lisp_Object prev_buffers) |
| 1665 | { | 1699 | { |
| 1666 | return WSET (decode_window (window), prev_buffers, prev_buffers); | 1700 | return WSET (decode_live_window (window), prev_buffers, prev_buffers); |
| 1667 | } | 1701 | } |
| 1668 | 1702 | ||
| 1669 | DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, | 1703 | DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, |
| @@ -1672,7 +1706,7 @@ DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, | |||
| 1672 | WINDOW must be a live window and defaults to the selected one. */) | 1706 | WINDOW must be a live window and defaults to the selected one. */) |
| 1673 | (Lisp_Object window) | 1707 | (Lisp_Object window) |
| 1674 | { | 1708 | { |
| 1675 | return decode_window (window)->next_buffers; | 1709 | return decode_live_window (window)->next_buffers; |
| 1676 | } | 1710 | } |
| 1677 | 1711 | ||
| 1678 | DEFUN ("set-window-next-buffers", Fset_window_next_buffers, | 1712 | DEFUN ("set-window-next-buffers", Fset_window_next_buffers, |
| @@ -1682,38 +1716,39 @@ WINDOW must be a live window and defaults to the selected one. | |||
| 1682 | NEXT-BUFFERS should be a list of buffers. */) | 1716 | NEXT-BUFFERS should be a list of buffers. */) |
| 1683 | (Lisp_Object window, Lisp_Object next_buffers) | 1717 | (Lisp_Object window, Lisp_Object next_buffers) |
| 1684 | { | 1718 | { |
| 1685 | return WSET (decode_window (window), next_buffers, next_buffers); | 1719 | return WSET (decode_live_window (window), next_buffers, next_buffers); |
| 1686 | } | 1720 | } |
| 1687 | 1721 | ||
| 1688 | DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, | 1722 | DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, |
| 1689 | 0, 1, 0, | 1723 | 0, 1, 0, |
| 1690 | doc: /* Return the parameters of WINDOW and their values. | 1724 | doc: /* Return the parameters of WINDOW and their values. |
| 1691 | WINDOW defaults to the selected window. The return value is a list of | 1725 | WINDOW must be a valid window and defaults to the selected one. The |
| 1692 | elements of the form (PARAMETER . VALUE). */) | 1726 | return value is a list of elements of the form (PARAMETER . VALUE). */) |
| 1693 | (Lisp_Object window) | 1727 | (Lisp_Object window) |
| 1694 | { | 1728 | { |
| 1695 | return Fcopy_alist (decode_any_window (window)->window_parameters); | 1729 | return Fcopy_alist (decode_valid_window (window)->window_parameters); |
| 1696 | } | 1730 | } |
| 1697 | 1731 | ||
| 1698 | DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, | 1732 | DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, |
| 1699 | 2, 2, 0, | 1733 | 2, 2, 0, |
| 1700 | doc: /* Return WINDOW's value for PARAMETER. | 1734 | doc: /* Return WINDOW's value for PARAMETER. |
| 1701 | WINDOW defaults to the selected window. */) | 1735 | WINDOW must be a valid window and defaults to the selected one. */) |
| 1702 | (Lisp_Object window, Lisp_Object parameter) | 1736 | (Lisp_Object window, Lisp_Object parameter) |
| 1703 | { | 1737 | { |
| 1704 | Lisp_Object result; | 1738 | Lisp_Object result; |
| 1705 | 1739 | ||
| 1706 | result = Fassq (parameter, decode_any_window (window)->window_parameters); | 1740 | result = Fassq (parameter, decode_valid_window (window)->window_parameters); |
| 1707 | return CDR_SAFE (result); | 1741 | return CDR_SAFE (result); |
| 1708 | } | 1742 | } |
| 1709 | 1743 | ||
| 1710 | DEFUN ("set-window-parameter", Fset_window_parameter, | 1744 | DEFUN ("set-window-parameter", Fset_window_parameter, |
| 1711 | Sset_window_parameter, 3, 3, 0, | 1745 | Sset_window_parameter, 3, 3, 0, |
| 1712 | doc: /* Set WINDOW's value of PARAMETER to VALUE. | 1746 | doc: /* Set WINDOW's value of PARAMETER to VALUE. |
| 1713 | WINDOW defaults to the selected window. Return VALUE. */) | 1747 | WINDOW must be a valid window and defaults to the selected one. |
| 1748 | Return VALUE. */) | ||
| 1714 | (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) | 1749 | (Lisp_Object window, Lisp_Object parameter, Lisp_Object value) |
| 1715 | { | 1750 | { |
| 1716 | register struct window *w = decode_any_window (window); | 1751 | register struct window *w = decode_valid_window (window); |
| 1717 | Lisp_Object old_alist_elt; | 1752 | Lisp_Object old_alist_elt; |
| 1718 | 1753 | ||
| 1719 | old_alist_elt = Fassq (parameter, w->window_parameters); | 1754 | old_alist_elt = Fassq (parameter, w->window_parameters); |
| @@ -1728,10 +1763,10 @@ WINDOW defaults to the selected window. Return VALUE. */) | |||
| 1728 | DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, | 1763 | DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, |
| 1729 | 0, 1, 0, | 1764 | 0, 1, 0, |
| 1730 | doc: /* Return the display-table that WINDOW is using. | 1765 | doc: /* Return the display-table that WINDOW is using. |
| 1731 | WINDOW defaults to the selected window. */) | 1766 | WINDOW must be a live window and defaults to the selected one. */) |
| 1732 | (Lisp_Object window) | 1767 | (Lisp_Object window) |
| 1733 | { | 1768 | { |
| 1734 | return decode_window (window)->display_table; | 1769 | return decode_live_window (window)->display_table; |
| 1735 | } | 1770 | } |
| 1736 | 1771 | ||
| 1737 | /* Get the display table for use on window W. This is either W's | 1772 | /* Get the display table for use on window W. This is either W's |
| @@ -1760,10 +1795,11 @@ window_display_table (struct window *w) | |||
| 1760 | } | 1795 | } |
| 1761 | 1796 | ||
| 1762 | DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, | 1797 | DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_display_table, 2, 2, 0, |
| 1763 | doc: /* Set WINDOW's display-table to TABLE. */) | 1798 | doc: /* Set WINDOW's display-table to TABLE. |
| 1799 | WINDOW must be a live window and defaults to the selected one. */) | ||
| 1764 | (register Lisp_Object window, Lisp_Object table) | 1800 | (register Lisp_Object window, Lisp_Object table) |
| 1765 | { | 1801 | { |
| 1766 | return WSET (decode_window (window), display_table, table); | 1802 | return WSET (decode_live_window (window), display_table, table); |
| 1767 | } | 1803 | } |
| 1768 | 1804 | ||
| 1769 | /* Record info on buffer window W is displaying | 1805 | /* Record info on buffer window W is displaying |
| @@ -2559,8 +2595,8 @@ resize_root_window (Lisp_Object window, Lisp_Object delta, Lisp_Object horizonta | |||
| 2559 | DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal, | 2595 | DEFUN ("delete-other-windows-internal", Fdelete_other_windows_internal, |
| 2560 | Sdelete_other_windows_internal, 0, 2, "", | 2596 | Sdelete_other_windows_internal, 0, 2, "", |
| 2561 | doc: /* Make WINDOW fill its frame. | 2597 | doc: /* Make WINDOW fill its frame. |
| 2562 | Only the frame WINDOW is on is affected. WINDOW may be any window and | 2598 | Only the frame WINDOW is on is affected. WINDOW must be a valid window |
| 2563 | defaults to the selected one. | 2599 | and defaults to the selected one. |
| 2564 | 2600 | ||
| 2565 | Optional argument ROOT, if non-nil, must specify an internal window such | 2601 | Optional argument ROOT, if non-nil, must specify an internal window such |
| 2566 | that WINDOW is in its window subtree. If this is the case, replace ROOT | 2602 | that WINDOW is in its window subtree. If this is the case, replace ROOT |
| @@ -2579,8 +2615,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2579 | ptrdiff_t startpos IF_LINT (= 0); | 2615 | ptrdiff_t startpos IF_LINT (= 0); |
| 2580 | int top IF_LINT (= 0), new_top, resize_failed; | 2616 | int top IF_LINT (= 0), new_top, resize_failed; |
| 2581 | 2617 | ||
| 2582 | w = decode_any_window (window); | 2618 | w = decode_valid_window (window); |
| 2583 | CHECK_LIVE_FRAME (w->frame); | ||
| 2584 | XSETWINDOW (window, w); | 2619 | XSETWINDOW (window, w); |
| 2585 | f = XFRAME (w->frame); | 2620 | f = XFRAME (w->frame); |
| 2586 | 2621 | ||
| @@ -2593,8 +2628,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2593 | else | 2628 | else |
| 2594 | /* ROOT must be an ancestor of WINDOW. */ | 2629 | /* ROOT must be an ancestor of WINDOW. */ |
| 2595 | { | 2630 | { |
| 2596 | r = decode_any_window (root); | 2631 | r = decode_valid_window (root); |
| 2597 | CHECK_LIVE_FRAME (r->frame); | ||
| 2598 | pwindow = XWINDOW (window)->parent; | 2632 | pwindow = XWINDOW (window)->parent; |
| 2599 | while (!NILP (pwindow)) | 2633 | while (!NILP (pwindow)) |
| 2600 | if (EQ (pwindow, root)) | 2634 | if (EQ (pwindow, root)) |
| @@ -3079,7 +3113,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 3079 | 3113 | ||
| 3080 | DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, | 3114 | DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, |
| 3081 | doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. | 3115 | doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. |
| 3082 | WINDOW has to be a live window and defaults to the selected one. | 3116 | WINDOW must be a live window and defaults to the selected one. |
| 3083 | BUFFER-OR-NAME must be a buffer or the name of an existing buffer. | 3117 | BUFFER-OR-NAME must be a buffer or the name of an existing buffer. |
| 3084 | 3118 | ||
| 3085 | Optional third argument KEEP-MARGINS non-nil means that WINDOW's current | 3119 | Optional third argument KEEP-MARGINS non-nil means that WINDOW's current |
| @@ -3096,7 +3130,7 @@ This function runs `window-scroll-functions' before running | |||
| 3096 | (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins) | 3130 | (register Lisp_Object window, Lisp_Object buffer_or_name, Lisp_Object keep_margins) |
| 3097 | { | 3131 | { |
| 3098 | register Lisp_Object tem, buffer; | 3132 | register Lisp_Object tem, buffer; |
| 3099 | register struct window *w = decode_window (window); | 3133 | register struct window *w = decode_live_window (window); |
| 3100 | 3134 | ||
| 3101 | XSETWINDOW (window, w); | 3135 | XSETWINDOW (window, w); |
| 3102 | buffer = Fget_buffer (buffer_or_name); | 3136 | buffer = Fget_buffer (buffer_or_name); |
| @@ -3318,6 +3352,7 @@ make_window (void) | |||
| 3318 | 3352 | ||
| 3319 | DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, | 3353 | DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, |
| 3320 | doc: /* Set new total size of WINDOW to SIZE. | 3354 | doc: /* Set new total size of WINDOW to SIZE. |
| 3355 | WINDOW must be a valid window and defaults to the selected one. | ||
| 3321 | Return SIZE. | 3356 | Return SIZE. |
| 3322 | 3357 | ||
| 3323 | Optional argument ADD non-nil means add SIZE to the new total size of | 3358 | Optional argument ADD non-nil means add SIZE to the new total size of |
| @@ -3326,7 +3361,7 @@ WINDOW and return the sum. | |||
| 3326 | Note: This function does not operate on any child windows of WINDOW. */) | 3361 | Note: This function does not operate on any child windows of WINDOW. */) |
| 3327 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) | 3362 | (Lisp_Object window, Lisp_Object size, Lisp_Object add) |
| 3328 | { | 3363 | { |
| 3329 | struct window *w = decode_any_window (window); | 3364 | struct window *w = decode_valid_window (window); |
| 3330 | 3365 | ||
| 3331 | CHECK_NUMBER (size); | 3366 | CHECK_NUMBER (size); |
| 3332 | if (NILP (add)) | 3367 | if (NILP (add)) |
| @@ -3339,12 +3374,13 @@ Note: This function does not operate on any child windows of WINDOW. */) | |||
| 3339 | 3374 | ||
| 3340 | DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, | 3375 | DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, |
| 3341 | doc: /* Set new normal size of WINDOW to SIZE. | 3376 | doc: /* Set new normal size of WINDOW to SIZE. |
| 3377 | WINDOW must be a valid window and defaults to the selected one. | ||
| 3342 | Return SIZE. | 3378 | Return SIZE. |
| 3343 | 3379 | ||
| 3344 | Note: This function does not operate on any child windows of WINDOW. */) | 3380 | Note: This function does not operate on any child windows of WINDOW. */) |
| 3345 | (Lisp_Object window, Lisp_Object size) | 3381 | (Lisp_Object window, Lisp_Object size) |
| 3346 | { | 3382 | { |
| 3347 | return WSET (decode_any_window (window), new_normal, size); | 3383 | return WSET (decode_valid_window (window), new_normal, size); |
| 3348 | } | 3384 | } |
| 3349 | 3385 | ||
| 3350 | /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is | 3386 | /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is |
| @@ -3838,8 +3874,6 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 3838 | int before_sibling = 0; | 3874 | int before_sibling = 0; |
| 3839 | 3875 | ||
| 3840 | w = decode_any_window (window); | 3876 | w = decode_any_window (window); |
| 3841 | CHECK_LIVE_FRAME (w->frame); | ||
| 3842 | |||
| 3843 | XSETWINDOW (window, w); | 3877 | XSETWINDOW (window, w); |
| 3844 | if (NILP (w->buffer) | 3878 | if (NILP (w->buffer) |
| 3845 | && NILP (w->hchild) && NILP (w->vchild)) | 3879 | && NILP (w->hchild) && NILP (w->vchild)) |
| @@ -5201,13 +5235,13 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5201 | DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, | 5235 | DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, |
| 5202 | 0, 1, 0, | 5236 | 0, 1, 0, |
| 5203 | doc: /* Return the height in lines of the text display area of WINDOW. | 5237 | doc: /* Return the height in lines of the text display area of WINDOW. |
| 5204 | If WINDOW is omitted or nil, it defaults to the selected window. | 5238 | WINDOW must be a live window and defaults to the selected one. |
| 5205 | 5239 | ||
| 5206 | The returned height does not include the mode line, any header line, | 5240 | The returned height does not include the mode line, any header line, |
| 5207 | nor any partial-height lines at the bottom of the text area. */) | 5241 | nor any partial-height lines at the bottom of the text area. */) |
| 5208 | (Lisp_Object window) | 5242 | (Lisp_Object window) |
| 5209 | { | 5243 | { |
| 5210 | struct window *w = decode_window (window); | 5244 | struct window *w = decode_live_window (window); |
| 5211 | int pixel_height = window_box_height (w); | 5245 | int pixel_height = window_box_height (w); |
| 5212 | int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); | 5246 | int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); |
| 5213 | return make_number (line_height); | 5247 | return make_number (line_height); |
| @@ -6034,14 +6068,15 @@ saved by this function. */) | |||
| 6034 | DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, | 6068 | DEFUN ("set-window-margins", Fset_window_margins, Sset_window_margins, |
| 6035 | 2, 3, 0, | 6069 | 2, 3, 0, |
| 6036 | doc: /* Set width of marginal areas of window WINDOW. | 6070 | doc: /* Set width of marginal areas of window WINDOW. |
| 6037 | If WINDOW is nil, set margins of the currently selected window. | 6071 | WINDOW must be a live window and defaults to the selected one. |
| 6072 | |||
| 6038 | Second arg LEFT-WIDTH specifies the number of character cells to | 6073 | Second arg LEFT-WIDTH specifies the number of character cells to |
| 6039 | reserve for the left marginal area. Optional third arg RIGHT-WIDTH | 6074 | reserve for the left marginal area. Optional third arg RIGHT-WIDTH |
| 6040 | does the same for the right marginal area. A nil width parameter | 6075 | does the same for the right marginal area. A nil width parameter |
| 6041 | means no margin. */) | 6076 | means no margin. */) |
| 6042 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) | 6077 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width) |
| 6043 | { | 6078 | { |
| 6044 | struct window *w = decode_window (window); | 6079 | struct window *w = decode_live_window (window); |
| 6045 | 6080 | ||
| 6046 | /* Translate negative or zero widths to nil. | 6081 | /* Translate negative or zero widths to nil. |
| 6047 | Margins that are too wide have to be checked elsewhere. */ | 6082 | Margins that are too wide have to be checked elsewhere. */ |
| @@ -6079,13 +6114,14 @@ means no margin. */) | |||
| 6079 | DEFUN ("window-margins", Fwindow_margins, Swindow_margins, | 6114 | DEFUN ("window-margins", Fwindow_margins, Swindow_margins, |
| 6080 | 0, 1, 0, | 6115 | 0, 1, 0, |
| 6081 | doc: /* Get width of marginal areas of window WINDOW. | 6116 | doc: /* Get width of marginal areas of window WINDOW. |
| 6082 | If WINDOW is omitted or nil, it defaults to the selected window. | 6117 | WINDOW must be a live window and defaults to the selected one. |
| 6118 | |||
| 6083 | Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). | 6119 | Value is a cons of the form (LEFT-WIDTH . RIGHT-WIDTH). |
| 6084 | If a marginal area does not exist, its width will be returned | 6120 | If a marginal area does not exist, its width will be returned |
| 6085 | as nil. */) | 6121 | as nil. */) |
| 6086 | (Lisp_Object window) | 6122 | (Lisp_Object window) |
| 6087 | { | 6123 | { |
| 6088 | struct window *w = decode_window (window); | 6124 | struct window *w = decode_live_window (window); |
| 6089 | return Fcons (w->left_margin_cols, w->right_margin_cols); | 6125 | return Fcons (w->left_margin_cols, w->right_margin_cols); |
| 6090 | } | 6126 | } |
| 6091 | 6127 | ||
| @@ -6098,8 +6134,8 @@ as nil. */) | |||
| 6098 | DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, | 6134 | DEFUN ("set-window-fringes", Fset_window_fringes, Sset_window_fringes, |
| 6099 | 2, 4, 0, | 6135 | 2, 4, 0, |
| 6100 | doc: /* Set the fringe widths of window WINDOW. | 6136 | doc: /* Set the fringe widths of window WINDOW. |
| 6101 | If WINDOW is nil, set the fringe widths of the currently selected | 6137 | WINDOW must be a live window and defaults to the selected one. |
| 6102 | window. | 6138 | |
| 6103 | Second arg LEFT-WIDTH specifies the number of pixels to reserve for | 6139 | Second arg LEFT-WIDTH specifies the number of pixels to reserve for |
| 6104 | the left fringe. Optional third arg RIGHT-WIDTH specifies the right | 6140 | the left fringe. Optional third arg RIGHT-WIDTH specifies the right |
| 6105 | fringe width. If a fringe width arg is nil, that means to use the | 6141 | fringe width. If a fringe width arg is nil, that means to use the |
| @@ -6110,7 +6146,7 @@ outside of the display margins. By default, fringes are drawn between | |||
| 6110 | display marginal areas and the text area. */) | 6146 | display marginal areas and the text area. */) |
| 6111 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) | 6147 | (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins) |
| 6112 | { | 6148 | { |
| 6113 | struct window *w = decode_window (window); | 6149 | struct window *w = decode_live_window (window); |
| 6114 | int outside = !NILP (outside_margins); | 6150 | int outside = !NILP (outside_margins); |
| 6115 | 6151 | ||
| 6116 | if (!NILP (left_width)) | 6152 | if (!NILP (left_width)) |
| @@ -6144,11 +6180,12 @@ display marginal areas and the text area. */) | |||
| 6144 | DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, | 6180 | DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, |
| 6145 | 0, 1, 0, | 6181 | 0, 1, 0, |
| 6146 | doc: /* Get width of fringes of window WINDOW. | 6182 | doc: /* Get width of fringes of window WINDOW. |
| 6147 | If WINDOW is omitted or nil, it defaults to the selected window. | 6183 | WINDOW must be a live window and defaults to the selected one. |
| 6184 | |||
| 6148 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) | 6185 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) |
| 6149 | (Lisp_Object window) | 6186 | (Lisp_Object window) |
| 6150 | { | 6187 | { |
| 6151 | struct window *w = decode_window (window); | 6188 | struct window *w = decode_live_window (window); |
| 6152 | 6189 | ||
| 6153 | return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), | 6190 | return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), |
| 6154 | Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), | 6191 | Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), |
| @@ -6165,7 +6202,8 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) | |||
| 6165 | DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars, | 6202 | DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars, |
| 6166 | Sset_window_scroll_bars, 2, 4, 0, | 6203 | Sset_window_scroll_bars, 2, 4, 0, |
| 6167 | doc: /* Set width and type of scroll bars of window WINDOW. | 6204 | doc: /* Set width and type of scroll bars of window WINDOW. |
| 6168 | If window is nil, set scroll bars of the currently selected window. | 6205 | WINDOW must be a live window and defaults to the selected one. |
| 6206 | |||
| 6169 | Second parameter WIDTH specifies the pixel width for the scroll bar; | 6207 | Second parameter WIDTH specifies the pixel width for the scroll bar; |
| 6170 | this is automatically adjusted to a multiple of the frame column width. | 6208 | this is automatically adjusted to a multiple of the frame column width. |
| 6171 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll | 6209 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll |
| @@ -6175,7 +6213,7 @@ If VERTICAL-TYPE is t, use the frame's scroll-bar type. | |||
| 6175 | Fourth parameter HORIZONTAL-TYPE is currently unused. */) | 6213 | Fourth parameter HORIZONTAL-TYPE is currently unused. */) |
| 6176 | (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) | 6214 | (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type) |
| 6177 | { | 6215 | { |
| 6178 | struct window *w = decode_window (window); | 6216 | struct window *w = decode_live_window (window); |
| 6179 | 6217 | ||
| 6180 | if (!NILP (width)) | 6218 | if (!NILP (width)) |
| 6181 | { | 6219 | { |
| @@ -6213,13 +6251,14 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) | |||
| 6213 | DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, | 6251 | DEFUN ("window-scroll-bars", Fwindow_scroll_bars, Swindow_scroll_bars, |
| 6214 | 0, 1, 0, | 6252 | 0, 1, 0, |
| 6215 | doc: /* Get width and type of scroll bars of window WINDOW. | 6253 | doc: /* Get width and type of scroll bars of window WINDOW. |
| 6216 | If WINDOW is omitted or nil, it defaults to the selected window. | 6254 | WINDOW must be a live window and defaults to the selected one. |
| 6255 | |||
| 6217 | Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). | 6256 | Value is a list of the form (WIDTH COLS VERTICAL-TYPE HORIZONTAL-TYPE). |
| 6218 | If WIDTH is nil or TYPE is t, the window is using the frame's corresponding | 6257 | If WIDTH is nil or TYPE is t, the window is using the frame's corresponding |
| 6219 | value. */) | 6258 | value. */) |
| 6220 | (Lisp_Object window) | 6259 | (Lisp_Object window) |
| 6221 | { | 6260 | { |
| 6222 | struct window *w = decode_window (window); | 6261 | struct window *w = decode_live_window (window); |
| 6223 | return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) | 6262 | return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) |
| 6224 | ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) | 6263 | ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) |
| 6225 | : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), | 6264 | : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), |
| @@ -6513,6 +6552,7 @@ syms_of_window (void) | |||
| 6513 | DEFSYM (Qwindowp, "windowp"); | 6552 | DEFSYM (Qwindowp, "windowp"); |
| 6514 | DEFSYM (Qwindow_configuration_p, "window-configuration-p"); | 6553 | DEFSYM (Qwindow_configuration_p, "window-configuration-p"); |
| 6515 | DEFSYM (Qwindow_live_p, "window-live-p"); | 6554 | DEFSYM (Qwindow_live_p, "window-live-p"); |
| 6555 | DEFSYM (Qwindow_valid_p, "window-valid-p"); | ||
| 6516 | DEFSYM (Qwindow_deletable_p, "window-deletable-p"); | 6556 | DEFSYM (Qwindow_deletable_p, "window-deletable-p"); |
| 6517 | DEFSYM (Qdelete_window, "delete-window"); | 6557 | DEFSYM (Qdelete_window, "delete-window"); |
| 6518 | DEFSYM (Qwindow_resize_root_window, "window--resize-root-window"); | 6558 | DEFSYM (Qwindow_resize_root_window, "window--resize-root-window"); |
| @@ -6665,6 +6705,7 @@ respectively are not installed by `window-state-put'. */); | |||
| 6665 | defsubr (&Sminibuffer_window); | 6705 | defsubr (&Sminibuffer_window); |
| 6666 | defsubr (&Swindow_minibuffer_p); | 6706 | defsubr (&Swindow_minibuffer_p); |
| 6667 | defsubr (&Swindowp); | 6707 | defsubr (&Swindowp); |
| 6708 | defsubr (&Swindow_valid_p); | ||
| 6668 | defsubr (&Swindow_live_p); | 6709 | defsubr (&Swindow_live_p); |
| 6669 | defsubr (&Swindow_frame); | 6710 | defsubr (&Swindow_frame); |
| 6670 | defsubr (&Sframe_root_window); | 6711 | defsubr (&Sframe_root_window); |
diff --git a/src/window.h b/src/window.h index 3e6f4f82b0a..77b31dafd8b 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -885,8 +885,15 @@ extern void check_frame_size (struct frame *frame, int *rows, int *cols); | |||
| 885 | 885 | ||
| 886 | struct glyph *get_phys_cursor_glyph (struct window *w); | 886 | struct glyph *get_phys_cursor_glyph (struct window *w); |
| 887 | 887 | ||
| 888 | /* Value is non-zero if WINDOW is a live window. */ | 888 | /* Value is non-zero if WINDOW is a valid window. */ |
| 889 | #define WINDOW_VALID_P(WINDOW) \ | ||
| 890 | (WINDOWP (WINDOW) \ | ||
| 891 | && (!NILP (XWINDOW (WINDOW)->buffer) \ | ||
| 892 | || !NILP (XWINDOW (WINDOW)->vchild) \ | ||
| 893 | || !NILP (XWINDOW (WINDOW)->hchild))) | ||
| 894 | |||
| 889 | 895 | ||
| 896 | /* Value is non-zero if WINDOW is a live window. */ | ||
| 890 | #define WINDOW_LIVE_P(WINDOW) \ | 897 | #define WINDOW_LIVE_P(WINDOW) \ |
| 891 | (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) | 898 | (WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer)) |
| 892 | 899 | ||
| @@ -895,6 +902,8 @@ struct glyph *get_phys_cursor_glyph (struct window *w); | |||
| 895 | extern Lisp_Object Qwindowp, Qwindow_live_p; | 902 | extern Lisp_Object Qwindowp, Qwindow_live_p; |
| 896 | extern Lisp_Object Vwindow_list; | 903 | extern Lisp_Object Vwindow_list; |
| 897 | 904 | ||
| 905 | extern struct window *decode_valid_window (Lisp_Object); | ||
| 906 | extern struct window *decode_live_window (Lisp_Object); | ||
| 898 | extern int compare_window_configurations (Lisp_Object, Lisp_Object, int); | 907 | extern int compare_window_configurations (Lisp_Object, Lisp_Object, int); |
| 899 | extern void mark_window_cursors_off (struct window *); | 908 | extern void mark_window_cursors_off (struct window *); |
| 900 | extern int window_internal_height (struct window *); | 909 | extern int window_internal_height (struct window *); |