summaryrefslogtreecommitdiff
path: root/doc/lispref/control.texi
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2010-01-04 13:18:38 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2010-01-04 13:18:38 -0500
commit7d7112918354fe563ef7ae48fb7e8c2c991b29c1 (patch)
tree6322bffda375a3ca7706500353e25dc5707c4608 /doc/lispref/control.texi
parent60385ec073e1b285339b49687bbad99066389a6c (diff)
downloademacs-7d7112918354fe563ef7ae48fb7e8c2c991b29c1.tar.gz
Avoid dubious uses of save-excursions.
* doc/lispref/positions.texi (Excursions): Recommend the use of save-current-buffer if applicable. * doc/lispref/text.texi (Clickable Text): Fix the example code which used save-excursion in a naive way which sometimes preserves point and sometimes not. * doc/lispref/variables.texi (Creating Buffer-Local): * doc/lispref/os.texi (Session Management): * doc/lispref/display.texi (GIF Images): * doc/lispref/control.texi (Cleanups): Use (save|with)-current-buffer. * doc/misc/gnus.texi (Posting Styles): Use with-current-buffer. * doc/misc/calc.texi (Defining Simple Commands): Prefer save-current-buffer.
Diffstat (limited to 'doc/lispref/control.texi')
-rw-r--r--doc/lispref/control.texi7
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 41f844b4e21..6d7c01d354b 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -1255,9 +1255,8 @@ make sure to kill it before finishing:
@smallexample
@group
-(save-excursion
- (let ((buffer (get-buffer-create " *temp*")))
- (set-buffer buffer)
+(let ((buffer (get-buffer-create " *temp*")))
+ (with-current-buffer buffer
(unwind-protect
@var{body-form}
(kill-buffer buffer))))
@@ -1269,7 +1268,7 @@ You might think that we could just as well write @code{(kill-buffer
(current-buffer))} and dispense with the variable @code{buffer}.
However, the way shown above is safer, if @var{body-form} happens to
get an error after switching to a different buffer! (Alternatively,
-you could write another @code{save-excursion} around @var{body-form},
+you could write a @code{save-current-buffer} around @var{body-form},
to ensure that the temporary buffer becomes current again in time to
kill it.)