From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christopher Monsanto Newsgroups: gmane.emacs.devel Subject: replacing process sentinels and filters with hooks Date: Mon, 1 Oct 2012 09:14:12 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1349097309 19853 80.91.229.3 (1 Oct 2012 13:15:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Oct 2012 13:15:09 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 01 15:15:15 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TIfq4-0000vN-8M for ged-emacs-devel@m.gmane.org; Mon, 01 Oct 2012 15:15:12 +0200 Original-Received: from localhost ([::1]:60610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIfpy-0002G9-Kt for ged-emacs-devel@m.gmane.org; Mon, 01 Oct 2012 09:15:06 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIfpr-0002Dq-Ku for emacs-devel@gnu.org; Mon, 01 Oct 2012 09:15:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TIfpl-0007Xg-QB for emacs-devel@gnu.org; Mon, 01 Oct 2012 09:14:59 -0400 Original-Received: from mail-vb0-f41.google.com ([209.85.212.41]:36340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TIfpl-0007Xa-M3 for emacs-devel@gnu.org; Mon, 01 Oct 2012 09:14:53 -0400 Original-Received: by vbkv13 with SMTP id v13so6013823vbk.0 for ; Mon, 01 Oct 2012 06:14:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :x-gm-message-state; bh=mOw/iyrXBr3h9AyS8NuXXR4ut1uXLqkuO5y+1O33zAA=; b=XGR8dQCsB0jxpGqZYOduXScSfwEzcDeAApzNuf/RKJmi2lxv/eObba0EjC0GaiBOLh svrgh/GIJWQQo3NsfsSVDwVLTyCVqbt+ANAg3+dXespa/UyZBNemYF78AEu4WrN+O/sk sMd68AVM1ZsLQFLm79RjjCuEFyJEVRglGLT8KFRE38eCGB+9WhN/isy9EF3p0Mr1/gkm fZEckhu8Smr+seiEqyV9Ztd12Z99zOLx+hDmTcvRD2weIS/QXOlskhRkcdNXvxDFyLt4 fZ+JROBEMQDqHyQNs3unBkD5VLNxvJmOGQicuAVNBBBS0ey/BKzR3jnZWrmkEbpnSbej CRgw== Original-Received: by 10.58.0.7 with SMTP id 7mr8568685vea.18.1349097292664; Mon, 01 Oct 2012 06:14:52 -0700 (PDT) Original-Received: by 10.220.235.132 with HTTP; Mon, 1 Oct 2012 06:14:12 -0700 (PDT) X-Gm-Message-State: ALoCoQmopm/eLIicDUdhMMEj/g4EjWqRR7cFtBwjpsSBcrb+uRuZGl3ydjPFeUYLSGW7hzm63dx0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153823 Archived-At: 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 ), which returns a list of hooks. Each hook takes one argument, which has one of the following forms: '(input ) '(signal ) '(exit ) 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/