all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* process-list in Elisp
@ 2011-02-21 21:48 Stefan Monnier
  2011-02-22  7:11 ` Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2011-02-21 21:48 UTC (permalink / raw)
  To: emacs-devel

It looks like this died down.  Could the two authors of the two
competing implementations comment on their opinion on the best way to
replace the current C code with Elisp code?

It would be good if it could be installed first as a "replace the C code
with functionally equivalent code" and then a bunch of patches adding
new features (e.g. addressing bug#8087).


        Stefan



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

* Re: process-list in Elisp
  2011-02-21 21:48 process-list in Elisp Stefan Monnier
@ 2011-02-22  7:11 ` Leo
  2011-02-22 18:10   ` Stefan Monnier
  2011-02-26 21:12   ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Leo @ 2011-02-22  7:11 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]

On 2011-02-22 05:48 +0800, Stefan Monnier wrote:
> It looks like this died down. Could the two authors of the two
> competing implementations comment on their opinion on the best way to
> replace the current C code with Elisp code?
>
> It would be good if it could be installed first as a "replace the C
> code with functionally equivalent code" and then a bunch of patches
> adding new features (e.g. addressing bug#8087).

I think first we need to find a way to clean up signalled/exited/closed
processes in the elisp version of list-processes in order to keep its
documented behaviour.

Any objection to using this:

(mapc (lambda (p)
        (when (memq (process-status p) '(exit signal closed))
          (delete-process p)))
      (process-list))

This re-use delete-process instead of another primitive.

,----[ (info "(elisp)Deleting Processes") ]
| If you delete a terminated process explicitly before it is
| deleted automatically, no harm results.
`----

I attach an implementation of list-processes in elisp that's more or
less equivalent to the primitive list-processes except it no longer pops
up an empty buffer when the process list is empty.

Best wishes,
Leo


[-- Attachment #2: emacs-process.el --]
[-- Type: application/emacs-lisp, Size: 5924 bytes --]

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

* Re: process-list in Elisp
  2011-02-22  7:11 ` Leo
@ 2011-02-22 18:10   ` Stefan Monnier
  2011-02-26 21:12   ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2011-02-22 18:10 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

> Any objection to using this:

> (mapc (lambda (p)
>         (when (memq (process-status p) '(exit signal closed))
>           (delete-process p)))
>       (process-list))

> This re-use delete-process instead of another primitive.

That sounds OK.

> ,----[ (info "(elisp)Deleting Processes") ]
> | If you delete a terminated process explicitly before it is
> | deleted automatically, no harm results.
> `----

> I attach an implementation of list-processes in elisp that's more or
> less equivalent to the primitive list-processes except it no longer pops
> up an empty buffer when the process list is empty.

Will take a look and let you know, thank you,


        Stefan



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

* Re: process-list in Elisp
  2011-02-22  7:11 ` Leo
  2011-02-22 18:10   ` Stefan Monnier
@ 2011-02-26 21:12   ` Stefan Monnier
  2011-03-03  2:00     ` Leo
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2011-02-26 21:12 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

> I attach an implementation of list-processes in elisp that's more or
> less equivalent to the primitive list-processes except it no longer pops
> up an empty buffer when the process list is empty.

In order to limit the complaints, I'd like to make sure the "more or
less" is closer to more than to less.  One thing that is immediately
obvious is that the original code uses with-output-to-temp-buffer
whereas you use something else, so your code doesn't obey the various
hooks run by with-output-to-temp-buffer.  Was there a particular reason
for this change?  Do you know of other similar changes to the behavior?
Have you followed the C source code when writing the new code, or have
you simply tried to reproduce the behavior you saw?


        Stefan



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

* Re: process-list in Elisp
  2011-02-26 21:12   ` Stefan Monnier
@ 2011-03-03  2:00     ` Leo
  0 siblings, 0 replies; 5+ messages in thread
From: Leo @ 2011-03-03  2:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Hi Stefan,

Sorry for the delay in reply.

On 2011-02-27 05:12 +0800, Stefan Monnier wrote:
>> I attach an implementation of list-processes in elisp that's more or
>> less equivalent to the primitive list-processes except it no longer pops
>> up an empty buffer when the process list is empty.
>
> In order to limit the complaints, I'd like to make sure the "more or
> less" is closer to more than to less.  One thing that is immediately
> obvious is that the original code uses with-output-to-temp-buffer
> whereas you use something else, so your code doesn't obey the various
> hooks run by with-output-to-temp-buffer.  Was there a particular reason
> for this change? 

It was probably because I original put the new buffer in its own major
mode so I didn't use with-output-to-temp-buffer. I think a bit more
about this. I think eventually it will be good to have its own major
mode to have a few more key bindings. For example, I would like being
able to mark process for deletion with 'd' and 'x', or 'D' just like in
Dired. And 'RET' to visit a process buffer and maybe 'TAB' to move from
column to column.

Do you want me to change to with-output-to-temp-buffer?

> Do you know of other similar changes to the behavior? Have you
> followed the C source code when writing the new code, or have you
> simply tried to reproduce the behavior you saw?

I would say it is pretty close. I implemented the elisp version without
looking at the C source, and tested it with processes created by
make-network-process, make-serial-process and start-process and make
sure the output is similar to the C version. So this was done in Nov
2010 and I have been using it and haven't found any unusual things.

But I didn't follow the C version literally. Just before I sent out the
last email I did look at the C source again and felt happy with the
elisp version. It would be good for someone else to compare the elisp
and C versions.

BTW, I think list-processes is probably a third-class user command.

>         Stefan

Leo



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

end of thread, other threads:[~2011-03-03  2:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-21 21:48 process-list in Elisp Stefan Monnier
2011-02-22  7:11 ` Leo
2011-02-22 18:10   ` Stefan Monnier
2011-02-26 21:12   ` Stefan Monnier
2011-03-03  2:00     ` Leo

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.