diff options
Diffstat (limited to 'src/cmds.c')
| -rw-r--r-- | src/cmds.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/cmds.c b/src/cmds.c index 3ebad50184a..ee3be79a0ab 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -86,6 +86,7 @@ DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p", | |||
| 86 | doc: /* Move point N characters forward (backward if N is negative). | 86 | doc: /* Move point N characters forward (backward if N is negative). |
| 87 | On reaching end or beginning of buffer, stop and signal error. | 87 | On reaching end or beginning of buffer, stop and signal error. |
| 88 | Interactively, N is the numeric prefix argument. | 88 | Interactively, N is the numeric prefix argument. |
| 89 | If N is omitted or nil, move point 1 character forward. | ||
| 89 | 90 | ||
| 90 | Depending on the bidirectional context, the movement may be to the | 91 | Depending on the bidirectional context, the movement may be to the |
| 91 | right or to the left on the screen. This is in contrast with | 92 | right or to the left on the screen. This is in contrast with |
| @@ -99,6 +100,7 @@ DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p", | |||
| 99 | doc: /* Move point N characters backward (forward if N is negative). | 100 | doc: /* Move point N characters backward (forward if N is negative). |
| 100 | On attempt to pass beginning or end of buffer, stop and signal error. | 101 | On attempt to pass beginning or end of buffer, stop and signal error. |
| 101 | Interactively, N is the numeric prefix argument. | 102 | Interactively, N is the numeric prefix argument. |
| 103 | If N is omitted or nil, move point 1 character backward. | ||
| 102 | 104 | ||
| 103 | Depending on the bidirectional context, the movement may be to the | 105 | Depending on the bidirectional context, the movement may be to the |
| 104 | right or to the left on the screen. This is in contrast with | 106 | right or to the left on the screen. This is in contrast with |
| @@ -119,9 +121,7 @@ With positive N, a non-empty line at the end counts as one line | |||
| 119 | successfully moved (for the return value). */) | 121 | successfully moved (for the return value). */) |
| 120 | (Lisp_Object n) | 122 | (Lisp_Object n) |
| 121 | { | 123 | { |
| 122 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; | 124 | ptrdiff_t opoint = PT, pos, pos_byte, shortage, count; |
| 123 | ptrdiff_t pos, pos_byte; | ||
| 124 | EMACS_INT count, shortage; | ||
| 125 | 125 | ||
| 126 | if (NILP (n)) | 126 | if (NILP (n)) |
| 127 | count = 1; | 127 | count = 1; |
| @@ -132,16 +132,12 @@ successfully moved (for the return value). */) | |||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | if (count <= 0) | 134 | if (count <= 0) |
| 135 | shortage = scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, count - 1, 1); | 135 | pos = find_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, count - 1, |
| 136 | &shortage, &pos_byte, 1); | ||
| 136 | else | 137 | else |
| 137 | shortage = scan_newline (PT, PT_BYTE, ZV, ZV_BYTE, count, 1); | 138 | pos = find_newline (PT, PT_BYTE, ZV, ZV_BYTE, count, |
| 138 | 139 | &shortage, &pos_byte, 1); | |
| 139 | /* Since scan_newline does TEMP_SET_PT_BOTH, | 140 | |
| 140 | and we want to set PT "for real", | ||
| 141 | go back to the old point and then come back here. */ | ||
| 142 | pos = PT; | ||
| 143 | pos_byte = PT_BYTE; | ||
| 144 | TEMP_SET_PT_BOTH (opoint, opoint_byte); | ||
| 145 | SET_PT_BOTH (pos, pos_byte); | 141 | SET_PT_BOTH (pos, pos_byte); |
| 146 | 142 | ||
| 147 | if (shortage > 0 | 143 | if (shortage > 0 |