diff options
| author | Richard M. Stallman | 1994-05-28 12:25:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-28 12:25:54 +0000 |
| commit | 29679a81c7f1b4e231972c8f5034fa4de8957728 (patch) | |
| tree | aca3bc10b7b242793c83b84522e081777ef6ae9a /lispref | |
| parent | db07847fc06e14e4f3ca1599d9c7f6612ffe81a5 (diff) | |
| download | emacs-29679a81c7f1b4e231972c8f5034fa4de8957728.tar.gz emacs-29679a81c7f1b4e231972c8f5034fa4de8957728.zip | |
*** empty log message ***
Diffstat (limited to 'lispref')
| -rw-r--r-- | lispref/markers.texi | 33 | ||||
| -rw-r--r-- | lispref/positions.texi | 143 |
2 files changed, 95 insertions, 81 deletions
diff --git a/lispref/markers.texi b/lispref/markers.texi index 1e7ceebe7df..ae2deeb9b4d 100644 --- a/lispref/markers.texi +++ b/lispref/markers.texi | |||
| @@ -31,7 +31,7 @@ just as an integer could be used. @xref{Positions}, for a complete | |||
| 31 | description of positions. | 31 | description of positions. |
| 32 | 32 | ||
| 33 | A marker has two attributes: the marker position, and the marker | 33 | A marker has two attributes: the marker position, and the marker |
| 34 | buffer. The marker position is an integer which is equivalent (at a | 34 | buffer. The marker position is an integer that is equivalent (at a |
| 35 | given time) to the marker as a position in that buffer. But the | 35 | given time) to the marker as a position in that buffer. But the |
| 36 | marker's position value can change often during the life of the marker. | 36 | marker's position value can change often during the life of the marker. |
| 37 | Insertion and deletion of text in the buffer relocate the marker. The | 37 | Insertion and deletion of text in the buffer relocate the marker. The |
| @@ -141,7 +141,7 @@ accessible portion of the buffer, or to the same place as another given | |||
| 141 | marker. | 141 | marker. |
| 142 | 142 | ||
| 143 | @defun make-marker | 143 | @defun make-marker |
| 144 | This functions returns a newly allocated marker that does not point | 144 | This functions returns a newly created marker that does not point |
| 145 | anywhere. | 145 | anywhere. |
| 146 | 146 | ||
| 147 | @example | 147 | @example |
| @@ -309,10 +309,10 @@ in @var{buffer}. If @var{buffer} is not provided, it defaults to | |||
| 309 | the current buffer. | 309 | the current buffer. |
| 310 | 310 | ||
| 311 | If @var{position} is less than 1, @code{set-marker} moves @var{marker} | 311 | If @var{position} is less than 1, @code{set-marker} moves @var{marker} |
| 312 | to the beginning of the buffer. If the value of @var{position} is | 312 | to the beginning of the buffer. If @var{position} is greater than the |
| 313 | greater than the size of the buffer, @code{set-marker} moves marker to | 313 | size of the buffer, @code{set-marker} moves marker to the end of the |
| 314 | the end of the buffer. If @var{position} is @code{nil} or a marker that | 314 | buffer. If @var{position} is @code{nil} or a marker that points |
| 315 | points nowhere, then @var{marker} is set to point nowhere. | 315 | nowhere, then @var{marker} is set to point nowhere. |
| 316 | 316 | ||
| 317 | The value returned is @var{marker}. | 317 | The value returned is @var{marker}. |
| 318 | 318 | ||
| @@ -365,16 +365,15 @@ explicitly. @xref{Interactive Codes}. | |||
| 365 | Each buffer has its own value of the mark that is independent of the | 365 | Each buffer has its own value of the mark that is independent of the |
| 366 | value of the mark in other buffers. When a buffer is created, the mark | 366 | value of the mark in other buffers. When a buffer is created, the mark |
| 367 | exists but does not point anywhere. We consider this state as ``the | 367 | exists but does not point anywhere. We consider this state as ``the |
| 368 | absence of a mark in that buffer''. | 368 | absence of a mark in that buffer.'' |
| 369 | 369 | ||
| 370 | Once the mark ``exists'' in a buffer, it normally never ceases to | 370 | Once the mark ``exists'' in a buffer, it normally never ceases to |
| 371 | exist. However, it may become @dfn{inactive}, if Transient Mark mode is | 371 | exist. However, it may become @dfn{inactive}, if Transient Mark mode is |
| 372 | enabled. The variable @code{mark-active}, which is always local in all | 372 | enabled. The variable @code{mark-active}, which is always local in all |
| 373 | buffers, indicates whether the mark is active: non-@code{nil} means | 373 | buffers, indicates whether the mark is active: non-@code{nil} means yes. |
| 374 | yes. A command can request deactivation of the mark upon return to the | 374 | A command can request deactivation of the mark upon return to the editor |
| 375 | editor command loop by setting @code{deactivate-mark} to a | 375 | command loop by setting @code{deactivate-mark} to a non-@code{nil} value |
| 376 | non-@code{nil} value (but this deactivation only follows if Transient | 376 | (but this causes deactivation only if Transient Mark mode is enabled). |
| 377 | Mark mode is enabled). | ||
| 378 | 377 | ||
| 379 | The main motivation for using Transient Mark mode is that this mode | 378 | The main motivation for using Transient Mark mode is that this mode |
| 380 | also enables highlighting of the region when the mark is active. | 379 | also enables highlighting of the region when the mark is active. |
| @@ -399,7 +398,7 @@ this buffer. | |||
| 399 | 398 | ||
| 400 | @defun mark-marker | 399 | @defun mark-marker |
| 401 | This function returns the current buffer's mark. This is the very marker | 400 | This function returns the current buffer's mark. This is the very marker |
| 402 | which records the mark location inside Emacs, not a copy. Therefore, | 401 | that records the mark location inside Emacs, not a copy. Therefore, |
| 403 | changing this marker's position will directly affect the position of the mark. | 402 | changing this marker's position will directly affect the position of the mark. |
| 404 | Don't do it unless that is the effect you want. | 403 | Don't do it unless that is the effect you want. |
| 405 | 404 | ||
| @@ -505,9 +504,15 @@ inactive. | |||
| 505 | 504 | ||
| 506 | @defvar deactivate-mark | 505 | @defvar deactivate-mark |
| 507 | If an editor command sets this variable non-@code{nil}, then the editor | 506 | If an editor command sets this variable non-@code{nil}, then the editor |
| 508 | command loop deactivates the mark after the command returns. | 507 | command loop deactivates the mark after the command returns, but only if |
| 508 | Transient Mark mode is enabled. | ||
| 509 | @end defvar | 509 | @end defvar |
| 510 | 510 | ||
| 511 | @defun deactivate-mark | ||
| 512 | This function deactivates the mark, but only if Transient Mark mode | ||
| 513 | is enabled. | ||
| 514 | @end defun | ||
| 515 | |||
| 511 | @defvar mark-active | 516 | @defvar mark-active |
| 512 | The mark is active when this variable is non-@code{nil}. This variable | 517 | The mark is active when this variable is non-@code{nil}. This variable |
| 513 | is always local in each buffer. | 518 | is always local in each buffer. |
diff --git a/lispref/positions.texi b/lispref/positions.texi index 7d2c3ea40a6..b3f4bd17b42 100644 --- a/lispref/positions.texi +++ b/lispref/positions.texi | |||
| @@ -7,15 +7,15 @@ | |||
| 7 | @chapter Positions | 7 | @chapter Positions |
| 8 | @cindex position (in buffer) | 8 | @cindex position (in buffer) |
| 9 | 9 | ||
| 10 | A @dfn{position} is the index of a character in the text of buffer. | 10 | A @dfn{position} is the index of a character in the text of a buffer. |
| 11 | More precisely, a position identifies the place between two characters | 11 | More precisely, a position identifies the place between two characters |
| 12 | (or before the first character, or after the last character), so we can | 12 | (or before the first character, or after the last character), so we can |
| 13 | speak of the character before or after a given position. However, the | 13 | speak of the character before or after a given position. However, we |
| 14 | we often speak of the character ``at'' a position, meaning the character | 14 | often speak of the character ``at'' a position, meaning the character |
| 15 | after that position. | 15 | after that position. |
| 16 | 16 | ||
| 17 | Positions are usually represented as integers starting from 1, but can | 17 | Positions are usually represented as integers starting from 1, but can |
| 18 | also be represented as @dfn{markers}---special objects which relocate | 18 | also be represented as @dfn{markers}---special objects that relocate |
| 19 | automatically when text is inserted or deleted so they stay with the | 19 | automatically when text is inserted or deleted so they stay with the |
| 20 | surrounding characters. @xref{Markers}. | 20 | surrounding characters. @xref{Markers}. |
| 21 | 21 | ||
| @@ -58,7 +58,7 @@ details. | |||
| 58 | 58 | ||
| 59 | @defun point | 59 | @defun point |
| 60 | @cindex current buffer position | 60 | @cindex current buffer position |
| 61 | This function returns the position of point in the current buffer, | 61 | This function returns the value of point in the current buffer, |
| 62 | as an integer. | 62 | as an integer. |
| 63 | 63 | ||
| 64 | @need 700 | 64 | @need 700 |
| @@ -71,26 +71,26 @@ as an integer. | |||
| 71 | @end defun | 71 | @end defun |
| 72 | 72 | ||
| 73 | @defun point-min | 73 | @defun point-min |
| 74 | This function returns the minimum accessible value of point in the | 74 | This function returns the minimum accessible value of point in the |
| 75 | current buffer. This is 1, unless narrowing is in effect, in | 75 | current buffer. This is normally 1, but if narrowing is in effect, it |
| 76 | which case it is the position of the start of the region that you | 76 | is the position of the start of the region that you narrowed to. |
| 77 | narrowed to. (@xref{Narrowing}.) | 77 | (@xref{Narrowing}.) |
| 78 | @end defun | 78 | @end defun |
| 79 | 79 | ||
| 80 | @defun point-max | 80 | @defun point-max |
| 81 | This function returns the maximum accessible value of point in the | 81 | This function returns the maximum accessible value of point in the |
| 82 | current buffer. This is @code{(1+ (buffer-size))}, unless narrowing is | 82 | current buffer. This is @code{(1+ (buffer-size))}, unless narrowing is |
| 83 | in effect, in which case it is the position of the end of the region | 83 | in effect, in which case it is the position of the end of the region |
| 84 | that you narrowed to. (@xref{Narrowing}). | 84 | that you narrowed to. (@xref{Narrowing}). |
| 85 | @end defun | 85 | @end defun |
| 86 | 86 | ||
| 87 | @defun buffer-end flag | 87 | @defun buffer-end flag |
| 88 | This function returns @code{(point-min)} if @var{flag} is less than 1, | 88 | This function returns @code{(point-min)} if @var{flag} is less than 1, |
| 89 | @code{(point-max)} otherwise. The argument @var{flag} must be a number. | 89 | @code{(point-max)} otherwise. The argument @var{flag} must be a number. |
| 90 | @end defun | 90 | @end defun |
| 91 | 91 | ||
| 92 | @defun buffer-size | 92 | @defun buffer-size |
| 93 | This function returns the total number of characters in the current | 93 | This function returns the total number of characters in the current |
| 94 | buffer. In the absence of any narrowing (@pxref{Narrowing}), | 94 | buffer. In the absence of any narrowing (@pxref{Narrowing}), |
| 95 | @code{point-max} returns a value one larger than this. | 95 | @code{point-max} returns a value one larger than this. |
| 96 | 96 | ||
| @@ -129,7 +129,7 @@ or relative to the edges of the selected window. @xref{Point}. | |||
| 129 | @subsection Motion by Characters | 129 | @subsection Motion by Characters |
| 130 | 130 | ||
| 131 | These functions move point based on a count of characters. | 131 | These functions move point based on a count of characters. |
| 132 | @code{goto-char} is the fundamental primitive; the functions others use | 132 | @code{goto-char} is the fundamental primitive; the other functions use |
| 133 | that. | 133 | that. |
| 134 | 134 | ||
| 135 | @deffn Command goto-char position | 135 | @deffn Command goto-char position |
| @@ -192,14 +192,14 @@ argument. | |||
| 192 | @end deffn | 192 | @end deffn |
| 193 | 193 | ||
| 194 | @deffn Command backward-word count | 194 | @deffn Command backward-word count |
| 195 | This function just like @code{forward-word}, except that it moves | 195 | This function is just like @code{forward-word}, except that it moves |
| 196 | backward until encountering the front of a word, rather than forward. | 196 | backward until encountering the front of a word, rather than forward. |
| 197 | 197 | ||
| 198 | In an interactive call, @var{count} is set to the numeric prefix | 198 | In an interactive call, @var{count} is set to the numeric prefix |
| 199 | argument. | 199 | argument. |
| 200 | 200 | ||
| 201 | This function is rarely used in programs, as it is more efficient to | 201 | This function is rarely used in programs, as it is more efficient to |
| 202 | call @code{forward-word} with negative argument. | 202 | call @code{forward-word} with a negative argument. |
| 203 | @end deffn | 203 | @end deffn |
| 204 | 204 | ||
| 205 | @defvar words-include-escapes | 205 | @defvar words-include-escapes |
| @@ -230,7 +230,7 @@ Likewise, to move to the end of the buffer, use: | |||
| 230 | @end group | 230 | @end group |
| 231 | @end example | 231 | @end example |
| 232 | 232 | ||
| 233 | Here are two commands which users use to do these things. They are | 233 | Here are two commands that users use to do these things. They are |
| 234 | documented here to warn you not to use them in Lisp programs, because | 234 | documented here to warn you not to use them in Lisp programs, because |
| 235 | they set the mark and display messages in the echo area. | 235 | they set the mark and display messages in the echo area. |
| 236 | 236 | ||
| @@ -250,7 +250,7 @@ Don't use this function in Lisp programs! | |||
| 250 | This function moves point to the end of the buffer (or the limits of | 250 | This function moves point to the end of the buffer (or the limits of |
| 251 | the accessible portion, when narrowing is in effect), setting the mark | 251 | the accessible portion, when narrowing is in effect), setting the mark |
| 252 | at the previous position. If @var{n} is non-@code{nil}, then it puts | 252 | at the previous position. If @var{n} is non-@code{nil}, then it puts |
| 253 | point @var{n} tenths of the way from the end. | 253 | point @var{n} tenths of the way from the end of the buffer. |
| 254 | 254 | ||
| 255 | In an interactive call, @var{n} is the numeric prefix argument, | 255 | In an interactive call, @var{n} is the numeric prefix argument, |
| 256 | if provided; otherwise @var{n} defaults to @code{nil}. | 256 | if provided; otherwise @var{n} defaults to @code{nil}. |
| @@ -272,10 +272,12 @@ control characters are displayed. | |||
| 272 | 272 | ||
| 273 | @deffn Command goto-line line | 273 | @deffn Command goto-line line |
| 274 | This function moves point to the front of the @var{line}th line, | 274 | This function moves point to the front of the @var{line}th line, |
| 275 | counting from line 1 at beginning of buffer. If @var{line} is less than | 275 | counting from line 1 at beginning of the buffer. If @var{line} is less |
| 276 | 1, it moves point to the beginning of the buffer. If @var{line} is | 276 | than 1, it moves point to the beginning of the buffer. If @var{line} is |
| 277 | greater than the number of lines in the buffer, it moves point to the | 277 | greater than the number of lines in the buffer, it moves point to the |
| 278 | @emph{end of the last line} of the buffer. | 278 | end of the buffer---that is, the @emph{end of the last line} of the |
| 279 | buffer. This is the only case in which @code{goto-line} does not | ||
| 280 | necessarily move to the beginning of a line. | ||
| 279 | 281 | ||
| 280 | If narrowing is in effect, then @var{line} still counts from the | 282 | If narrowing is in effect, then @var{line} still counts from the |
| 281 | beginning of the buffer, but point cannot go outside the accessible | 283 | beginning of the buffer, but point cannot go outside the accessible |
| @@ -285,8 +287,10 @@ position. | |||
| 285 | 287 | ||
| 286 | The return value of @code{goto-line} is the difference between | 288 | The return value of @code{goto-line} is the difference between |
| 287 | @var{line} and the line number of the line to which point actually was | 289 | @var{line} and the line number of the line to which point actually was |
| 288 | able move (in the full buffer, disregarding any narrowing). Thus, the | 290 | able to move (in the full buffer, before taking account of narrowing). |
| 289 | value is positive if the scan encounters the real end of the buffer. | 291 | Thus, the value is positive if the scan encounters the real end of the |
| 292 | buffer. The value is zero if scan encounters the end of the accessible | ||
| 293 | portion but not the real end of the buffer. | ||
| 290 | 294 | ||
| 291 | In an interactive call, @var{line} is the numeric prefix argument if | 295 | In an interactive call, @var{line} is the numeric prefix argument if |
| 292 | one has been provided. Otherwise @var{line} is read in the minibuffer. | 296 | one has been provided. Otherwise @var{line} is read in the minibuffer. |
| @@ -298,8 +302,8 @@ argument @var{count} not @code{nil} or 1, it moves forward | |||
| 298 | @var{count}@minus{}1 lines and then to the beginning of the line. | 302 | @var{count}@minus{}1 lines and then to the beginning of the line. |
| 299 | 303 | ||
| 300 | If this function reaches the end of the buffer (or of the accessible | 304 | If this function reaches the end of the buffer (or of the accessible |
| 301 | portion, if narrowing is in effect), it positions point at the end of | 305 | portion, if narrowing is in effect), it positions point there. No error |
| 302 | the buffer. No error is signaled. | 306 | is signaled. |
| 303 | @end deffn | 307 | @end deffn |
| 304 | 308 | ||
| 305 | @deffn Command end-of-line &optional count | 309 | @deffn Command end-of-line &optional count |
| @@ -308,15 +312,17 @@ argument @var{count} not @code{nil} or 1, it moves forward | |||
| 308 | @var{count}@minus{}1 lines and then to the end of the line. | 312 | @var{count}@minus{}1 lines and then to the end of the line. |
| 309 | 313 | ||
| 310 | If this function reaches the end of the buffer (or of the accessible | 314 | If this function reaches the end of the buffer (or of the accessible |
| 311 | portion, if narrowing is in effect), it positions point at the end of | 315 | portion, if narrowing is in effect), it positions point there. No error |
| 312 | the buffer. No error is signaled. | 316 | is signaled. |
| 313 | @end deffn | 317 | @end deffn |
| 314 | 318 | ||
| 315 | @deffn Command forward-line &optional count | 319 | @deffn Command forward-line &optional count |
| 316 | @cindex beginning of line | 320 | @cindex beginning of line |
| 317 | This function moves point forward @var{count} lines, to the beginning of | 321 | This function moves point forward @var{count} lines, to the beginning of |
| 318 | the line. If @var{count} is negative, it moves point | 322 | the line. If @var{count} is negative, it moves point |
| 319 | @minus{}@var{count} lines backward, to the beginning of the line. | 323 | @minus{}@var{count} lines backward, to the beginning of a line. If |
| 324 | @var{count} is zero, it moves point to the beginning of the current | ||
| 325 | line. | ||
| 320 | 326 | ||
| 321 | If @code{forward-line} encounters the beginning or end of the buffer (or | 327 | If @code{forward-line} encounters the beginning or end of the buffer (or |
| 322 | of the accessible portion) before finding that many lines, it sets point | 328 | of the accessible portion) before finding that many lines, it sets point |
| @@ -435,7 +441,7 @@ continued onto additional screen lines. In these cases, | |||
| 435 | @code{vertical-motion} moves point much like @code{forward-line}. | 441 | @code{vertical-motion} moves point much like @code{forward-line}. |
| 436 | @xref{Truncation}. | 442 | @xref{Truncation}. |
| 437 | 443 | ||
| 438 | Because the width of a given string depends on the flags which control | 444 | Because the width of a given string depends on the flags that control |
| 439 | the appearance of certain characters, @code{vertical-motion} behaves | 445 | the appearance of certain characters, @code{vertical-motion} behaves |
| 440 | differently, for a given piece of text, depending on the buffer it is | 446 | differently, for a given piece of text, depending on the buffer it is |
| 441 | in, and even on the selected window (because the width, the truncation | 447 | in, and even on the selected window (because the width, the truncation |
| @@ -462,28 +468,28 @@ This function moves point with respect to the text currently displayed | |||
| 462 | in the selected window. It moves point to the beginning of the screen | 468 | in the selected window. It moves point to the beginning of the screen |
| 463 | line @var{count} screen lines from the top of the window. If | 469 | line @var{count} screen lines from the top of the window. If |
| 464 | @var{count} is negative, that specifies a position | 470 | @var{count} is negative, that specifies a position |
| 465 | @w{@minus{}@var{count}} lines from the bottom---or else the last line of | 471 | @w{@minus{}@var{count}} lines from the bottom (or the last line of the |
| 466 | the buffer, if the buffer ends above the specified screen position. | 472 | buffer, if the buffer ends above the specified screen position). |
| 467 | 473 | ||
| 468 | If @var{count} is @code{nil}, then point moves to the beginning of the | 474 | If @var{count} is @code{nil}, then point moves to the beginning of the |
| 469 | line in the middle of the window. If the absolute value of @var{count} | 475 | line in the middle of the window. If the absolute value of @var{count} |
| 470 | is greater than the size of the window, then point moves to the place | 476 | is greater than the size of the window, then point moves to the place |
| 471 | which would appear on that screen line if the window were tall enough. | 477 | that would appear on that screen line if the window were tall enough. |
| 472 | This will probably cause the next redisplay to scroll to bring that | 478 | This will probably cause the next redisplay to scroll to bring that |
| 473 | location onto the screen. | 479 | location onto the screen. |
| 474 | 480 | ||
| 475 | In an interactive call, @var{count} is the numeric prefix argument. | 481 | In an interactive call, @var{count} is the numeric prefix argument. |
| 476 | 482 | ||
| 477 | The value returned is the window line number, with the top line in the | 483 | The value returned is the window line number point has moved to, with |
| 478 | window numbered 0. | 484 | the top line in the window numbered 0. |
| 479 | @end deffn | 485 | @end deffn |
| 480 | 486 | ||
| 481 | @defun compute-motion from frompos to topos width offsets window | 487 | @defun compute-motion from frompos to topos width offsets window |
| 482 | This function scan through the current buffer, calculating screen | 488 | This function scans the current buffer, calculating screen positions. |
| 483 | position. It scans the current buffer forward from position @var{from}, | 489 | It scans the buffer forward from position @var{from}, assuming that is |
| 484 | assuming that is at screen coordinates @var{frompos}, to position | 490 | at screen coordinates @var{frompos}, to position @var{to} or coordinates |
| 485 | @var{to} or coordinates @var{topos}, whichever comes first. It returns | 491 | @var{topos}, whichever comes first. It returns the ending buffer |
| 486 | the ending buffer position and screen coordinates. | 492 | position and screen coordinates. |
| 487 | 493 | ||
| 488 | The coordinate arguments @var{frompos} and @var{topos} are cons cells of | 494 | The coordinate arguments @var{frompos} and @var{topos} are cons cells of |
| 489 | the form @code{(@var{hpos} . @var{vpos})}. | 495 | the form @code{(@var{hpos} . @var{vpos})}. |
| @@ -501,9 +507,9 @@ column numbers in the buffer. This can be nonzero in a continuation | |||
| 501 | line, when the previous screen lines' widths do not add up to a multiple | 507 | line, when the previous screen lines' widths do not add up to a multiple |
| 502 | of @code{tab-width}. It is always zero in a non-continuation line. | 508 | of @code{tab-width}. It is always zero in a non-continuation line. |
| 503 | 509 | ||
| 504 | The window @var{window} serves to specify which display table to use; | 510 | The window @var{window} serves only to specify which display table to |
| 505 | that is its only effect. @code{compute-motion} always operates on the | 511 | use. @code{compute-motion} always operates on the current buffer, |
| 506 | current buffer, regardless of what buffer is displayed in @var{window}. | 512 | regardless of what buffer is displayed in @var{window}. |
| 507 | 513 | ||
| 508 | The return value is a list of five elements: | 514 | The return value is a list of five elements: |
| 509 | 515 | ||
| @@ -513,27 +519,29 @@ The return value is a list of five elements: | |||
| 513 | 519 | ||
| 514 | @noindent | 520 | @noindent |
| 515 | Here @var{pos} is the buffer position where the scan stopped, @var{vpos} | 521 | Here @var{pos} is the buffer position where the scan stopped, @var{vpos} |
| 516 | is the vertical position, and @var{hpos} is the horizontal position. | 522 | is the vertical screen position, and @var{hpos} is the horizontal screen |
| 523 | position. | ||
| 517 | 524 | ||
| 518 | The result @var{prevhpos} is the horizontal position one character back | 525 | The result @var{prevhpos} is the horizontal position one character back |
| 519 | from @var{pos}. The result @var{contin} is @code{t} if a line was | 526 | from @var{pos}. The result @var{contin} is @code{t} if the last line |
| 520 | continued after (or within) the previous character. | 527 | was continued after (or within) the previous character. |
| 521 | 528 | ||
| 522 | For example, to find the buffer position of column @var{col} of line | 529 | For example, to find the buffer position of column @var{col} of line |
| 523 | @var{line} of a certain window, pass the window's display start location | 530 | @var{line} of a certain window, pass the window's display start location |
| 524 | as @var{from} and the window's upper-left coordinates as @var{frompos}. | 531 | as @var{from} and the window's upper-left coordinates as @var{frompos}. |
| 525 | Pass the buffer's @code{(point-max)} as @var{to}, to limit the scan to | 532 | Pass the buffer's @code{(point-max)} as @var{to}, to limit the scan to |
| 526 | the end of the visible section of the buffer, and pass @var{line} and | 533 | the end of the accessible portion of the buffer, and pass @var{line} and |
| 527 | @var{col} as @var{topos}. Here's a function that does this: | 534 | @var{col} as @var{topos}. Here's a function that does this: |
| 528 | 535 | ||
| 529 | @example | 536 | @example |
| 530 | (defun coordinates-of-position (col line) | 537 | (defun coordinates-of-position (col line) |
| 531 | (car (compute-motion (window-start) | 538 | (car (compute-motion (window-start) |
| 532 | '(0 . 0) | 539 | '(0 . 0) |
| 533 | (point) | 540 | (point-max) |
| 534 | (cons col line) | 541 | (cons col line) |
| 535 | (window-width) | 542 | (window-width) |
| 536 | (cons (window-hscroll) 0)))) | 543 | (cons (window-hscroll) 0) |
| 544 | (selected-window)))) | ||
| 537 | @end example | 545 | @end example |
| 538 | 546 | ||
| 539 | When you use @code{compute-motion} for the minibuffer, you need to use | 547 | When you use @code{compute-motion} for the minibuffer, you need to use |
| @@ -575,9 +583,10 @@ a vertical motion command. | |||
| 575 | This variable controls how the vertical line motion commands operate | 583 | This variable controls how the vertical line motion commands operate |
| 576 | when starting at the end of a line. If @code{track-eol} is | 584 | when starting at the end of a line. If @code{track-eol} is |
| 577 | non-@code{nil}, then vertical motion starting at the end of a line will | 585 | non-@code{nil}, then vertical motion starting at the end of a line will |
| 578 | keep to the ends of lines. This means moving to the end of each line | 586 | keep to the ends of lines (instead of keeping to a particular column). |
| 579 | moved onto. The value of @code{track-eol} has no effect if point is not | 587 | This means moving to the end of each line moved onto. The value of |
| 580 | at the end of a line when the first vertical motion command is given. | 588 | @code{track-eol} has no effect if point is not at the end of a line when |
| 589 | the first vertical motion command is given. | ||
| 581 | 590 | ||
| 582 | @code{track-eol} has its effect by telling line motion commands to set | 591 | @code{track-eol} has its effect by telling line motion commands to set |
| 583 | @code{temporary-goal-column} to 9999 instead of to the current column. | 592 | @code{temporary-goal-column} to 9999 instead of to the current column. |
| @@ -616,9 +625,9 @@ A negative argument means move backward but still to a less deep spot. | |||
| 616 | @end deffn | 625 | @end deffn |
| 617 | 626 | ||
| 618 | @deffn Command down-list arg | 627 | @deffn Command down-list arg |
| 619 | This function moves forward down @var{arg} levels of parentheses. A | 628 | This function moves forward into @var{arg} levels of parentheses. A |
| 620 | negative argument means move backward but still go down @var{arg} | 629 | negative argument means move backward but still go @var{arg} levels |
| 621 | levels. | 630 | deeper in parentheses. |
| 622 | @end deffn | 631 | @end deffn |
| 623 | 632 | ||
| 624 | @deffn Command forward-sexp arg | 633 | @deffn Command forward-sexp arg |
| @@ -655,17 +664,17 @@ to the beginning of a defun, not to the end of one. | |||
| 655 | @end deffn | 664 | @end deffn |
| 656 | 665 | ||
| 657 | @deffn Command end-of-defun arg | 666 | @deffn Command end-of-defun arg |
| 658 | Move forward to the @var{arg}th end of a defun. If @var{arg} is | 667 | This function moves forward to the @var{arg}th end of a defun. If |
| 659 | negative, this actually moves backward, but it still moves to the end of | 668 | @var{arg} is negative, this actually moves backward, but it still moves |
| 660 | a defun, not to the beginning of one. | 669 | to the end of a defun, not to the beginning of one. |
| 661 | @end deffn | 670 | @end deffn |
| 662 | 671 | ||
| 663 | @defopt defun-prompt-regexp | 672 | @defopt defun-prompt-regexp |
| 664 | If non-@code{nil}, this variable holds a regular expression that | 673 | If non-@code{nil}, this variable holds a regular expression that |
| 665 | specifies what text can appear before the open-parenthesis that starts a | 674 | specifies what text can appear before the open-parenthesis that starts a |
| 666 | defun. That is to say, the a defun begins on a line which starts | 675 | defun. That is to say, a defun begins on a line that starts with a |
| 667 | with a match for this regular expression, followed by a character | 676 | match for this regular expression, followed by a character with |
| 668 | with open-parenthesis syntax. | 677 | open-parenthesis syntax. |
| 669 | @end defopt | 678 | @end defopt |
| 670 | 679 | ||
| 671 | @node Skipping Characters | 680 | @node Skipping Characters |
| @@ -746,10 +755,10 @@ Configurations}). | |||
| 746 | @cindex point excursion | 755 | @cindex point excursion |
| 747 | @cindex current buffer excursion | 756 | @cindex current buffer excursion |
| 748 | The @code{save-excursion} special form saves the identity of the current | 757 | The @code{save-excursion} special form saves the identity of the current |
| 749 | buffer and the values of point and the mark in it, evaluates @var{forms}, | 758 | buffer and the values of point and the mark in it, evaluates |
| 750 | and finally restores the buffer and its saved values of point and the mark. | 759 | @var{forms}, and finally restores the buffer and its saved values of |
| 751 | All three saved values are restored even in case of an abnormal exit | 760 | point and the mark. All three saved values are restored even in case of |
| 752 | via throw or error (@pxref{Nonlocal Exits}). | 761 | an abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). |
| 753 | 762 | ||
| 754 | The @code{save-excursion} special form is the standard way to switch | 763 | The @code{save-excursion} special form is the standard way to switch |
| 755 | buffers or move point within one part of a program and avoid affecting | 764 | buffers or move point within one part of a program and avoid affecting |
| @@ -805,12 +814,12 @@ beginning and end of the buffer. While narrowing is in effect, no text | |||
| 805 | outside the accessible portion is displayed, and point cannot move | 814 | outside the accessible portion is displayed, and point cannot move |
| 806 | outside the accessible portion. | 815 | outside the accessible portion. |
| 807 | 816 | ||
| 808 | Values such as positions or line numbers, that usually count from the | 817 | Values such as positions or line numbers, which usually count from the |
| 809 | beginning of the buffer, do so despite narrowing, but the functions | 818 | beginning of the buffer, do so despite narrowing, but the functions |
| 810 | which use them refuse to operate on text that is inaccessible. | 819 | which use them refuse to operate on text that is inaccessible. |
| 811 | 820 | ||
| 812 | The commands for saving buffers are unaffected by narrowing; they save | 821 | The commands for saving buffers are unaffected by narrowing; they save |
| 813 | the entire buffer regardless of the any narrowing. | 822 | the entire buffer regardless of any narrowing. |
| 814 | 823 | ||
| 815 | @deffn Command narrow-to-region start end | 824 | @deffn Command narrow-to-region start end |
| 816 | This function sets the accessible portion of the current buffer to start | 825 | This function sets the accessible portion of the current buffer to start |
| @@ -849,8 +858,8 @@ This special form saves the current bounds of the accessible portion, | |||
| 849 | evaluates the @var{body} forms, and finally restores the saved bounds, | 858 | evaluates the @var{body} forms, and finally restores the saved bounds, |
| 850 | thus restoring the same state of narrowing (or absence thereof) formerly | 859 | thus restoring the same state of narrowing (or absence thereof) formerly |
| 851 | in effect. The state of narrowing is restored even in the event of an | 860 | in effect. The state of narrowing is restored even in the event of an |
| 852 | abnormal exit via throw or error (@pxref{Nonlocal Exits}). Therefore, | 861 | abnormal exit via @code{throw} or error (@pxref{Nonlocal Exits}). |
| 853 | this construct is a clean way to narrow a buffer temporarily. | 862 | Therefore, this construct is a clean way to narrow a buffer temporarily. |
| 854 | 863 | ||
| 855 | The value returned by @code{save-restriction} is that returned by the | 864 | The value returned by @code{save-restriction} is that returned by the |
| 856 | last form in @var{body}, or @code{nil} if no body forms were given. | 865 | last form in @var{body}, or @code{nil} if no body forms were given. |