comparison lispref/positions.texi @ 7729:a1c07008521d

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 28 May 1994 12:25:54 +0000
parents 075343a6b32b
children 2d4db32cccd5
comparison
equal deleted inserted replaced
7728:23f5b77e3773 7729:a1c07008521d
5 @setfilename ../info/positions 5 @setfilename ../info/positions
6 @node Positions, Markers, Frames, Top 6 @node Positions, Markers, Frames, Top
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
22 @menu 22 @menu
23 * Point:: The special position where editing takes place. 23 * Point:: The special position where editing takes place.
56 so the distinction is rarely important. @xref{Window Point}, for more 56 so the distinction is rarely important. @xref{Window Point}, for more
57 details. 57 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
65 @example 65 @example
66 @group 66 @group
69 @end group 69 @end group
70 @end example 70 @end example
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
97 @example 97 @example
98 @group 98 @group
127 127
128 @node Character Motion 128 @node Character Motion
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
136 This function sets point in the current buffer to the value 136 This function sets point in the current buffer to the value
137 @var{position}. If @var{position} is less than 1, it moves point to the 137 @var{position}. If @var{position} is less than 1, it moves point to the
190 In an interactive call, @var{count} is set to the numeric prefix 190 In an interactive call, @var{count} is set to the numeric prefix
191 argument. 191 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
206 @c Emacs 19 feature 206 @c Emacs 19 feature
207 This variable affects the behavior of @code{forward-word} and everything 207 This variable affects the behavior of @code{forward-word} and everything
228 @group 228 @group
229 (goto-char (point-max)) 229 (goto-char (point-max))
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
237 @deffn Command beginning-of-buffer &optional n 237 @deffn Command beginning-of-buffer &optional n
238 This function moves point to the beginning of the buffer (or the limits 238 This function moves point to the beginning of the buffer (or the limits
248 248
249 @deffn Command end-of-buffer &optional n 249 @deffn Command end-of-buffer &optional n
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}.
257 257
258 Don't use this function in Lisp programs! 258 Don't use this function in Lisp programs!
270 of the window, by line continuation in display, or by how tabs and 270 of the window, by line continuation in display, or by how tabs and
271 control characters are displayed. 271 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
282 portion. So @code{goto-line} moves point to the beginning or end of the 284 portion. So @code{goto-line} moves point to the beginning or end of the
283 accessible portion, if the line number specifies an inaccessible 285 accessible portion, if the line number specifies an inaccessible
284 position. 286 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.
293 @end deffn 297 @end deffn
294 298
296 This function moves point to the beginning of the current line. With an 300 This function moves point to the beginning of the current line. With an
297 argument @var{count} not @code{nil} or 1, it moves forward 301 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
306 This function moves point to the end of the current line. With an 310 This function moves point to the end of the current line. With an
307 argument @var{count} not @code{nil} or 1, it moves forward 311 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
323 there. No error is signaled. 329 there. No error is signaled.
324 330
433 In some cases, text lines are truncated on the screen rather than 439 In some cases, text lines are truncated on the screen rather than
434 continued onto additional screen lines. In these cases, 440 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
442 flag, and display table may vary between windows). @xref{Usual 448 flag, and display table may vary between windows). @xref{Usual
443 Display}. 449 Display}.
460 @deffn Command move-to-window-line count 466 @deffn Command move-to-window-line count
461 This function moves point with respect to the text currently displayed 467 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})}.
490 496
491 The argument @var{width} is the number of columns available to display 497 The argument @var{width} is the number of columns available to display
499 @var{tab-offset} is the offset between column numbers on the screen and 505 @var{tab-offset} is the offset between column numbers on the screen and
500 column numbers in the buffer. This can be nonzero in a continuation 506 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
510 @example 516 @example
511 (@var{pos} @var{vpos} @var{hpos} @var{prevhpos} @var{contin}) 517 (@var{pos} @var{vpos} @var{hpos} @var{prevhpos} @var{contin})
512 @end example 518 @end example
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
540 @code{minibuffer-prompt-width} to get the horizontal position of the 548 @code{minibuffer-prompt-width} to get the horizontal position of the
541 beginning of the first screen line. @xref{Minibuffer Misc}. 549 beginning of the first screen line. @xref{Minibuffer Misc}.
573 581
574 @defopt track-eol 582 @defopt track-eol
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.
584 @end defopt 593 @end defopt
585 594
614 This function moves forward out of @var{arg} levels of parentheses. 623 This function moves forward out of @var{arg} levels of parentheses.
615 A negative argument means move backward but still to a less deep spot. 624 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
625 This function moves forward across @var{arg} balanced expressions. 634 This function moves forward across @var{arg} balanced expressions.
626 Balanced expressions include both those delimited by parentheses and 635 Balanced expressions include both those delimited by parentheses and
653 @var{arg} is negative, this actually moves forward, but it still moves 662 @var{arg} is negative, this actually moves forward, but it still moves
654 to the beginning of a defun, not to the end of one. 663 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
672 @comment node-name, next, previous, up 681 @comment node-name, next, previous, up
673 @subsection Skipping Characters 682 @subsection Skipping Characters
744 @defspec save-excursion forms@dots{} 753 @defspec save-excursion forms@dots{}
745 @cindex mark excursion 754 @cindex mark excursion
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
756 the rest of the program. It is used more than 500 times in the Lisp 765 the rest of the program. It is used more than 500 times in the Lisp
757 sources of Emacs. 766 sources of Emacs.
803 and most Emacs primitives, these positions replace the values of the 812 and most Emacs primitives, these positions replace the values of the
804 beginning and end of the buffer. While narrowing is in effect, no text 813 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
817 at @var{start} and end at @var{end}. Both arguments should be character 826 at @var{start} and end at @var{end}. Both arguments should be character
818 positions. 827 positions.
847 @defspec save-restriction body@dots{} 856 @defspec save-restriction body@dots{}
848 This special form saves the current bounds of the accessible portion, 857 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.
857 866
858 @c Wordy to avoid overfull hbox. --rjc 16mar92 867 @c Wordy to avoid overfull hbox. --rjc 16mar92