diff options
| author | Martin Rudalics | 2012-08-21 11:27:07 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2012-08-21 11:27:07 +0200 |
| commit | 5481664ac42e532f7636941e29cf31b3163587c6 (patch) | |
| tree | 634ff4414fd635d9bb7f7ec988546438092d5eb3 /src | |
| parent | 9f1ee09efc42e82df21d0697cda35189f0618cd8 (diff) | |
| download | emacs-5481664ac42e532f7636941e29cf31b3163587c6.tar.gz emacs-5481664ac42e532f7636941e29cf31b3163587c6.zip | |
For selected window have (set-)window-point always operate on buffer's point.
* window.c (Fwindow_point): For the selected window always return
the position of its buffer's point.
(Fset_window_point): For the selected window always go in its
buffer to the specified position.
* window.el (window-point-1, set-window-point-1): Remove.
(window-in-direction, record-window-buffer)
(set-window-buffer-start-and-point, split-window-below)
(window--state-get-1, display-buffer-record-window): Replace
calls to window-point-1 and set-window-point-1 by calls to
window-point and set-window-point respectively.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/window.c | 52 |
2 files changed, 38 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5a7c6923029..15eac722f8e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-08-21 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * window.c (Fwindow_point): For the selected window always return | ||
| 4 | the position of its buffer's point. | ||
| 5 | (Fset_window_point): For the selected window always go in its | ||
| 6 | buffer to the specified position. | ||
| 7 | |||
| 1 | 2012-08-21 Dmitry Antipov <dmantipov@yandex.ru> | 8 | 2012-08-21 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 9 | ||
| 3 | Setter macros for fontsets. | 10 | Setter macros for fontsets. |
diff --git a/src/window.c b/src/window.c index 9045721009d..4d92566b243 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1407,22 +1407,21 @@ DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | |||
| 1407 | doc: /* Return current value of point in WINDOW. | 1407 | doc: /* Return current value of point in WINDOW. |
| 1408 | WINDOW must be a live window and defaults to the selected one. | 1408 | WINDOW must be a live window and defaults to the selected one. |
| 1409 | 1409 | ||
| 1410 | For a nonselected window, this is the value point would have | 1410 | For a nonselected window, this is the value point would have if that |
| 1411 | if that window were selected. | 1411 | window were selected. |
| 1412 | 1412 | ||
| 1413 | Note that, when WINDOW is the selected window and its buffer | 1413 | Note that, when WINDOW is selected, the value returned is the same as |
| 1414 | is also currently selected, the value returned is the same as (point). | 1414 | that returned by `point' for WINDOW's buffer. It would be more strictly |
| 1415 | It would be more strictly correct to return the `top-level' value | 1415 | correct to return the `top-level' value of `point', outside of any |
| 1416 | of point, outside of any save-excursion forms. | 1416 | `save-excursion' forms. But that is hard to define. */) |
| 1417 | But that is hard to define. */) | ||
| 1418 | (Lisp_Object window) | 1417 | (Lisp_Object window) |
| 1419 | { | 1418 | { |
| 1420 | register struct window *w = decode_live_window (window); | 1419 | register struct window *w = decode_live_window (window); |
| 1421 | 1420 | ||
| 1422 | if (w == XWINDOW (selected_window) | 1421 | if (w == XWINDOW (selected_window)) |
| 1423 | && current_buffer == XBUFFER (w->buffer)) | 1422 | return make_number (BUF_PT (XBUFFER (w->buffer))); |
| 1424 | return Fpoint (); | 1423 | else |
| 1425 | return Fmarker_position (w->pointm); | 1424 | return Fmarker_position (w->pointm); |
| 1426 | } | 1425 | } |
| 1427 | 1426 | ||
| 1428 | DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, | 1427 | DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, |
| @@ -1532,16 +1531,27 @@ Return POS. */) | |||
| 1532 | register struct window *w = decode_live_window (window); | 1531 | register struct window *w = decode_live_window (window); |
| 1533 | 1532 | ||
| 1534 | CHECK_NUMBER_COERCE_MARKER (pos); | 1533 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1535 | if (w == XWINDOW (selected_window) | ||
| 1536 | && XBUFFER (w->buffer) == current_buffer) | ||
| 1537 | Fgoto_char (pos); | ||
| 1538 | else | ||
| 1539 | set_marker_restricted (w->pointm, pos, w->buffer); | ||
| 1540 | 1534 | ||
| 1541 | /* We have to make sure that redisplay updates the window to show | 1535 | if (w == XWINDOW (selected_window)) |
| 1542 | the new value of point. */ | 1536 | { |
| 1543 | if (!EQ (window, selected_window)) | 1537 | if (XBUFFER (w->buffer) == current_buffer) |
| 1544 | ++windows_or_buffers_changed; | 1538 | Fgoto_char (pos); |
| 1539 | else | ||
| 1540 | { | ||
| 1541 | struct buffer *old_buffer = current_buffer; | ||
| 1542 | |||
| 1543 | set_buffer_internal (XBUFFER (w->buffer)); | ||
| 1544 | Fgoto_char (pos); | ||
| 1545 | set_buffer_internal (old_buffer); | ||
| 1546 | } | ||
| 1547 | } | ||
| 1548 | else | ||
| 1549 | { | ||
| 1550 | set_marker_restricted (w->pointm, pos, w->buffer); | ||
| 1551 | /* We have to make sure that redisplay updates the window to show | ||
| 1552 | the new value of point. */ | ||
| 1553 | ++windows_or_buffers_changed; | ||
| 1554 | } | ||
| 1545 | 1555 | ||
| 1546 | return pos; | 1556 | return pos; |
| 1547 | } | 1557 | } |