diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 111 |
1 files changed, 104 insertions, 7 deletions
diff --git a/src/window.c b/src/window.c index 4559734cc8e..3ee731e60bf 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -59,7 +59,7 @@ static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; | |||
| 59 | static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; | 59 | static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; |
| 60 | static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; | 60 | static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; |
| 61 | static Lisp_Object Qsafe, Qabove, Qbelow; | 61 | static Lisp_Object Qsafe, Qabove, Qbelow; |
| 62 | static Lisp_Object Qauto_buffer_name; | 62 | static Lisp_Object Qauto_buffer_name, Qclone_of, Qstate; |
| 63 | 63 | ||
| 64 | static int displayed_window_lines (struct window *); | 64 | static int displayed_window_lines (struct window *); |
| 65 | static struct window *decode_window (Lisp_Object); | 65 | static struct window *decode_window (Lisp_Object); |
| @@ -5415,6 +5415,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5415 | { | 5415 | { |
| 5416 | Lisp_Object window; | 5416 | Lisp_Object window; |
| 5417 | Lisp_Object dead_windows = Qnil; | 5417 | Lisp_Object dead_windows = Qnil; |
| 5418 | register Lisp_Object tem, par, pers; | ||
| 5418 | register struct window *w; | 5419 | register struct window *w; |
| 5419 | register struct saved_window *p; | 5420 | register struct saved_window *p; |
| 5420 | struct window *root_window; | 5421 | struct window *root_window; |
| @@ -5548,7 +5549,28 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5548 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; | 5549 | w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; |
| 5549 | w->dedicated = p->dedicated; | 5550 | w->dedicated = p->dedicated; |
| 5550 | w->combination_limit = p->combination_limit; | 5551 | w->combination_limit = p->combination_limit; |
| 5551 | w->window_parameters = p->window_parameters; | 5552 | /* Restore any window parameters that have been saved. |
| 5553 | Parameters that have not been saved are left alone. */ | ||
| 5554 | for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) | ||
| 5555 | { | ||
| 5556 | pers = XCAR (tem); | ||
| 5557 | if (CONSP (pers)) | ||
| 5558 | { | ||
| 5559 | if (NILP (XCDR (pers))) | ||
| 5560 | { | ||
| 5561 | par = Fassq (XCAR (pers), w->window_parameters); | ||
| 5562 | if (CONSP (par) && !NILP (XCDR (par))) | ||
| 5563 | /* Reset a parameter to nil if and only if it | ||
| 5564 | has a non-nil association. Don't make new | ||
| 5565 | associations. */ | ||
| 5566 | Fsetcdr (par, Qnil); | ||
| 5567 | } | ||
| 5568 | else | ||
| 5569 | /* Always restore a non-nil value. */ | ||
| 5570 | Fset_window_parameter (window, XCAR (pers), XCDR (pers)); | ||
| 5571 | } | ||
| 5572 | } | ||
| 5573 | |||
| 5552 | XSETFASTINT (w->last_modified, 0); | 5574 | XSETFASTINT (w->last_modified, 0); |
| 5553 | XSETFASTINT (w->last_overlay_modified, 0); | 5575 | XSETFASTINT (w->last_overlay_modified, 0); |
| 5554 | 5576 | ||
| @@ -5815,7 +5837,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 5815 | { | 5837 | { |
| 5816 | register struct saved_window *p; | 5838 | register struct saved_window *p; |
| 5817 | register struct window *w; | 5839 | register struct window *w; |
| 5818 | register Lisp_Object tem; | 5840 | register Lisp_Object tem, pers, par; |
| 5819 | 5841 | ||
| 5820 | for (;!NILP (window); window = w->next) | 5842 | for (;!NILP (window); window = w->next) |
| 5821 | { | 5843 | { |
| @@ -5843,12 +5865,60 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | |||
| 5843 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; | 5865 | p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; |
| 5844 | p->dedicated = w->dedicated; | 5866 | p->dedicated = w->dedicated; |
| 5845 | p->combination_limit = w->combination_limit; | 5867 | p->combination_limit = w->combination_limit; |
| 5846 | p->window_parameters = w->window_parameters; | 5868 | p->window_parameters = Qnil; |
| 5869 | |||
| 5870 | if (!NILP (Vwindow_persistent_parameters)) | ||
| 5871 | { | ||
| 5872 | /* Run cycle detection on Vwindow_persistent_parameters. */ | ||
| 5873 | Lisp_Object tortoise, hare; | ||
| 5874 | |||
| 5875 | hare = tortoise = Vwindow_persistent_parameters; | ||
| 5876 | while (CONSP (hare)) | ||
| 5877 | { | ||
| 5878 | hare = XCDR (hare); | ||
| 5879 | if (!CONSP (hare)) | ||
| 5880 | break; | ||
| 5881 | |||
| 5882 | hare = XCDR (hare); | ||
| 5883 | tortoise = XCDR (tortoise); | ||
| 5884 | |||
| 5885 | if (EQ (hare, tortoise)) | ||
| 5886 | /* Reset Vwindow_persistent_parameters to Qnil. */ | ||
| 5887 | { | ||
| 5888 | Vwindow_persistent_parameters = Qnil; | ||
| 5889 | break; | ||
| 5890 | } | ||
| 5891 | } | ||
| 5892 | |||
| 5893 | for (tem = Vwindow_persistent_parameters; CONSP (tem); | ||
| 5894 | tem = XCDR (tem)) | ||
| 5895 | { | ||
| 5896 | pers = XCAR (tem); | ||
| 5897 | /* Save values for persistent window parameters whose cdr | ||
| 5898 | is either nil or t. */ | ||
| 5899 | if (CONSP (pers) && (NILP (XCDR (pers)) || EQ (XCDR (pers), Qt))) | ||
| 5900 | { | ||
| 5901 | par = Fassq (XCAR (pers), w->window_parameters); | ||
| 5902 | if (NILP (par)) | ||
| 5903 | /* If the window has no value for the parameter, | ||
| 5904 | make one. */ | ||
| 5905 | p->window_parameters = Fcons (Fcons (XCAR (pers), Qnil), | ||
| 5906 | p->window_parameters); | ||
| 5907 | else | ||
| 5908 | /* If the window has a value for the parameter, | ||
| 5909 | save it. */ | ||
| 5910 | p->window_parameters = Fcons (Fcons (XCAR (par), | ||
| 5911 | XCDR (par)), | ||
| 5912 | p->window_parameters); | ||
| 5913 | } | ||
| 5914 | } | ||
| 5915 | } | ||
| 5916 | |||
| 5847 | if (!NILP (w->buffer)) | 5917 | if (!NILP (w->buffer)) |
| 5848 | { | 5918 | { |
| 5849 | /* Save w's value of point in the window configuration. | 5919 | /* Save w's value of point in the window configuration. If w |
| 5850 | If w is the selected window, then get the value of point | 5920 | is the selected window, then get the value of point from |
| 5851 | from the buffer; pointm is garbage in the selected window. */ | 5921 | the buffer; pointm is garbage in the selected window. */ |
| 5852 | if (EQ (window, selected_window)) | 5922 | if (EQ (window, selected_window)) |
| 5853 | { | 5923 | { |
| 5854 | p->pointm = Fmake_marker (); | 5924 | p->pointm = Fmake_marker (); |
| @@ -6438,6 +6508,8 @@ syms_of_window (void) | |||
| 6438 | DEFSYM (Qabove, "above"); | 6508 | DEFSYM (Qabove, "above"); |
| 6439 | DEFSYM (Qbelow, "below"); | 6509 | DEFSYM (Qbelow, "below"); |
| 6440 | DEFSYM (Qauto_buffer_name, "auto-buffer-name"); | 6510 | DEFSYM (Qauto_buffer_name, "auto-buffer-name"); |
| 6511 | DEFSYM (Qclone_of, "clone-of"); | ||
| 6512 | DEFSYM (Qstate, "state"); | ||
| 6441 | 6513 | ||
| 6442 | staticpro (&Vwindow_list); | 6514 | staticpro (&Vwindow_list); |
| 6443 | 6515 | ||
| @@ -6547,6 +6619,31 @@ retrieved via the function `window-combination-limit' and altered by the | |||
| 6547 | function `set-window-combination-limit'. */); | 6619 | function `set-window-combination-limit'. */); |
| 6548 | Vwindow_combination_limit = Qnil; | 6620 | Vwindow_combination_limit = Qnil; |
| 6549 | 6621 | ||
| 6622 | DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters, | ||
| 6623 | doc: /* Alist of persistent window parameters. | ||
| 6624 | Parameters in this list are saved by `current-window-configuration' and | ||
| 6625 | `window-state-get' and subsequently restored to their previous values by | ||
| 6626 | `set-window-configuration' and `window-state-put'. | ||
| 6627 | |||
| 6628 | The car of each entry of this alist is the symbol specifying the | ||
| 6629 | parameter. The cdr is one of the following: | ||
| 6630 | |||
| 6631 | The symbol `state' means the parameter is saved by `window-state-get' | ||
| 6632 | provided its IGNORE argument is nil. `current-window-configuration' | ||
| 6633 | does not save this parameter. | ||
| 6634 | |||
| 6635 | nil means the parameter is saved by `current-window-configuration' and, | ||
| 6636 | provided its IGNORE argument is nil, by `window-state-get'. | ||
| 6637 | |||
| 6638 | t means the parameter is saved unconditionally by both | ||
| 6639 | `current-window-configuration' and `window-state-get'. Parameters | ||
| 6640 | without read syntax (like windows or frames) should not use that. | ||
| 6641 | |||
| 6642 | Parameters not saved by `current-window-configuration' or | ||
| 6643 | `window-state-get' are left alone by `set-window-configuration' | ||
| 6644 | respectively are not installed by `window-state-put'. */); | ||
| 6645 | Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qstate)); | ||
| 6646 | |||
| 6550 | defsubr (&Sselected_window); | 6647 | defsubr (&Sselected_window); |
| 6551 | defsubr (&Sminibuffer_window); | 6648 | defsubr (&Sminibuffer_window); |
| 6552 | defsubr (&Swindow_minibuffer_p); | 6649 | defsubr (&Swindow_minibuffer_p); |