all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Monsanto <chris@monsan.to>
To: emacs-devel@gnu.org
Subject: replacing process sentinels and filters with hooks
Date: Mon, 1 Oct 2012 09:14:12 -0400	[thread overview]
Message-ID: <CAC5n7TEBD=MSjGhTByr+Xk9g-MCLmyzU2edwWa7REehJQEbPmw@mail.gmail.com> (raw)

Hi all,

I have been working to improve the shell and comint modes. More on
that later; the reason I am writing is to complain about--and suggest
backwards compatible changes for--the process APIs.

There are three problems.

1) Process filters and sentinels do not fit in with the rest of the
Emacs API. In every other API that I can think of that involves a user
callback, the hooks API is used.
2) A process sentinel must parse text to figure out how the process
changed. It'd be easier to use if we returned structured data that
could be taken apart by pcase.
3) It's hard for more than one interested party to interact with a process.

My proposed change is to add a new function, (process-hook-list
<proc>), which returns a list of hooks. Each hook takes one argument,
which has one of the following forms:

'(input <string>)
'(signal <signalcode> <core dump flag>)
'(exit <exitcode>)

The various cases can be handled easily with the pcase primitive.

For backwards compatibility, a process' hook list comes with one hook
already added. This hook acts as a proxy to the old filter/sentinel
interface; if the user changes the filter or sentinel, the default
hook is modified appropriately. It is important to realize filters and
sentinels through the hook interface in case the user wants to fake
signals through (run-hooks (process-hook-list ..))

Any and all feedback is welcome. Did I miss anything? Do these changes
seem reasonable? If so, I would like to have sole responsibility for
implementation--I am trying to learn the Emacs C source and this seems
like a great way to do so. My copyright assignment papers are already
in transit.

Thanks for your time,

Christopher Monsanto
chris@monsan.to  --  http://monsan.to/



             reply	other threads:[~2012-10-01 13:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-01 13:14 Christopher Monsanto [this message]
2012-10-01 14:42 ` replacing process sentinels and filters with hooks Paul Eggert
2012-10-01 15:20   ` Christopher Monsanto
2012-10-01 15:34 ` Stefan Monnier
     [not found]   ` <CAC5n7TGfMktPFOwpSqeqC6pF9rtpx14_fQaouEVnWmma2SfzdA@mail.gmail.com>
2012-10-01 16:53     ` Christopher Monsanto
     [not found]     ` <jwvboglmxm8.fsf-monnier+emacs@gnu.org>
2012-10-03 10:59       ` Christopher Monsanto
2012-10-03 13:37         ` Stefan Monnier
2012-11-13 17:58           ` Stefan Monnier
2012-10-03 14:39         ` Stephen J. Turnbull

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='CAC5n7TEBD=MSjGhTByr+Xk9g-MCLmyzU2edwWa7REehJQEbPmw@mail.gmail.com' \
    --to=chris@monsan.to \
    --cc=emacs-devel@gnu.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.