emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

replacing process sentinels and filters with hooks


From: Christopher Monsanto
Subject: replacing process sentinels and filters with hooks
Date: Mon, 1 Oct 2012 09:14:12 -0400

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
address@hidden  --  http://monsan.to/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]