emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r101179: Fix filter functions discuss


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101179: Fix filter functions discussion in Lisp manual.
Date: Tue, 24 Aug 2010 16:43:24 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101179
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Tue 2010-08-24 16:43:24 -0400
message:
  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).
modified:
  doc/lispref/ChangeLog
  doc/lispref/processes.texi
=== modified file 'doc/lispref/ChangeLog'
--- a/doc/lispref/ChangeLog     2010-08-22 21:15:20 +0000
+++ b/doc/lispref/ChangeLog     2010-08-24 20:43:24 +0000
@@ -1,3 +1,9 @@
+2010-08-24  Markus Triska  <address@hidden>
+
+       * processes.texi (Filter Functions): Use `buffer-live-p' instead
+       of `buffer-name' in the main text as well as in the example
+       (Bug#3098).
+
 2010-08-22  Chong Yidong  <address@hidden>
 
        * nonascii.texi (Text Representations):

=== modified file 'doc/lispref/processes.texi'
--- a/doc/lispref/processes.texi        2010-07-29 13:54:03 +0000
+++ b/doc/lispref/processes.texi        2010-08-24 20:43:24 +0000
@@ -1273,22 +1273,24 @@
 filter.  Such filter functions need to use @code{set-buffer} in order to
 be sure to insert in that buffer.  To avoid setting the current buffer
 semipermanently, these filter functions must save and restore the
-current buffer.  They should also update the process marker, and in some
-cases update the value of point.  Here is how to do these things:
+current buffer.  They should also check whether the buffer is still
+alive, update the process marker, and in some cases update the value
+of point.  Here is how to do these things:
 
 @smallexample
 @group
 (defun ordinary-insertion-filter (proc string)
-  (with-current-buffer (process-buffer proc)
-    (let ((moving (= (point) (process-mark proc))))
+  (when (buffer-live-p (process-buffer proc))
+    (with-current-buffer (process-buffer proc)
+      (let ((moving (= (point) (process-mark proc))))
 @end group
 @group
-      (save-excursion
-        ;; @r{Insert the text, advancing the process marker.}
-        (goto-char (process-mark proc))
-        (insert string)
-        (set-marker (process-mark proc) (point)))
-      (if moving (goto-char (process-mark proc))))))
+        (save-excursion
+          ;;  <at> r{Insert the text, advancing the process marker.}
+          (goto-char (process-mark proc))
+          (insert string)
+          (set-marker (process-mark proc) (point)))
+        (if moving (goto-char (process-mark proc)))))))
 @end group
 @end smallexample
 
@@ -1315,12 +1317,6 @@
 match data.  Now Emacs does this automatically for filter functions;
 they never need to do it explicitly.  @xref{Match Data}.
 
-  A filter function that writes the output into the buffer of the
-process should check whether the buffer is still alive.  If it tries to
-insert into a dead buffer, it will get an error.  The expression
address@hidden(buffer-name (process-buffer @var{process}))} returns @code{nil}
-if the buffer is dead.
-
   The output to the function may come in chunks of any size.  A program
 that produces the same output twice in a row may send it as one batch of
 200 characters one time, and five batches of 40 characters the next.  If


reply via email to

[Prev in Thread] Current Thread [Next in Thread]