unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16023: 24.3; [PATCH] process-live-p tweak
@ 2013-12-02  1:32 Leo Liu
  2013-12-02  6:50 ` Lars Magne Ingebrigtsen
  2013-12-02 14:33 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Liu @ 2013-12-02  1:32 UTC (permalink / raw)
  To: 16023; +Cc: Lars Magne Ingebrigtsen

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#16023: 24.3; [PATCH] process-live-p tweak
  2013-12-02  1:32 bug#16023: 24.3; [PATCH] process-live-p tweak Leo Liu
@ 2013-12-02  6:50 ` Lars Magne Ingebrigtsen
  2013-12-02  7:47   ` Leo Liu
  2013-12-02 14:33 ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-12-02  6:50 UTC (permalink / raw)
  To: Leo Liu; +Cc: 16023

Leo Liu <sdl.web@gmail.com> writes:

> 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.

Seems like a good idea to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#16023: 24.3; [PATCH] process-live-p tweak
  2013-12-02  6:50 ` Lars Magne Ingebrigtsen
@ 2013-12-02  7:47   ` Leo Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Leo Liu @ 2013-12-02  7:47 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 16023-done

Fixed in 24.4

On 2013-12-02 14:50 +0800, Lars Magne Ingebrigtsen wrote:
[snipped 7 lines]
> Seems like a good idea to me.

done.

Leo





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#16023: 24.3; [PATCH] process-live-p tweak
  2013-12-02  1:32 bug#16023: 24.3; [PATCH] process-live-p tweak Leo Liu
  2013-12-02  6:50 ` Lars Magne Ingebrigtsen
@ 2013-12-02 14:33 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-12-02 14:33 UTC (permalink / raw)
  To: Leo Liu; +Cc: 16023, Lars Magne Ingebrigtsen

> It seems inconvenient for a predicate to throw type error.

Generally agreed, and in this particular case as well, please go ahead,
thank you,


        Stefan





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-12-02 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-02  1:32 bug#16023: 24.3; [PATCH] process-live-p tweak Leo Liu
2013-12-02  6:50 ` Lars Magne Ingebrigtsen
2013-12-02  7:47   ` Leo Liu
2013-12-02 14:33 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).