Mercurial > hg > xemacs-beta
comparison src/window.c @ 280:7df0dd720c89 r21-0b38
Import from CVS: tag r21-0b38
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:32:22 +0200 |
parents | 6330739388db |
children | c42ec1d1cded |
comparison
equal
deleted
inserted
replaced
279:c20b2fb5bb0a | 280:7df0dd720c89 |
---|---|
1369 Return the number of columns by which WINDOW's modeline is scrolled from | 1369 Return the number of columns by which WINDOW's modeline is scrolled from |
1370 left margin. If the window has no modeline, return nil. | 1370 left margin. If the window has no modeline, return nil. |
1371 */ | 1371 */ |
1372 (window)) | 1372 (window)) |
1373 { | 1373 { |
1374 struct window *w; | 1374 struct window *w = decode_window (window); |
1375 | 1375 |
1376 w = decode_window (window); | |
1377 return (WINDOW_HAS_MODELINE_P (w)) ? make_int (w->modeline_hscroll) : Qnil; | 1376 return (WINDOW_HAS_MODELINE_P (w)) ? make_int (w->modeline_hscroll) : Qnil; |
1378 } | 1377 } |
1379 | 1378 |
1380 DEFUN ("set-modeline-hscroll", Fset_modeline_hscroll, 2, 2, 0, /* | 1379 DEFUN ("set-modeline-hscroll", Fset_modeline_hscroll, 2, 2, 0, /* |
1381 Set number of columns WINDOW's modeline is scrolled from left margin to NCOL. | 1380 Set number of columns WINDOW's modeline is scrolled from left margin to NCOL. |
1382 NCOL should be zero or positive. If NCOL is negative, it will be forced to 0. | 1381 NCOL should be zero or positive. If NCOL is negative, it will be forced to 0. |
1383 If the window has no modeline, do nothing and return nil. | 1382 If the window has no modeline, do nothing and return nil. |
1384 */ | 1383 */ |
1385 (window, ncol)) | 1384 (window, ncol)) |
1386 { | 1385 { |
1387 struct window *w; | 1386 struct window *w = decode_window (window); |
1388 int ncols; | 1387 |
1389 | |
1390 w = decode_window (window); | |
1391 if (WINDOW_HAS_MODELINE_P (w)) | 1388 if (WINDOW_HAS_MODELINE_P (w)) |
1392 { | 1389 { |
1390 int ncols; | |
1393 CHECK_INT (ncol); | 1391 CHECK_INT (ncol); |
1394 ncols = XINT (ncol); | 1392 ncols = XINT (ncol); |
1395 if (ncols < 0) ncols = 0; | 1393 if (ncols < 0) ncols = 0; |
1396 if (w->modeline_hscroll != ncols) | 1394 if (w->modeline_hscroll != ncols) |
1397 MARK_MODELINE_CHANGED; | 1395 MARK_MODELINE_CHANGED; |
1534 { | 1532 { |
1535 struct window *w = decode_window (window); | 1533 struct window *w = decode_window (window); |
1536 | 1534 |
1537 if (NILP (guarantee)) | 1535 if (NILP (guarantee)) |
1538 { | 1536 { |
1539 Lisp_Object buf = w->buffer; | 1537 Lisp_Object buf; |
1538 buf = w->buffer; | |
1540 CHECK_BUFFER (buf); | 1539 CHECK_BUFFER (buf); |
1541 return make_int (BUF_Z (XBUFFER (buf)) - w->window_end_pos[CURRENT_DISP]); | 1540 return make_int (BUF_Z (XBUFFER (buf)) - w->window_end_pos[CURRENT_DISP]); |
1542 } | 1541 } |
1543 else | 1542 else |
1544 { | 1543 { |
2749 | 2748 |
2750 /* These functions used to be `buffer-left-margin-pixel-width', etc. | 2749 /* These functions used to be `buffer-left-margin-pixel-width', etc. |
2751 but there is no sensible way to implement those functions, since | 2750 but there is no sensible way to implement those functions, since |
2752 you can't in general derive a window from a buffer. */ | 2751 you can't in general derive a window from a buffer. */ |
2753 | 2752 |
2754 DEFUN ("window-left-margin-pixel-width", | 2753 DEFUN ("window-left-margin-pixel-width", Fwindow_left_margin_pixel_width, |
2755 Fwindow_left_margin_pixel_width, 0, 1, 0, /* | 2754 0, 1, 0, /* |
2756 Return the width in pixels of the left outside margin of window WINDOW. | 2755 Return the width in pixels of the left outside margin of window WINDOW. |
2757 If WINDOW is nil, the selected window is assumed. | 2756 If WINDOW is nil, the selected window is assumed. |
2758 */ | 2757 */ |
2759 (window)) | 2758 (window)) |
2760 { | 2759 { |
2761 return make_int (window_left_margin_width (decode_window (window))); | 2760 return make_int (window_left_margin_width (decode_window (window))); |
2762 } | 2761 } |
2763 | 2762 |
2764 DEFUN ("window-right-margin-pixel-width", | 2763 DEFUN ("window-right-margin-pixel-width", Fwindow_right_margin_pixel_width, |
2765 Fwindow_right_margin_pixel_width, 0, 1, 0, /* | 2764 0, 1, 0, /* |
2766 Return the width in pixels of the right outside margin of window WINDOW. | 2765 Return the width in pixels of the right outside margin of window WINDOW. |
2767 If WINDOW is nil, the selected window is assumed. | 2766 If WINDOW is nil, the selected window is assumed. |
2768 */ | 2767 */ |
2769 (window)) | 2768 (window)) |
2770 { | 2769 { |
4185 else | 4184 else |
4186 arg = Fprefix_numeric_value (arg); | 4185 arg = Fprefix_numeric_value (arg); |
4187 | 4186 |
4188 return Fset_window_hscroll (window, make_int (w->hscroll - XINT (arg))); | 4187 return Fset_window_hscroll (window, make_int (w->hscroll - XINT (arg))); |
4189 } | 4188 } |
4190 | 4189 |
4191 DEFUN ("recenter", Frecenter, 0, 2, "_P", /* | 4190 DEFUN ("center-to-window-line", Fcenter_to_window_line, 0, 2, "_P", /* |
4192 Center point in WINDOW and redisplay frame. With N, put point on line N. | 4191 Center point in WINDOW. With N, put point on line N. |
4193 The desired position of point is always relative to the window. | 4192 The desired position of point is always relative to the window. |
4194 Just C-u as prefix means put point in the center of the window. | |
4195 No N (i.e., it is nil) erases the entire frame and then | |
4196 redraws with point in the center of the window. | |
4197 If WINDOW is nil, the selected window is used. | 4193 If WINDOW is nil, the selected window is used. |
4198 */ | 4194 */ |
4199 (n, window)) | 4195 (n, window)) |
4200 { | 4196 { |
4201 struct window *w; | 4197 struct window *w = decode_window (window); |
4202 struct buffer *b; | 4198 struct buffer *b = XBUFFER (w->buffer); |
4199 Bufpos opoint = BUF_PT (b); | |
4203 Bufpos startp; | 4200 Bufpos startp; |
4204 Bufpos opoint; | 4201 |
4205 | 4202 if (NILP (n)) |
4206 if (NILP (window)) | 4203 startp = start_with_line_at_pixpos (w, opoint, window_half_pixpos (w)); |
4207 window = Fselected_window (Qnil); | |
4208 else | |
4209 CHECK_WINDOW (window); | |
4210 w = XWINDOW (window); | |
4211 b = XBUFFER (w->buffer); | |
4212 | |
4213 opoint = BUF_PT (b); | |
4214 | |
4215 if (LISTP (n)) | |
4216 { | |
4217 struct frame *f = XFRAME (w->frame); | |
4218 | |
4219 if (NILP (n)) | |
4220 { | |
4221 MARK_FRAME_CHANGED (f); | |
4222 SET_FRAME_CLEAR (f); | |
4223 } | |
4224 | |
4225 startp = start_with_line_at_pixpos (w, opoint, window_half_pixpos (w)); | |
4226 } | |
4227 else | 4204 else |
4228 { | 4205 { |
4229 n = Fprefix_numeric_value (n); | 4206 n = Fprefix_numeric_value (n); |
4230 CHECK_INT (n); | 4207 CHECK_INT (n); |
4231 | |
4232 startp = start_with_point_on_display_line (w, opoint, XINT (n)); | 4208 startp = start_with_point_on_display_line (w, opoint, XINT (n)); |
4233 } | 4209 } |
4234 | 4210 |
4235 Fset_marker (w->start[CURRENT_DISP], make_int (startp), w->buffer); | 4211 Fset_marker (w->start[CURRENT_DISP], make_int (startp), w->buffer); |
4236 | 4212 |
4237 w->start_at_line_beg = beginning_of_line_p (b, startp); | 4213 w->start_at_line_beg = beginning_of_line_p (b, startp); |
4238 w->force_start = 1; | 4214 w->force_start = 1; |
4239 MARK_WINDOWS_CHANGED (w); | 4215 MARK_WINDOWS_CHANGED (w); |
4240 return Qnil; | 4216 return Qnil; |
4241 } | 4217 } |
4242 | 4218 |
4243 DEFUN ("move-to-window-line", Fmove_to_window_line, 1, 2, "_P", /* | 4219 DEFUN ("move-to-window-line", Fmove_to_window_line, 1, 2, "_P", /* |
4244 Position point relative to WINDOW. | 4220 Position point relative to WINDOW. |
4245 With no argument, position text at center of window. | 4221 With no argument, position text at center of window. |
4246 An argument specifies window line; zero means top of window, | 4222 An argument specifies window line; zero means top of window, |
4247 negative means relative to bottom of window. | 4223 negative means relative to bottom of window. |
4253 struct buffer *b; | 4229 struct buffer *b; |
4254 int height; | 4230 int height; |
4255 Bufpos start, new_point; | 4231 Bufpos start, new_point; |
4256 int selected; | 4232 int selected; |
4257 | 4233 |
4234 /* Don't use decode_window() because we need the new value of | |
4235 WINDOW. */ | |
4258 if (NILP (window)) | 4236 if (NILP (window)) |
4259 window = Fselected_window (Qnil); | 4237 window = Fselected_window (Qnil); |
4260 else | 4238 else |
4261 CHECK_WINDOW (window); | 4239 CHECK_WINDOW (window); |
4262 w = XWINDOW (window); | 4240 w = XWINDOW (window); |
5566 DEFSUBR (Fscroll_down); | 5544 DEFSUBR (Fscroll_down); |
5567 DEFSUBR (Fscroll_left); | 5545 DEFSUBR (Fscroll_left); |
5568 DEFSUBR (Fscroll_right); | 5546 DEFSUBR (Fscroll_right); |
5569 DEFSUBR (Fother_window_for_scrolling); | 5547 DEFSUBR (Fother_window_for_scrolling); |
5570 DEFSUBR (Fscroll_other_window); | 5548 DEFSUBR (Fscroll_other_window); |
5571 DEFSUBR (Frecenter); | 5549 DEFSUBR (Fcenter_to_window_line); |
5572 DEFSUBR (Fmove_to_window_line); | 5550 DEFSUBR (Fmove_to_window_line); |
5573 #ifdef MEMORY_USAGE_STATS | 5551 #ifdef MEMORY_USAGE_STATS |
5574 DEFSUBR (Fwindow_memory_usage); | 5552 DEFSUBR (Fwindow_memory_usage); |
5575 #endif | 5553 #endif |
5576 DEFSUBR (Fwindow_configuration_p); | 5554 DEFSUBR (Fwindow_configuration_p); |