diff options
| author | Richard M. Stallman | 2002-04-22 22:33:36 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-04-22 22:33:36 +0000 |
| commit | fda3de70e18b1281f685f56ecd9ec4178cbeb5f8 (patch) | |
| tree | 5de99e9a95c066c115f0b07226438a81dd62243f /src/cmds.c | |
| parent | 6be3e0da262fc2d298916972a39cde8d0ffff822 (diff) | |
| download | emacs-fda3de70e18b1281f685f56ecd9ec4178cbeb5f8.tar.gz emacs-fda3de70e18b1281f685f56ecd9ec4178cbeb5f8.zip | |
(Fend_of_line): Handle intangible text in mid line.
Diffstat (limited to 'src/cmds.c')
| -rw-r--r-- | src/cmds.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/cmds.c b/src/cmds.c index 09362a7f5de..40990d074b8 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -179,6 +179,7 @@ DEFUN ("end-of-line", Fend_of_line, Send_of_line, 0, 1, "p", | |||
| 179 | doc: /* Move point to end of current line. | 179 | doc: /* Move point to end of current line. |
| 180 | With argument N not nil or 1, move forward N - 1 lines first. | 180 | With argument N not nil or 1, move forward N - 1 lines first. |
| 181 | If point reaches the beginning or end of buffer, it stops there. | 181 | If point reaches the beginning or end of buffer, it stops there. |
| 182 | To ignore intangibility, bind `inhibit-text-motion-hooks' to t. | ||
| 182 | 183 | ||
| 183 | This command does not move point across a field boundary unless doing so | 184 | This command does not move point across a field boundary unless doing so |
| 184 | would move beyond there to a different line; if N is nil or 1, and | 185 | would move beyond there to a different line; if N is nil or 1, and |
| @@ -187,12 +188,38 @@ boundaries bind `inhibit-field-text-motion' to t. */) | |||
| 187 | (n) | 188 | (n) |
| 188 | Lisp_Object n; | 189 | Lisp_Object n; |
| 189 | { | 190 | { |
| 191 | int newpos; | ||
| 192 | |||
| 190 | if (NILP (n)) | 193 | if (NILP (n)) |
| 191 | XSETFASTINT (n, 1); | 194 | XSETFASTINT (n, 1); |
| 192 | else | 195 | else |
| 193 | CHECK_NUMBER (n); | 196 | CHECK_NUMBER (n); |
| 194 | 197 | ||
| 195 | SET_PT (XINT (Fline_end_position (n))); | 198 | while (1) |
| 199 | { | ||
| 200 | newpos = XINT (Fline_end_position (n)); | ||
| 201 | SET_PT (newpos); | ||
| 202 | |||
| 203 | if (PT > newpos | ||
| 204 | && FETCH_CHAR (PT - 1) == '\n') | ||
| 205 | { | ||
| 206 | /* If we skipped over a newline that follows | ||
| 207 | an invisible intangible run, | ||
| 208 | move back to the last tangible position | ||
| 209 | within the line. */ | ||
| 210 | |||
| 211 | SET_PT (PT - 1); | ||
| 212 | break; | ||
| 213 | } | ||
| 214 | else if (PT > newpos && PT < ZV | ||
| 215 | && FETCH_CHAR (PT) != '\n') | ||
| 216 | /* If we skipped something intangible | ||
| 217 | and now we're not really at eol, | ||
| 218 | keep going. */ | ||
| 219 | n = make_number (1); | ||
| 220 | else | ||
| 221 | break; | ||
| 222 | } | ||
| 196 | 223 | ||
| 197 | return Qnil; | 224 | return Qnil; |
| 198 | } | 225 | } |