summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2011-05-31 20:40:00 +0200
committerLars Magne Ingebrigtsen <larsi@gnus.org>2011-05-31 20:40:00 +0200
commitbcd54f837039f8d28e0bb8320385ca2dc6fdd5d3 (patch)
treea569ae614a24267c168d788c9df97334cc653ba0
parent864db017b0b040e386f95b21c2501e1a71d86318 (diff)
downloademacs-bcd54f837039f8d28e0bb8320385ca2dc6fdd5d3.tar.gz
Add the tiny convenience function `process-alive-p'.
-rw-r--r--doc/lispref/ChangeLog5
-rw-r--r--doc/lispref/processes.texi6
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/subr.el7
4 files changed, 22 insertions, 0 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index bd92b2a7273..83cee10f899 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * processes.texi (Process Information): Document
+ `process-alive-p'.
+
2011-05-29 Chong Yidong <cyd@stupidchicken.com>
* help.texi (Accessing Documentation):
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index 1a1b63683ce..2284699c82b 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -859,6 +859,12 @@ For a network connection, @code{process-status} returns one of the symbols
closed the connection, or Emacs did @code{delete-process}.
@end defun
+@defun process-alive-p process
+This function returns nin-@code{nil} if @var{process} is alive. A
+process is considered alive if its status is @code{run}, @code{open},
+@code{listen}, @code{connect} or @code{stop}.
+@end defun
+
@defun process-type process
This function returns the symbol @code{network} for a network
connection or server, @code{serial} for a serial port connection, or
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0070f3a3945..384a30cb7cd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-31 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * subr.el (process-alive-p): New tiny convenience function.
+
2011-05-31 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/debug.el (debug): Save&restore not just the buffer's
diff --git a/lisp/subr.el b/lisp/subr.el
index 4fe9987b95b..08099dc1fdd 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1805,6 +1805,13 @@ Signal an error if the program returns with a non-zero exit status."
(forward-line 1))
(nreverse lines)))))
+(defun process-alive-p (process)
+ "Returns non-nil if PROCESS is alive.
+A process is considered alive if its status is `run', `open',
+`listen', `connect' or `stop'."
+ (memq (process-status process)
+ '(run open listen connect stop)))
+
;; compatibility
(make-obsolete