From: storm@cua.dk (Kim F. Storm)
Cc: ihs_4664@yahoo.com, emacs-devel@gnu.org
Subject: Re: called by a process filter?
Date: Fri, 13 May 2005 12:21:54 +0200 [thread overview]
Message-ID: <m3sm0rs9x9.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <E1DWP3T-0001uV-U8@fencepost.gnu.org> (Richard Stallman's message of "Thu, 12 May 2005 21:33:31 -0400")
Richard Stallman <rms@gnu.org> 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 <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2005-05-13 10:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-11 19:39 called by a process filter? Kevin Rodgers
2005-05-11 20:06 ` Kevin Rodgers
2005-05-11 20:19 ` Stefan Monnier
2005-05-12 16:10 ` Kevin Rodgers
2005-05-13 9:34 ` Kim F. Storm
2005-05-13 17:46 ` Kevin Rodgers
2005-05-13 18:55 ` David Kastrup
2005-05-14 4:07 ` Richard Stallman
2005-05-12 11:16 ` Richard Stallman
2005-05-12 12:40 ` Kim F. Storm
2005-05-12 13:32 ` Stefan Monnier
2005-05-12 13:58 ` Kim F. Storm
2005-05-12 14:37 ` Stefan Monnier
2005-05-12 16:25 ` Kevin Rodgers
2005-05-13 9:31 ` Kim F. Storm
2005-05-13 1:33 ` Richard Stallman
2005-05-13 10:21 ` Kim F. Storm [this message]
2005-05-14 0:25 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3sm0rs9x9.fsf@kfs-l.imdomain.dk \
--to=storm@cua.dk \
--cc=emacs-devel@gnu.org \
--cc=ihs_4664@yahoo.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).