diff options
| author | Gerd Moellmann | 2000-10-12 13:06:00 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-12 13:06:00 +0000 |
| commit | 2483cf581bf1378059e09147c1061045aabadab0 (patch) | |
| tree | 781fc5a60d2fdfc28eb79771a922688cd40ce390 /src | |
| parent | ef2ed8ab525d3b24ec5b9bd4feeabf5d1c335f0d (diff) | |
| download | emacs-2483cf581bf1378059e09147c1061045aabadab0.tar.gz emacs-2483cf581bf1378059e09147c1061045aabadab0.zip | |
(save_excursion_save): Additionally record the
selected window.
(save_excursion_restore): If buffer was visible in a window, and a
different window was selected, and the old selected window is
still live, restore point in that window.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/editfns.c | 39 |
2 files changed, 40 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ff20a3785f0..9346f36d630 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2000-10-12 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * editfns.c (save_excursion_save): Additionally record the | ||
| 4 | selected window. | ||
| 5 | (save_excursion_restore): If buffer was visible in a window, and a | ||
| 6 | different window was selected, and the old selected window is | ||
| 7 | still live, restore point in that window. | ||
| 8 | |||
| 1 | 2000-10-12 Kenichi Handa <handa@etl.go.jp> | 9 | 2000-10-12 Kenichi Handa <handa@etl.go.jp> |
| 2 | 10 | ||
| 3 | * xterm.c (x_produce_glyphs): Handle | 11 | * xterm.c (x_produce_glyphs): Handle |
diff --git a/src/editfns.c b/src/editfns.c index 9b7386685d7..4f7a7c7db1f 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -727,7 +727,8 @@ save_excursion_save () | |||
| 727 | return Fcons (Fpoint_marker (), | 727 | return Fcons (Fpoint_marker (), |
| 728 | Fcons (Fcopy_marker (current_buffer->mark, Qnil), | 728 | Fcons (Fcopy_marker (current_buffer->mark, Qnil), |
| 729 | Fcons (visible ? Qt : Qnil, | 729 | Fcons (visible ? Qt : Qnil, |
| 730 | current_buffer->mark_active))); | 730 | Fcons (current_buffer->mark_active, |
| 731 | selected_window)))); | ||
| 731 | } | 732 | } |
| 732 | 733 | ||
| 733 | Lisp_Object | 734 | Lisp_Object |
| @@ -736,8 +737,9 @@ save_excursion_restore (info) | |||
| 736 | { | 737 | { |
| 737 | Lisp_Object tem, tem1, omark, nmark; | 738 | Lisp_Object tem, tem1, omark, nmark; |
| 738 | struct gcpro gcpro1, gcpro2, gcpro3; | 739 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 740 | int visible_p; | ||
| 739 | 741 | ||
| 740 | tem = Fmarker_buffer (Fcar (info)); | 742 | tem = Fmarker_buffer (XCAR (info)); |
| 741 | /* If buffer being returned to is now deleted, avoid error */ | 743 | /* If buffer being returned to is now deleted, avoid error */ |
| 742 | /* Otherwise could get error here while unwinding to top level | 744 | /* Otherwise could get error here while unwinding to top level |
| 743 | and crash */ | 745 | and crash */ |
| @@ -749,15 +751,24 @@ save_excursion_restore (info) | |||
| 749 | GCPRO3 (info, omark, nmark); | 751 | GCPRO3 (info, omark, nmark); |
| 750 | 752 | ||
| 751 | Fset_buffer (tem); | 753 | Fset_buffer (tem); |
| 752 | tem = Fcar (info); | 754 | |
| 755 | /* Point marker. */ | ||
| 756 | tem = XCAR (info); | ||
| 753 | Fgoto_char (tem); | 757 | Fgoto_char (tem); |
| 754 | unchain_marker (tem); | 758 | unchain_marker (tem); |
| 755 | tem = Fcar (Fcdr (info)); | 759 | |
| 760 | /* Mark marker. */ | ||
| 761 | info = XCDR (info); | ||
| 762 | tem = XCAR (info); | ||
| 756 | omark = Fmarker_position (current_buffer->mark); | 763 | omark = Fmarker_position (current_buffer->mark); |
| 757 | Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); | 764 | Fset_marker (current_buffer->mark, tem, Fcurrent_buffer ()); |
| 758 | nmark = Fmarker_position (tem); | 765 | nmark = Fmarker_position (tem); |
| 759 | unchain_marker (tem); | 766 | unchain_marker (tem); |
| 760 | tem = Fcdr (Fcdr (info)); | 767 | |
| 768 | /* visible */ | ||
| 769 | info = XCDR (info); | ||
| 770 | visible_p = !NILP (XCAR (info)); | ||
| 771 | |||
| 761 | #if 0 /* We used to make the current buffer visible in the selected window | 772 | #if 0 /* We used to make the current buffer visible in the selected window |
| 762 | if that was true previously. That avoids some anomalies. | 773 | if that was true previously. That avoids some anomalies. |
| 763 | But it creates others, and it wasn't documented, and it is simpler | 774 | But it creates others, and it wasn't documented, and it is simpler |
| @@ -768,8 +779,12 @@ save_excursion_restore (info) | |||
| 768 | Fswitch_to_buffer (Fcurrent_buffer (), Qnil); | 779 | Fswitch_to_buffer (Fcurrent_buffer (), Qnil); |
| 769 | #endif /* 0 */ | 780 | #endif /* 0 */ |
| 770 | 781 | ||
| 782 | /* Mark active */ | ||
| 783 | info = XCDR (info); | ||
| 784 | tem = XCAR (info); | ||
| 771 | tem1 = current_buffer->mark_active; | 785 | tem1 = current_buffer->mark_active; |
| 772 | current_buffer->mark_active = Fcdr (tem); | 786 | current_buffer->mark_active = tem; |
| 787 | |||
| 773 | if (!NILP (Vrun_hooks)) | 788 | if (!NILP (Vrun_hooks)) |
| 774 | { | 789 | { |
| 775 | /* If mark is active now, and either was not active | 790 | /* If mark is active now, and either was not active |
| @@ -783,6 +798,16 @@ save_excursion_restore (info) | |||
| 783 | else if (! NILP (tem1)) | 798 | else if (! NILP (tem1)) |
| 784 | call1 (Vrun_hooks, intern ("deactivate-mark-hook")); | 799 | call1 (Vrun_hooks, intern ("deactivate-mark-hook")); |
| 785 | } | 800 | } |
| 801 | |||
| 802 | /* If buffer was visible in a window, and a different window was | ||
| 803 | selected, and the old selected window is still live, restore | ||
| 804 | point in that window. */ | ||
| 805 | tem = XCDR (info); | ||
| 806 | if (visible_p | ||
| 807 | && !EQ (tem, selected_window) | ||
| 808 | && !NILP (Fwindow_live_p (tem))) | ||
| 809 | Fset_window_point (tem, make_number (PT)); | ||
| 810 | |||
| 786 | UNGCPRO; | 811 | UNGCPRO; |
| 787 | return Qnil; | 812 | return Qnil; |
| 788 | } | 813 | } |
| @@ -2404,7 +2429,7 @@ Both characters must have the same length of multi-byte form.") | |||
| 2404 | #define COMBINING_AFTER 2 | 2429 | #define COMBINING_AFTER 2 |
| 2405 | #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) | 2430 | #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) |
| 2406 | int maybe_byte_combining = COMBINING_NO; | 2431 | int maybe_byte_combining = COMBINING_NO; |
| 2407 | int last_changed; | 2432 | int last_changed = 0; |
| 2408 | int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); | 2433 | int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); |
| 2409 | 2434 | ||
| 2410 | validate_region (&start, &end); | 2435 | validate_region (&start, &end); |