[Top][All Lists]

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

Re: 'make-comint' question

From: Thorsten Jolitz
Subject: Re: 'make-comint' question
Date: Wed, 31 Jul 2013 19:37:22 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Stefan Monnier <> writes:

>> I erase and save the buffer of an config-file for an external program
>> before applying 'make-comint on that program, and restore the file to
>> its old state afterwards:
>> #+begin_src emacs-lisp
>>   [...]
>>   (erase-config-file-for-external-process)
>>   (set-buffer
>>    (apply 'make-comint name (car cmd) nil (cdr cmd)))
>>   (rename-buffer "buffer-name")
>>   (restore-config-file-for-external-process)
>>   [...]
>> #+end_src
>> When I edebug my code, it does exactly what it should, and the new
>> inferior subprocess starts without the (unnecessary) configurations
>> of the erased config file, as it should.
>> However, when I simply run my code without debugging, the new
>> inferior subprocess starts _with_ the (unnecessary) configurations,
>> what seems quite strange to me. 
> The code after `make-comint' is run concurrently with your external
> process, so you have a race-condition: if Emacs is quick enough it will
> restore the config file before the process gets to read it.

I suspected something like this, thanks for the tip. Thus a use case for
`sit-for', I would guess ...

I already followed up to this post, but my last 3 posts on this list
apparently did not get through - did I make it on the spam list?


reply via email to

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