aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-10-03 01:56:15 +0000
committerMiles Bader2000-10-03 01:56:15 +0000
commita6d81c937bd2a0f2ebdfeeed413764b106338c02 (patch)
treedc8c2261296d974cf1bb3c7aba65feb1eba7d4c6
parent96f71a4964c3963a36be0fef120590b985ec7267 (diff)
downloademacs-a6d81c937bd2a0f2ebdfeeed413764b106338c02.tar.gz
emacs-a6d81c937bd2a0f2ebdfeeed413764b106338c02.zip
(Narrowing): Get rid of warning about now-fixed save-restriction bug.
-rw-r--r--lispref/positions.texi25
1 files changed, 1 insertions, 24 deletions
diff --git a/lispref/positions.texi b/lispref/positions.texi
index 7ae412ffe5a..378134e30c2 100644
--- a/lispref/positions.texi
+++ b/lispref/positions.texi
@@ -1,6 +1,6 @@
1@c -*-texinfo-*- 1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual. 2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000
4@c Free Software Foundation, Inc. 4@c Free Software Foundation, Inc.
5@c See the file elisp.texi for copying conditions. 5@c See the file elisp.texi for copying conditions.
6@setfilename ../info/positions 6@setfilename ../info/positions
@@ -911,29 +911,6 @@ restored with temporary narrowing still in effect. If the old point
911value were outside the limits of the temporary narrowing, this would 911value were outside the limits of the temporary narrowing, this would
912fail to restore it accurately. 912fail to restore it accurately.
913 913
914The @code{save-restriction} special form records the values of the
915beginning and end of the accessible portion as distances from the
916beginning and end of the buffer. In other words, it records the amount
917of inaccessible text before and after the accessible portion.
918
919This method yields correct results if @var{body} does further narrowing.
920However, @code{save-restriction} can become confused if the body widens
921and then makes changes outside the range of the saved narrowing. When
922this is what you want to do, @code{save-restriction} is not the right
923tool for the job. Here is what you must use instead:
924
925@example
926@group
927(let ((beg (point-min-marker))
928 (end (point-max-marker)))
929 (unwind-protect
930 (progn @var{body})
931 (save-excursion
932 (set-buffer (marker-buffer beg))
933 (narrow-to-region beg end))))
934@end group
935@end example
936
937Here is a simple example of correct use of @code{save-restriction}: 914Here is a simple example of correct use of @code{save-restriction}:
938 915
939@example 916@example