aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2010-08-24 16:43:24 -0400
committerChong Yidong2010-08-24 16:43:24 -0400
commit78e33835a312bcb56457bbf93cd98be982a0911d (patch)
tree5c3e5ee1b88472c2c636cafc82fe0d4ac6fe8ed2
parent44a41a47d1ed7f2f2d8bd583e5f5d76d49bba0a0 (diff)
downloademacs-78e33835a312bcb56457bbf93cd98be982a0911d.tar.gz
emacs-78e33835a312bcb56457bbf93cd98be982a0911d.zip
Fix filter functions discussion in Lisp manual.
* processes.texi (Filter Functions): Use `buffer-live-p' instead of `buffer-name' in the main text as well as in the example (Bug#3098).
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/processes.texi28
2 files changed, 18 insertions, 16 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 70b82830b44..53b8ac25522 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12010-08-24 Markus Triska <triska@gmx.at>
2
3 * processes.texi (Filter Functions): Use `buffer-live-p' instead
4 of `buffer-name' in the main text as well as in the example
5 (Bug#3098).
6
12010-08-22 Chong Yidong <cyd@stupidchicken.com> 72010-08-22 Chong Yidong <cyd@stupidchicken.com>
2 8
3 * nonascii.texi (Text Representations): 9 * nonascii.texi (Text Representations):
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 747d865b0e1..265c76471f0 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -1273,22 +1273,24 @@ process's buffer, mimicking the actions of Emacs when there is no
1273filter. Such filter functions need to use @code{set-buffer} in order to 1273filter. Such filter functions need to use @code{set-buffer} in order to
1274be sure to insert in that buffer. To avoid setting the current buffer 1274be sure to insert in that buffer. To avoid setting the current buffer
1275semipermanently, these filter functions must save and restore the 1275semipermanently, these filter functions must save and restore the
1276current buffer. They should also update the process marker, and in some 1276current buffer. They should also check whether the buffer is still
1277cases update the value of point. Here is how to do these things: 1277alive, update the process marker, and in some cases update the value
1278of point. Here is how to do these things:
1278 1279
1279@smallexample 1280@smallexample
1280@group 1281@group
1281(defun ordinary-insertion-filter (proc string) 1282(defun ordinary-insertion-filter (proc string)
1282 (with-current-buffer (process-buffer proc) 1283 (when (buffer-live-p (process-buffer proc))
1283 (let ((moving (= (point) (process-mark proc)))) 1284 (with-current-buffer (process-buffer proc)
1285 (let ((moving (= (point) (process-mark proc))))
1284@end group 1286@end group
1285@group 1287@group
1286 (save-excursion 1288 (save-excursion
1287 ;; @r{Insert the text, advancing the process marker.} 1289 ;; <at> r{Insert the text, advancing the process marker.}
1288 (goto-char (process-mark proc)) 1290 (goto-char (process-mark proc))
1289 (insert string) 1291 (insert string)
1290 (set-marker (process-mark proc) (point))) 1292 (set-marker (process-mark proc) (point)))
1291 (if moving (goto-char (process-mark proc)))))) 1293 (if moving (goto-char (process-mark proc)))))))
1292@end group 1294@end group
1293@end smallexample 1295@end smallexample
1294 1296
@@ -1315,12 +1317,6 @@ expression searching or matching had to explicitly save and restore the
1315match data. Now Emacs does this automatically for filter functions; 1317match data. Now Emacs does this automatically for filter functions;
1316they never need to do it explicitly. @xref{Match Data}. 1318they never need to do it explicitly. @xref{Match Data}.
1317 1319
1318 A filter function that writes the output into the buffer of the
1319process should check whether the buffer is still alive. If it tries to
1320insert into a dead buffer, it will get an error. The expression
1321@code{(buffer-name (process-buffer @var{process}))} returns @code{nil}
1322if the buffer is dead.
1323
1324 The output to the function may come in chunks of any size. A program 1320 The output to the function may come in chunks of any size. A program
1325that produces the same output twice in a row may send it as one batch of 1321that produces the same output twice in a row may send it as one batch of
1326200 characters one time, and five batches of 40 characters the next. If 1322200 characters one time, and five batches of 40 characters the next. If