all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Leo Liu <sdl.web@gmail.com>
To: 16023@debbugs.gnu.org
Cc: Lars Magne Ingebrigtsen <larsi@gnus.org>
Subject: bug#16023: 24.3; [PATCH] process-live-p tweak
Date: Mon, 02 Dec 2013 09:32:54 +0800	[thread overview]
Message-ID: <m138mcm3zt.fsf@gmail.com> (raw)

It seems inconvenient for a predicate to throw type error. I have used
process-live-p a few times and was always surprised. It seems better to
simply return nil for non-process arg. buffer-live-p does something
similar.

In octave.el, I have to use another one-liner

(defun inferior-octave-process-live-p ()
  (and inferior-octave-process (process-live-p inferior-octave-process)))

to mitigate this problem which would be redundant if process-live-p
doesn't throw error for non-process arg. So I wonder if you object to
the following tweak:

=== modified file 'lisp/subr.el'
--- lisp/subr.el	2013-11-24 08:49:44 +0000
+++ lisp/subr.el	2013-12-02 01:30:08 +0000
@@ -1885,9 +1885,11 @@
 (defun process-live-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)))
+`listen', `connect' or `stop'.  Value is nil if PROCESS is not a
+process."
+  (and (processp process)
+       (memq (process-status process)
+	     '(run open listen connect stop))))
 
 ;; compatibility


Thanks,
Leo





             reply	other threads:[~2013-12-02  1:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02  1:32 Leo Liu [this message]
2013-12-02  6:50 ` bug#16023: 24.3; [PATCH] process-live-p tweak Lars Magne Ingebrigtsen
2013-12-02  7:47   ` Leo Liu
2013-12-02 14:33 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m138mcm3zt.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=16023@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.