Commit 52162052 authored by Martin Rudalics's avatar Martin Rudalics

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.
parent 2751c80f
2012-08-16 Martin Rudalics <rudalics@gmx.at>
* window.el (window-valid-p): Move to window.c.
2012-08-16 Phil Sainty <psainty@orcon.net.nz> (tiny change)
* progmodes/subword.el (subword-forward-function)
......
......@@ -110,14 +110,6 @@ be any window."
(setq window (window-next-sibling window))))
window)
(defun window-valid-p (object)
"Return t if OBJECT denotes a live window or internal window.
Otherwise, return nil; this includes the case where OBJECT is a
deleted window."
(and (windowp object)
(or (window-buffer object) (window-child object))
t))
(defun window-normalize-buffer (buffer-or-name)
"Return buffer specified by BUFFER-OR-NAME.
BUFFER-OR-NAME must be either a buffer or a string naming a live
......
2012-08-16 Martin Rudalics <rudalics@gmx.at>
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.
2012-08-16 Dmitry Antipov <dmantipov@yandex.ru>
Fix previous char table change.
......
......@@ -11200,11 +11200,8 @@ The `posn-' functions access elements of such lists. */)
if (WINDOWP (frame_or_window))
{
struct window *w;
struct window *w = decode_valid_window (frame_or_window);
CHECK_LIVE_WINDOW (frame_or_window);
w = XWINDOW (frame_or_window);
XSETINT (x, (XINT (x)
+ WINDOW_LEFT_EDGE_X (w)
+ (NILP (whole)
......
......@@ -1758,15 +1758,18 @@ typedef struct {
#define CHECK_WINDOW_CONFIGURATION(x) \
CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
/* This macro rejects windows on the interior of the window tree as
"dead", which is what we want; this is an argument-checking macro, and
the user should never get access to interior windows.
A window of any sort, leaf or interior, is dead if the buffer,
vchild, and hchild members are all nil. */
#define CHECK_LIVE_WINDOW(x) \
CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \
/* A window of any sort, leaf or interior, is "valid" if one of its
buffer, vchild, or hchild members is non-nil. */
#define CHECK_VALID_WINDOW(x) \
CHECK_TYPE (WINDOWP (x) \
&& (!NILP (XWINDOW (x)->buffer) \
|| !NILP (XWINDOW (x)->vchild) \
|| !NILP (XWINDOW (x)->hchild)), \
Qwindow_valid_p, x)
/* A window is "live" if and only if it shows a buffer. */
#define CHECK_LIVE_WINDOW(x) \
CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), \
Qwindow_live_p, x)
#define CHECK_PROCESS(x) \
......
This diff is collapsed.
......@@ -885,8 +885,15 @@ extern void check_frame_size (struct frame *frame, int *rows, int *cols);
struct glyph *get_phys_cursor_glyph (struct window *w);
/* Value is non-zero if WINDOW is a live window. */
/* Value is non-zero if WINDOW is a valid window. */
#define WINDOW_VALID_P(WINDOW) \
(WINDOWP (WINDOW) \
&& (!NILP (XWINDOW (WINDOW)->buffer) \
|| !NILP (XWINDOW (WINDOW)->vchild) \
|| !NILP (XWINDOW (WINDOW)->hchild)))
/* Value is non-zero if WINDOW is a live window. */
#define WINDOW_LIVE_P(WINDOW) \
(WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer))
......@@ -895,6 +902,8 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
extern Lisp_Object Qwindowp, Qwindow_live_p;
extern Lisp_Object Vwindow_list;
extern struct window *decode_valid_window (Lisp_Object);
extern struct window *decode_live_window (Lisp_Object);
extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
extern void mark_window_cursors_off (struct window *);
extern int window_internal_height (struct window *);
......
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