diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c index e16416d6fb2..a1b3c879bb5 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* Window creation, deletion and examination for GNU Emacs. | 1 | /* Window creation, deletion and examination for GNU Emacs. |
| 2 | Does not include redisplay. | 2 | Does not include redisplay. |
| 3 | Copyright (C) 1985,86,87, 1993,94,95,96,97,98, 2000,01,02,03,04 | 3 | Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 2000, |
| 4 | Free Software Foundation, Inc. | 4 | 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| 7 | 7 | ||
| @@ -5596,7 +5596,20 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5596 | if (XBUFFER (new_current_buffer) == current_buffer) | 5596 | if (XBUFFER (new_current_buffer) == current_buffer) |
| 5597 | old_point = PT; | 5597 | old_point = PT; |
| 5598 | else | 5598 | else |
| 5599 | old_point = BUF_PT (XBUFFER (new_current_buffer)); | 5599 | /* BUF_PT (XBUFFER (new_current_buffer)) gives us the position of |
| 5600 | point in new_current_buffer as of the last time this buffer was | ||
| 5601 | used. This can be non-deterministic since it can be changed by | ||
| 5602 | things like jit-lock by mere temporary selection of some random | ||
| 5603 | window that happens to show this buffer. | ||
| 5604 | So if possible we want this arbitrary choice of "which point" to | ||
| 5605 | be the one from the to-be-selected-window so as to prevent this | ||
| 5606 | window's cursor from being copied from another window. */ | ||
| 5607 | if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) | ||
| 5608 | /* If current_window = selected_window, its point is in BUF_PT. */ | ||
| 5609 | && !EQ (selected_window, data->current_window)) | ||
| 5610 | old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; | ||
| 5611 | else | ||
| 5612 | old_point = BUF_PT (XBUFFER (new_current_buffer)); | ||
| 5600 | } | 5613 | } |
| 5601 | 5614 | ||
| 5602 | frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; | 5615 | frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; |