diff options
| author | Chong Yidong | 2010-08-24 16:43:24 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-08-24 16:43:24 -0400 |
| commit | 78e33835a312bcb56457bbf93cd98be982a0911d (patch) | |
| tree | 5c3e5ee1b88472c2c636cafc82fe0d4ac6fe8ed2 | |
| parent | 44a41a47d1ed7f2f2d8bd583e5f5d76d49bba0a0 (diff) | |
| download | emacs-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/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/processes.texi | 28 |
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 @@ | |||
| 1 | 2010-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 | |||
| 1 | 2010-08-22 Chong Yidong <cyd@stupidchicken.com> | 7 | 2010-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 | |||
| 1273 | filter. Such filter functions need to use @code{set-buffer} in order to | 1273 | filter. Such filter functions need to use @code{set-buffer} in order to |
| 1274 | be sure to insert in that buffer. To avoid setting the current buffer | 1274 | be sure to insert in that buffer. To avoid setting the current buffer |
| 1275 | semipermanently, these filter functions must save and restore the | 1275 | semipermanently, these filter functions must save and restore the |
| 1276 | current buffer. They should also update the process marker, and in some | 1276 | current buffer. They should also check whether the buffer is still |
| 1277 | cases update the value of point. Here is how to do these things: | 1277 | alive, update the process marker, and in some cases update the value |
| 1278 | of 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 | |||
| 1315 | match data. Now Emacs does this automatically for filter functions; | 1317 | match data. Now Emacs does this automatically for filter functions; |
| 1316 | they never need to do it explicitly. @xref{Match Data}. | 1318 | they never need to do it explicitly. @xref{Match Data}. |
| 1317 | 1319 | ||
| 1318 | A filter function that writes the output into the buffer of the | ||
| 1319 | process should check whether the buffer is still alive. If it tries to | ||
| 1320 | insert into a dead buffer, it will get an error. The expression | ||
| 1321 | @code{(buffer-name (process-buffer @var{process}))} returns @code{nil} | ||
| 1322 | if 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 |
| 1325 | that produces the same output twice in a row may send it as one batch of | 1321 | that produces the same output twice in a row may send it as one batch of |
| 1326 | 200 characters one time, and five batches of 40 characters the next. If | 1322 | 200 characters one time, and five batches of 40 characters the next. If |