From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: called by a process filter? Date: Fri, 13 May 2005 12:21:54 +0200 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1115981285 19303 80.91.229.2 (13 May 2005 10:48:05 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 May 2005 10:48:05 +0000 (UTC) Cc: ihs_4664@yahoo.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 13 12:48:03 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DWXhz-0008LD-W4 for ged-emacs-devel@m.gmane.org; Fri, 13 May 2005 12:47:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DWXr7-0002Cw-Az for ged-emacs-devel@m.gmane.org; Fri, 13 May 2005 06:57:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DWXZp-0003cB-Jx for emacs-devel@gnu.org; Fri, 13 May 2005 06:39:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DWXZh-0003bS-Gc for emacs-devel@gnu.org; Fri, 13 May 2005 06:39:21 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DWXWI-0002FQ-MF for emacs-devel@gnu.org; Fri, 13 May 2005 06:35:50 -0400 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.34) id 1DWXPd-00050Y-Nz for emacs-devel@gnu.org; Fri, 13 May 2005 06:28:58 -0400 Original-Received: (qmail 79178 invoked from network); 13 May 2005 10:21:52 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 13 May 2005 10:21:52 -0000 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Thu, 12 May 2005 21:33:31 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:37074 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37074 Richard Stallman writes: > Binding a non-command object (a process) to this-command looks quite > obscure and unclean to me. > > To me it seems natural. The filter was not run by any user command, > so I'm suggesting the idea that the command that ran the filter code > is the process itself. > Lots of commands look at this-command (and internally we copy it to > last-command etc). I could envision this change breaking code in > mysterious ways. > > If something looks at this-command inside a process filter, it is > probably broken already. In general it is unpredictable what command > is running, or was just running, when the process filter is called. > So such code would currently get unpredictable results. True. We should set this-command to nil while we a reading a key sequence at the top level (and thus may run anync code). > > It would indeed be safer to use a new variable, though. > It is also cleaner: Consider this example: 1) User runs command my-command. 2) my-command calls accept-process-output. 3) accept-process-output calls a filter, my-filter. 4) my-filter tests this-command. 5) my-command continues. 6) my-command tests this-command. So what value should "this-command" have in step 4 ? IMO, it should still be "my-command", as that is the command currently executing. And just for completeness, "this-command" should also be "my-command" in step 6 (even if it was something else in step 4). I suggest to add a new variable `this-process' that is nil normally, but contains the current process when executing a filter or sentinel, or just inserting data in a buffer (which may also run after-change-functions I suppose). -- Kim F. Storm http://www.cua.dk