diff options
| author | Richard M. Stallman | 1998-03-02 19:12:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-03-02 19:12:51 +0000 |
| commit | 2f8274be2cae6fd4b50a23f961b53bfbe8028923 (patch) | |
| tree | 9c82df4903a34583f2cea56764a1bbfa205b21d3 /src | |
| parent | 4864692429fb955dcc5edfc5f51f70287037417d (diff) | |
| download | emacs-2f8274be2cae6fd4b50a23f961b53bfbe8028923.tar.gz emacs-2f8274be2cae6fd4b50a23f961b53bfbe8028923.zip | |
(compare_window_configurations): New arg ignore_positions.
(Fcompare_window_configurations): New function.
(syms_of_window): defsubr it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/src/window.c b/src/window.c index c40272bb918..1a6e7edd887 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -3670,8 +3670,9 @@ Does not restore the value of point in current buffer.") | |||
| 3670 | describe the same state of affairs. This is used by Fequal. */ | 3670 | describe the same state of affairs. This is used by Fequal. */ |
| 3671 | 3671 | ||
| 3672 | int | 3672 | int |
| 3673 | compare_window_configurations (c1, c2) | 3673 | compare_window_configurations (c1, c2, ignore_positions) |
| 3674 | Lisp_Object c1, c2; | 3674 | Lisp_Object c1, c2; |
| 3675 | int ignore_positions; | ||
| 3675 | { | 3676 | { |
| 3676 | register struct save_window_data *d1, *d2; | 3677 | register struct save_window_data *d1, *d2; |
| 3677 | struct Lisp_Vector *sw1, *sw2; | 3678 | struct Lisp_Vector *sw1, *sw2; |
| @@ -3694,8 +3695,9 @@ compare_window_configurations (c1, c2) | |||
| 3694 | Instead see w1_is_current and w2_is_current, below. */ | 3695 | Instead see w1_is_current and w2_is_current, below. */ |
| 3695 | if (! EQ (d1->current_buffer, d2->current_buffer)) | 3696 | if (! EQ (d1->current_buffer, d2->current_buffer)) |
| 3696 | return 0; | 3697 | return 0; |
| 3697 | if (! EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window)) | 3698 | if (! ignore_positions) |
| 3698 | return 0; | 3699 | if (! EQ (d1->minibuf_scroll_window, d2->minibuf_scroll_window)) |
| 3700 | return 0; | ||
| 3699 | /* Don't compare the root_window field. | 3701 | /* Don't compare the root_window field. |
| 3700 | We don't require the two configurations | 3702 | We don't require the two configurations |
| 3701 | to use the same window object, | 3703 | to use the same window object, |
| @@ -3739,26 +3741,42 @@ compare_window_configurations (c1, c2) | |||
| 3739 | return 0; | 3741 | return 0; |
| 3740 | if (! EQ (p1->height, p2->height)) | 3742 | if (! EQ (p1->height, p2->height)) |
| 3741 | return 0; | 3743 | return 0; |
| 3742 | if (! EQ (p1->hscroll, p2->hscroll)) | ||
| 3743 | return 0; | ||
| 3744 | if (! EQ (p1->start_at_line_beg, p2->start_at_line_beg)) | ||
| 3745 | return 0; | ||
| 3746 | if (! EQ (p1->display_table, p2->display_table)) | 3744 | if (! EQ (p1->display_table, p2->display_table)) |
| 3747 | return 0; | 3745 | return 0; |
| 3748 | if (! EQ (p1->parent, p2->parent)) | 3746 | if (! EQ (p1->parent, p2->parent)) |
| 3749 | return 0; | 3747 | return 0; |
| 3750 | if (! EQ (p1->prev, p2->prev)) | 3748 | if (! EQ (p1->prev, p2->prev)) |
| 3751 | return 0; | 3749 | return 0; |
| 3752 | if (NILP (Fequal (p1->start, p2->start))) | 3750 | if (! ignore_positions) |
| 3753 | return 0; | 3751 | { |
| 3754 | if (NILP (Fequal (p1->pointm, p2->pointm))) | 3752 | if (! EQ (p1->hscroll, p2->hscroll)) |
| 3755 | return 0; | 3753 | return 0; |
| 3756 | if (NILP (Fequal (p1->mark, p2->mark))) | 3754 | if (! EQ (p1->start_at_line_beg, p2->start_at_line_beg)) |
| 3757 | return 0; | 3755 | return 0; |
| 3756 | if (NILP (Fequal (p1->start, p2->start))) | ||
| 3757 | return 0; | ||
| 3758 | if (NILP (Fequal (p1->pointm, p2->pointm))) | ||
| 3759 | return 0; | ||
| 3760 | if (NILP (Fequal (p1->mark, p2->mark))) | ||
| 3761 | return 0; | ||
| 3762 | } | ||
| 3758 | } | 3763 | } |
| 3759 | 3764 | ||
| 3760 | return 1; | 3765 | return 1; |
| 3761 | } | 3766 | } |
| 3767 | |||
| 3768 | DEFUN ("compare-window-configurations", Fcompare_window_configurations, | ||
| 3769 | Scompare_window_configurations, 2, 2, 0, | ||
| 3770 | "Compare two window configurations as regards the structure of windows.\n\ | ||
| 3771 | This function ignores details such as the values of point and mark\n\ | ||
| 3772 | and scrolling positions.") | ||
| 3773 | (x, y) | ||
| 3774 | Lisp_Object x, y; | ||
| 3775 | { | ||
| 3776 | if (compare_window_configurations (x, y, 1)) | ||
| 3777 | return Qt; | ||
| 3778 | return Qnil; | ||
| 3779 | } | ||
| 3762 | 3780 | ||
| 3763 | init_window_once () | 3781 | init_window_once () |
| 3764 | { | 3782 | { |
| @@ -3987,6 +4005,7 @@ The selected frame is the one whose configuration has changed."); | |||
| 3987 | defsubr (&Sset_window_configuration); | 4005 | defsubr (&Sset_window_configuration); |
| 3988 | defsubr (&Scurrent_window_configuration); | 4006 | defsubr (&Scurrent_window_configuration); |
| 3989 | defsubr (&Ssave_window_excursion); | 4007 | defsubr (&Ssave_window_excursion); |
| 4008 | defsubr (&Scompare_window_configurations); | ||
| 3990 | } | 4009 | } |
| 3991 | 4010 | ||
| 3992 | keys_of_window () | 4011 | keys_of_window () |