unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17139: Race condition in complete-in-region: should we be using pre-command-hook, not post-command-hook?
@ 2014-03-29  2:18 Daniel Colascione
  2014-03-29  2:39 ` Daniel Colascione
  2016-06-04 22:17 ` Noam Postavsky
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Colascione @ 2014-03-29  2:18 UTC (permalink / raw)
  To: 17139

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]

Say we're using a mode derived from comint that implements completion by
using the comint redirection functionality to send commands to the
process associated with the comint buffer. Say we have TAB bound to
complete-symbol. If the user presses TAB (to create a list of
completions) and then immediately presses RET to run comint-send-input,
we send the input to the subprocess, but don't wait for a reply. Then we
run post-command-hook; completion-in-region--postch is on the list of
hooks to run. This function runs completion-in-region-mode--predicate,
which makes a hidden call to the subprocess; this hidden call involves
writing a command waiting for a reply. But because we just sent the
*user* line in comint-send-input, we might actually read the response to
*that* line instead of the internal completion command, causing an
error. The response to the internal completion command then appears in
the comint buffer.

Why can't we do the completion-in-region--postch stuff in pre-command-hook?


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-04 22:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-29  2:18 bug#17139: Race condition in complete-in-region: should we be using pre-command-hook, not post-command-hook? Daniel Colascione
2014-03-29  2:39 ` Daniel Colascione
2014-03-30 21:39   ` Stefan Monnier
2014-03-30 21:49     ` Daniel Colascione
2014-03-31 12:40       ` Stefan Monnier
2014-03-31 18:20         ` Daniel Colascione
2016-06-04 22:17 ` Noam Postavsky

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).