Window-related stuff cleanup here and there.
* dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p): Use decode_any_window. * fringe.c (Ffringe_bitmaps_at_pos): Likewise. * xdisp.c (Fformat_mode_line): Likewise. * font.c (Ffont_at): Use decode_live_window. * indent.c (Fcompute_motion, Fvertical_motion): Likewise. * window.c (decode_next_window_args): Likewise. (decode_any_window): Remove static. * window.h (decode_any_window): Add prototype. * lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here... * window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P, respectively.
This commit is contained in:
parent
c574bc3409
commit
b9e9df47f2
9 changed files with 39 additions and 64 deletions
|
@ -1,3 +1,19 @@
|
|||
2012-11-02 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Window-related stuff cleanup here and there.
|
||||
* dispnew.c (Finternal_show_cursor, Finternal_show_cursor_p):
|
||||
Use decode_any_window.
|
||||
* fringe.c (Ffringe_bitmaps_at_pos): Likewise.
|
||||
* xdisp.c (Fformat_mode_line): Likewise.
|
||||
* font.c (Ffont_at): Use decode_live_window.
|
||||
* indent.c (Fcompute_motion, Fvertical_motion): Likewise.
|
||||
* window.c (decode_next_window_args): Likewise.
|
||||
(decode_any_window): Remove static.
|
||||
* window.h (decode_any_window): Add prototype.
|
||||
* lisp.h (CHECK_VALID_WINDOW, CHECK_LIVE_WINDOW): Move from here...
|
||||
* window.h: ...to here, redefine via WINDOW_VALID_P and WINDOW_LIVE_P,
|
||||
respectively.
|
||||
|
||||
2012-11-02 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Remove pad from struct input_event.
|
||||
|
|
|
@ -6375,15 +6375,7 @@ don't show a cursor. */)
|
|||
/* Don't change cursor state while redisplaying. This could confuse
|
||||
output routines. */
|
||||
if (!redisplaying_p)
|
||||
{
|
||||
if (NILP (window))
|
||||
window = selected_window;
|
||||
else
|
||||
CHECK_WINDOW (window);
|
||||
|
||||
XWINDOW (window)->cursor_off_p = NILP (show);
|
||||
}
|
||||
|
||||
decode_any_window (window)->cursor_off_p = NILP (show);
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -6394,15 +6386,7 @@ DEFUN ("internal-show-cursor-p", Finternal_show_cursor_p,
|
|||
WINDOW nil or omitted means report on the selected window. */)
|
||||
(Lisp_Object window)
|
||||
{
|
||||
struct window *w;
|
||||
|
||||
if (NILP (window))
|
||||
window = selected_window;
|
||||
else
|
||||
CHECK_WINDOW (window);
|
||||
|
||||
w = XWINDOW (window);
|
||||
return w->cursor_off_p ? Qnil : Qt;
|
||||
return decode_any_window (window)->cursor_off_p ? Qnil : Qt;
|
||||
}
|
||||
|
||||
DEFUN ("last-nonminibuffer-frame", Flast_nonminibuf_frame,
|
||||
|
|
|
@ -4765,13 +4765,9 @@ Optional third arg STRING, if non-nil, is a string containing the target
|
|||
character at index specified by POSITION. */)
|
||||
(Lisp_Object position, Lisp_Object window, Lisp_Object string)
|
||||
{
|
||||
struct window *w;
|
||||
struct window *w = decode_live_window (window);
|
||||
ptrdiff_t pos;
|
||||
|
||||
if (NILP (window))
|
||||
window = selected_window;
|
||||
CHECK_LIVE_WINDOW (window);
|
||||
w = XWINDOW (window);
|
||||
if (NILP (string))
|
||||
{
|
||||
if (XBUFFER (w->buffer) != current_buffer)
|
||||
|
|
|
@ -1731,10 +1731,8 @@ Return nil if POS is not visible in WINDOW. */)
|
|||
struct glyph_row *row;
|
||||
ptrdiff_t textpos;
|
||||
|
||||
if (NILP (window))
|
||||
window = selected_window;
|
||||
CHECK_WINDOW (window);
|
||||
w = XWINDOW (window);
|
||||
w = decode_any_window (window);
|
||||
XSETWINDOW (window, w);
|
||||
|
||||
if (!NILP (pos))
|
||||
{
|
||||
|
|
15
src/indent.c
15
src/indent.c
|
@ -1764,11 +1764,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
|
|||
else
|
||||
hscroll = tab_offset = 0;
|
||||
|
||||
if (NILP (window))
|
||||
window = Fselected_window ();
|
||||
else
|
||||
CHECK_LIVE_WINDOW (window);
|
||||
w = XWINDOW (window);
|
||||
w = decode_live_window (window);
|
||||
|
||||
if (XINT (from) < BEGV || XINT (from) > ZV)
|
||||
args_out_of_range_3 (from, make_number (BEGV), make_number (ZV));
|
||||
|
@ -1790,8 +1786,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
|
|||
1))
|
||||
: XINT (XCAR (topos))),
|
||||
(NILP (width) ? -1 : XINT (width)),
|
||||
hscroll, tab_offset,
|
||||
XWINDOW (window));
|
||||
hscroll, tab_offset, w);
|
||||
|
||||
XSETFASTINT (bufpos, pos->bufpos);
|
||||
XSETINT (hpos, pos->hpos);
|
||||
|
@ -1988,11 +1983,7 @@ whether or not it is currently displayed in some window. */)
|
|||
}
|
||||
|
||||
CHECK_NUMBER (lines);
|
||||
if (! NILP (window))
|
||||
CHECK_WINDOW (window);
|
||||
else
|
||||
window = selected_window;
|
||||
w = XWINDOW (window);
|
||||
w = decode_live_window (window);
|
||||
|
||||
old_buffer = Qnil;
|
||||
GCPRO3 (old_buffer, old_charpos, old_bytepos);
|
||||
|
|
14
src/lisp.h
14
src/lisp.h
|
@ -1791,20 +1791,6 @@ typedef struct {
|
|||
#define CHECK_WINDOW_CONFIGURATION(x) \
|
||||
CHECK_TYPE (WINDOW_CONFIGURATIONP (x), Qwindow_configuration_p, x)
|
||||
|
||||
/* 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) \
|
||||
CHECK_TYPE (PROCESSP (x), Qprocessp, x)
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ decode_live_window (register Lisp_Object window)
|
|||
return XWINDOW (window);
|
||||
}
|
||||
|
||||
static struct window *
|
||||
struct window *
|
||||
decode_any_window (register Lisp_Object window)
|
||||
{
|
||||
struct window *w;
|
||||
|
@ -2252,10 +2252,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
|
|||
static void
|
||||
decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames)
|
||||
{
|
||||
if (NILP (*window))
|
||||
*window = selected_window;
|
||||
else
|
||||
CHECK_LIVE_WINDOW (*window);
|
||||
struct window *w = decode_live_window (*window);
|
||||
|
||||
/* MINIBUF nil may or may not include minibuffers. Decide if it
|
||||
does. */
|
||||
|
@ -2272,7 +2269,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
|
|||
if (NILP (*all_frames))
|
||||
*all_frames
|
||||
= (!EQ (*minibuf, Qlambda)
|
||||
? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame))
|
||||
? FRAME_MINIBUF_WINDOW (XFRAME (w->frame))
|
||||
: Qnil);
|
||||
else if (EQ (*all_frames, Qvisible))
|
||||
;
|
||||
|
|
|
@ -970,17 +970,26 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
|
|||
|| !NILP (XWINDOW (WINDOW)->vchild) \
|
||||
|| !NILP (XWINDOW (WINDOW)->hchild)))
|
||||
|
||||
/* 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(WINDOW) \
|
||||
CHECK_TYPE (WINDOW_VALID_P (WINDOW), Qwindow_valid_p, WINDOW)
|
||||
|
||||
/* Value is non-zero if WINDOW is a live window. */
|
||||
#define WINDOW_LIVE_P(WINDOW) \
|
||||
(WINDOWP (WINDOW) && !NILP (XWINDOW (WINDOW)->buffer))
|
||||
|
||||
/* A window is "live" if and only if it shows a buffer. */
|
||||
#define CHECK_LIVE_WINDOW(WINDOW) \
|
||||
CHECK_TYPE (WINDOW_LIVE_P (WINDOW), Qwindow_live_p, WINDOW)
|
||||
|
||||
/* These used to be in lisp.h. */
|
||||
|
||||
extern Lisp_Object Qwindowp, Qwindow_live_p;
|
||||
extern Lisp_Object Vwindow_list;
|
||||
|
||||
extern struct window *decode_live_window (Lisp_Object);
|
||||
extern struct window *decode_any_window (Lisp_Object);
|
||||
extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);
|
||||
extern void mark_window_cursors_off (struct window *);
|
||||
extern int window_internal_height (struct window *);
|
||||
|
|
|
@ -21018,10 +21018,8 @@ are the selected window and the WINDOW's buffer). */)
|
|||
Lisp_Object str;
|
||||
int string_start = 0;
|
||||
|
||||
if (NILP (window))
|
||||
window = selected_window;
|
||||
CHECK_WINDOW (window);
|
||||
w = XWINDOW (window);
|
||||
w = decode_any_window (window);
|
||||
XSETWINDOW (window, w);
|
||||
|
||||
if (NILP (buffer))
|
||||
buffer = w->buffer;
|
||||
|
@ -21050,7 +21048,7 @@ are the selected window and the WINDOW's buffer). */)
|
|||
and set that to nil so that we don't alter the outer value. */
|
||||
record_unwind_protect (unwind_format_mode_line,
|
||||
format_mode_line_unwind_data
|
||||
(XFRAME (WINDOW_FRAME (XWINDOW (window))),
|
||||
(XFRAME (WINDOW_FRAME (w)),
|
||||
old_buffer, selected_window, 1));
|
||||
mode_line_proptrans_alist = Qnil;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue