[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'make-comint' question
From: |
Stefan Monnier |
Subject: |
Re: 'make-comint' question |
Date: |
Wed, 31 Jul 2013 10:44:24 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> 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.
Stefan