[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Query about Emacs Process API | Asynchronous processes
From: |
Narendra Joshi |
Subject: |
Re: Query about Emacs Process API | Asynchronous processes |
Date: |
Wed, 08 Jul 2020 00:26:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Narendra Joshi <narendraj9@gmail.com> writes:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>>> I read that section of the manual. I am still not sure what will be the
>>> use cases for this. Where in Emacs (or the package ecosystem) is this
>>> feature being used currently?
>>
>> I think it's used for `ielm`.
>>
>> Stefan
>>
> `ielm` seems to be adding a dummy process to its buffer using either
> `cat` or `hexl` binary.
>
> ;; A dummy process to keep comint happy. It will never get any input
> (unless (comint-check-proc (current-buffer))
> ;; Was cat, but on non-Unix platforms that might not exist, so
> ;; use hexl instead, which is part of the Emacs distribution.
> (condition-case nil
> (start-process "ielm" (current-buffer) "hexl")
> (file-error (start-process "ielm" (current-buffer) "cat")))
> (set-process-query-on-exit-flag (ielm-process) nil)
> (goto-char (point-max))
I, finally, found the reason for adding it. It's being used by
`gdb-mi.el`. I am still not sure how and why because I am not familiar
with `gdb-mi`.
#+begin_src emacs-lisp
;; We want to use comint because it has various nifty and familiar features.
(define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O"
"Major mode for gdb inferior-io."
:syntax-table nil :abbrev-table nil
(make-comint-in-buffer "gdb-inferior" (current-buffer) nil))
#+end_src
The feature was added to `make-process` for `gdb-mi.el` in this commit:
#+begin_src vc-git-log-view
850d0752fb8ab02e3ffc80567578f9e9a4cb77f9
Author: Nick Roberts <nickrob@snap.net.nz>
Date: Thu Aug 13 13:22:55 2009 +0000
(create_pty): New function.
(Fstart_process): Use it to allow Emacs to just associate a pty
with the buffer. See associated change in gdb-mi.el.
(list_processes_1): Deal with no program name.
(start_process_unwind): Use pid == -2 to mean no process.
850d0752fb8ab02e3ffc80567578f9e9a4cb77f9
#+end_src
Best,
--
Narendra Joshi