diff options
| author | Dmitry Antipov | 2013-08-29 20:36:54 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-08-29 20:36:54 +0400 |
| commit | 032f74518a71a7fe0afd2e7d0eee11bfb7ae90d9 (patch) | |
| tree | cec342cb647d9242855b8f0d4b5a9783d8851176 | |
| parent | 3f940c5aa6fc1d03e6658cda5c440fb6bd75e4c5 (diff) | |
| download | emacs-032f74518a71a7fe0afd2e7d0eee11bfb7ae90d9.tar.gz emacs-032f74518a71a7fe0afd2e7d0eee11bfb7ae90d9.zip | |
* intervals.c (set_point_from_marker): New function.
* editfns.c (Fgoto_char):
* process.c (Finternal_default_process_filter):
* window.c (select_window_1): Use it.
* buffer.h (set_point_from_marker): Add prototype.
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/buffer.h | 1 | ||||
| -rw-r--r-- | src/editfns.c | 26 | ||||
| -rw-r--r-- | src/intervals.c | 12 | ||||
| -rw-r--r-- | src/process.c | 11 | ||||
| -rw-r--r-- | src/window.c | 10 |
6 files changed, 31 insertions, 37 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0a24427f683..c605c5ec4d3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-08-29 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | * intervals.c (set_point_from_marker): New function. | ||
| 4 | * editfns.c (Fgoto_char): | ||
| 5 | * process.c (Finternal_default_process_filter): | ||
| 6 | * window.c (select_window_1): Use it. | ||
| 7 | * buffer.h (set_point_from_marker): Add prototype. | ||
| 8 | |||
| 1 | 2013-08-29 Eli Zaretskii <eliz@gnu.org> | 9 | 2013-08-29 Eli Zaretskii <eliz@gnu.org> |
| 2 | 10 | ||
| 3 | * w32.c (term_winsock): Call release_listen_threads before calling | 11 | * w32.c (term_winsock): Call release_listen_threads before calling |
diff --git a/src/buffer.h b/src/buffer.h index bedb7890939..169a15c7d0f 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -249,6 +249,7 @@ extern void temp_set_point (struct buffer *, ptrdiff_t); | |||
| 249 | extern void set_point_both (ptrdiff_t, ptrdiff_t); | 249 | extern void set_point_both (ptrdiff_t, ptrdiff_t); |
| 250 | extern void temp_set_point_both (struct buffer *, | 250 | extern void temp_set_point_both (struct buffer *, |
| 251 | ptrdiff_t, ptrdiff_t); | 251 | ptrdiff_t, ptrdiff_t); |
| 252 | extern void set_point_from_marker (Lisp_Object); | ||
| 252 | extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); | 253 | extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); |
| 253 | 254 | ||
| 254 | 255 | ||
diff --git a/src/editfns.c b/src/editfns.c index 9e36655f3d3..84a5c8395fc 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -233,26 +233,12 @@ Beginning of buffer is position (point-min), end is (point-max). | |||
| 233 | The return value is POSITION. */) | 233 | The return value is POSITION. */) |
| 234 | (register Lisp_Object position) | 234 | (register Lisp_Object position) |
| 235 | { | 235 | { |
| 236 | ptrdiff_t pos; | 236 | if (MARKERP (position)) |
| 237 | 237 | set_point_from_marker (position); | |
| 238 | if (MARKERP (position) | 238 | else if (INTEGERP (position)) |
| 239 | && current_buffer == XMARKER (position)->buffer) | 239 | SET_PT (clip_to_bounds (BEGV, XINT (position), ZV)); |
| 240 | { | 240 | else |
| 241 | pos = marker_position (position); | 241 | wrong_type_argument (Qinteger_or_marker_p, position); |
| 242 | if (pos < BEGV) | ||
| 243 | SET_PT_BOTH (BEGV, BEGV_BYTE); | ||
| 244 | else if (pos > ZV) | ||
| 245 | SET_PT_BOTH (ZV, ZV_BYTE); | ||
| 246 | else | ||
| 247 | SET_PT_BOTH (pos, marker_byte_position (position)); | ||
| 248 | |||
| 249 | return position; | ||
| 250 | } | ||
| 251 | |||
| 252 | CHECK_NUMBER_COERCE_MARKER (position); | ||
| 253 | |||
| 254 | pos = clip_to_bounds (BEGV, XINT (position), ZV); | ||
| 255 | SET_PT (pos); | ||
| 256 | return position; | 242 | return position; |
| 257 | } | 243 | } |
| 258 | 244 | ||
diff --git a/src/intervals.c b/src/intervals.c index f2ddcd01507..671b2a3d527 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -1821,6 +1821,18 @@ set_point (ptrdiff_t charpos) | |||
| 1821 | set_point_both (charpos, buf_charpos_to_bytepos (current_buffer, charpos)); | 1821 | set_point_both (charpos, buf_charpos_to_bytepos (current_buffer, charpos)); |
| 1822 | } | 1822 | } |
| 1823 | 1823 | ||
| 1824 | /* Set PT from MARKER's clipped position. */ | ||
| 1825 | |||
| 1826 | void | ||
| 1827 | set_point_from_marker (Lisp_Object marker) | ||
| 1828 | { | ||
| 1829 | if (XMARKER (marker)->buffer != current_buffer) | ||
| 1830 | error ("Marker points into wrong buffer"); | ||
| 1831 | set_point_both | ||
| 1832 | (clip_to_bounds (BEGV, marker_position (marker), ZV), | ||
| 1833 | clip_to_bounds (BEGV_BYTE, marker_byte_position (marker), ZV_BYTE)); | ||
| 1834 | } | ||
| 1835 | |||
| 1824 | /* If there's an invisible character at position POS + TEST_OFFS in the | 1836 | /* If there's an invisible character at position POS + TEST_OFFS in the |
| 1825 | current buffer, and the invisible property has a `stickiness' such that | 1837 | current buffer, and the invisible property has a `stickiness' such that |
| 1826 | inserting a character at position POS would inherit the property it, | 1838 | inserting a character at position POS would inherit the property it, |
diff --git a/src/process.c b/src/process.c index b52622ec1b6..20f84990d6f 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -5178,15 +5178,10 @@ DEFUN ("internal-default-process-filter", Finternal_default_process_filter, | |||
| 5178 | 5178 | ||
| 5179 | bset_read_only (current_buffer, Qnil); | 5179 | bset_read_only (current_buffer, Qnil); |
| 5180 | 5180 | ||
| 5181 | /* Insert new output into buffer | 5181 | /* Insert new output into buffer at the current end-of-output |
| 5182 | at the current end-of-output marker, | 5182 | marker, thus preserving logical ordering of input and output. */ |
| 5183 | thus preserving logical ordering of input and output. */ | ||
| 5184 | if (XMARKER (p->mark)->buffer) | 5183 | if (XMARKER (p->mark)->buffer) |
| 5185 | SET_PT_BOTH (clip_to_bounds (BEGV, | 5184 | set_point_from_marker (p->mark); |
| 5186 | marker_position (p->mark), ZV), | ||
| 5187 | clip_to_bounds (BEGV_BYTE, | ||
| 5188 | marker_byte_position (p->mark), | ||
| 5189 | ZV_BYTE)); | ||
| 5190 | else | 5185 | else |
| 5191 | SET_PT_BOTH (ZV, ZV_BYTE); | 5186 | SET_PT_BOTH (ZV, ZV_BYTE); |
| 5192 | before = PT; | 5187 | before = PT; |
diff --git a/src/window.c b/src/window.c index e40572bf13d..d60ee06077f 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -549,15 +549,7 @@ select_window_1 (Lisp_Object window, bool inhibit_point_swap) | |||
| 549 | than one window. It also matters when | 549 | than one window. It also matters when |
| 550 | redisplay_window has altered point after scrolling, | 550 | redisplay_window has altered point after scrolling, |
| 551 | because it makes the change only in the window. */ | 551 | because it makes the change only in the window. */ |
| 552 | { | 552 | set_point_from_marker (XWINDOW (window)->pointm); |
| 553 | register ptrdiff_t new_point = marker_position (XWINDOW (window)->pointm); | ||
| 554 | if (new_point < BEGV) | ||
| 555 | SET_PT (BEGV); | ||
| 556 | else if (new_point > ZV) | ||
| 557 | SET_PT (ZV); | ||
| 558 | else | ||
| 559 | SET_PT (new_point); | ||
| 560 | } | ||
| 561 | } | 553 | } |
| 562 | 554 | ||
| 563 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, | 555 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, |