Mercurial > emacs
comparison src/window.c @ 112425:9f7614f1a892
Merge from emacs-23
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 22 Jan 2011 11:36:45 -0800 |
parents | 7b02a85cde75 550574f08669 |
children |
comparison
equal
deleted
inserted
replaced
112416:f792eb37d0ca | 112425:9f7614f1a892 |
---|---|
77 static Lisp_Object next_window (Lisp_Object, Lisp_Object, | 77 static Lisp_Object next_window (Lisp_Object, Lisp_Object, |
78 Lisp_Object, int); | 78 Lisp_Object, int); |
79 static void decode_next_window_args (Lisp_Object *, Lisp_Object *, | 79 static void decode_next_window_args (Lisp_Object *, Lisp_Object *, |
80 Lisp_Object *); | 80 Lisp_Object *); |
81 static void foreach_window (struct frame *, | 81 static void foreach_window (struct frame *, |
82 int (* fn) (struct window *, void *), | 82 int (* fn) (struct window *, void *), |
83 void *); | 83 void *); |
84 static int foreach_window_1 (struct window *, | 84 static int foreach_window_1 (struct window *, |
85 int (* fn) (struct window *, void *), | 85 int (* fn) (struct window *, void *), |
86 void *); | 86 void *); |
87 static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); | 87 static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); |
88 static Lisp_Object select_window (Lisp_Object, Lisp_Object, int); | |
88 | 89 |
89 /* This is the window in which the terminal's cursor should | 90 /* This is the window in which the terminal's cursor should |
90 be left when nothing is being done with it. This must | 91 be left when nothing is being done with it. This must |
91 always be a leaf window, and its buffer is selected by | 92 always be a leaf window, and its buffer is selected by |
92 the top level editing loop at the end of each command. | 93 the top level editing loop at the end of each command. |
123 static int sequence_number; | 124 static int sequence_number; |
124 | 125 |
125 /* Nonzero after init_window_once has finished. */ | 126 /* Nonzero after init_window_once has finished. */ |
126 | 127 |
127 static int window_initialized; | 128 static int window_initialized; |
128 | |
129 /* Set in `set-window-configuration' to prevent "swapping out point" | |
130 in the old selected window. */ | |
131 | |
132 static int inhibit_point_swap; | |
133 | 129 |
134 /* Hook to run when window config changes. */ | 130 /* Hook to run when window config changes. */ |
135 | 131 |
136 static Lisp_Object Qwindow_configuration_change_hook; | 132 static Lisp_Object Qwindow_configuration_change_hook; |
137 /* Incremented by 1 whenever a window is deleted. */ | 133 /* Incremented by 1 whenever a window is deleted. */ |
3495 | 3491 |
3496 set_window_buffer (window, buffer, 1, !NILP (keep_margins)); | 3492 set_window_buffer (window, buffer, 1, !NILP (keep_margins)); |
3497 return Qnil; | 3493 return Qnil; |
3498 } | 3494 } |
3499 | 3495 |
3500 /* Note that selected_window can be nil when this is called from | 3496 /* If select_window is called with inhibit_point_swap non-zero it will |
3501 Fset_window_configuration. */ | 3497 not store point of the old selected window's buffer back into that |
3502 | 3498 window's pointm slot. This is needed by Fset_window_configuration to |
3503 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, | 3499 avoid that the display routine is called with selected_window set to |
3504 doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. | 3500 Qnil causing a subsequent crash. */ |
3505 If WINDOW is not already selected, make WINDOW's buffer current | 3501 |
3506 and make WINDOW the frame's selected window. Return WINDOW. | 3502 static Lisp_Object |
3507 Optional second arg NORECORD non-nil means do not put this buffer | 3503 select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) |
3508 at the front of the list of recently selected ones and do not | |
3509 make this window the most recently selected one. | |
3510 | |
3511 Note that the main editor command loop selects the buffer of the | |
3512 selected window before each command. */) | |
3513 (register Lisp_Object window, Lisp_Object norecord) | |
3514 { | 3504 { |
3515 register struct window *w; | 3505 register struct window *w; |
3516 register struct window *ow; | 3506 register struct window *ow; |
3517 struct frame *sf; | 3507 struct frame *sf; |
3518 | 3508 |
3548 sf->selected_window = window; | 3538 sf->selected_window = window; |
3549 | 3539 |
3550 /* Store the current buffer's actual point into the | 3540 /* Store the current buffer's actual point into the |
3551 old selected window. It belongs to that window, | 3541 old selected window. It belongs to that window, |
3552 and when the window is not selected, must be in the window. */ | 3542 and when the window is not selected, must be in the window. */ |
3553 if (inhibit_point_swap) | 3543 if (!inhibit_point_swap) |
3554 inhibit_point_swap = 0; | |
3555 else | |
3556 { | 3544 { |
3557 ow = XWINDOW (selected_window); | 3545 ow = XWINDOW (selected_window); |
3558 if (! NILP (ow->buffer)) | 3546 if (! NILP (ow->buffer)) |
3559 set_marker_both (ow->pointm, ow->buffer, | 3547 set_marker_both (ow->pointm, ow->buffer, |
3560 BUF_PT (XBUFFER (ow->buffer)), | 3548 BUF_PT (XBUFFER (ow->buffer)), |
3582 SET_PT (new_point); | 3570 SET_PT (new_point); |
3583 } | 3571 } |
3584 | 3572 |
3585 windows_or_buffers_changed++; | 3573 windows_or_buffers_changed++; |
3586 return window; | 3574 return window; |
3575 } | |
3576 | |
3577 | |
3578 /* Note that selected_window can be nil when this is called from | |
3579 Fset_window_configuration. */ | |
3580 | |
3581 DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, | |
3582 doc: /* Select WINDOW. Most editing will apply to WINDOW's buffer. | |
3583 If WINDOW is not already selected, make WINDOW's buffer current | |
3584 and make WINDOW the frame's selected window. Return WINDOW. | |
3585 Optional second arg NORECORD non-nil means do not put this buffer | |
3586 at the front of the list of recently selected ones and do not | |
3587 make this window the most recently selected one. | |
3588 | |
3589 Note that the main editor command loop selects the buffer of the | |
3590 selected window before each command. */) | |
3591 (register Lisp_Object window, Lisp_Object norecord) | |
3592 { | |
3593 select_window (window, norecord, 0); | |
3587 } | 3594 } |
3588 | 3595 |
3589 static Lisp_Object | 3596 static Lisp_Object |
3590 select_window_norecord (Lisp_Object window) | 3597 select_window_norecord (Lisp_Object window) |
3591 { | 3598 { |
6112 | 6119 |
6113 /* In the following call to `select-window, prevent "swapping | 6120 /* In the following call to `select-window, prevent "swapping |
6114 out point" in the old selected window using the buffer that | 6121 out point" in the old selected window using the buffer that |
6115 has been restored into it. We already swapped out that point | 6122 has been restored into it. We already swapped out that point |
6116 from that window's old buffer. */ | 6123 from that window's old buffer. */ |
6117 inhibit_point_swap = 1; | 6124 select_window (data->current_window, Qnil, 1); |
6118 Fselect_window (data->current_window, Qnil); | |
6119 XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window | 6125 XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window |
6120 = selected_window; | 6126 = selected_window; |
6121 | 6127 |
6122 if (NILP (data->focus_frame) | 6128 if (NILP (data->focus_frame) |
6123 || (FRAMEP (data->focus_frame) | 6129 || (FRAMEP (data->focus_frame) |
7043 | 7049 |
7044 window_scroll_pixel_based_preserve_x = -1; | 7050 window_scroll_pixel_based_preserve_x = -1; |
7045 window_scroll_pixel_based_preserve_y = -1; | 7051 window_scroll_pixel_based_preserve_y = -1; |
7046 window_scroll_preserve_hpos = -1; | 7052 window_scroll_preserve_hpos = -1; |
7047 window_scroll_preserve_vpos = -1; | 7053 window_scroll_preserve_vpos = -1; |
7048 | |
7049 inhibit_point_swap = 0; | |
7050 | 7054 |
7051 DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function, | 7055 DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function, |
7052 doc: /* Non-nil means call as function to display a help buffer. | 7056 doc: /* Non-nil means call as function to display a help buffer. |
7053 The function is called with one argument, the buffer to be displayed. | 7057 The function is called with one argument, the buffer to be displayed. |
7054 Used by `with-output-to-temp-buffer'. | 7058 Used by `with-output-to-temp-buffer'. |