unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: How to post-process the buffer populated by the async `start-process'
Date: Fri, 11 Jan 2019 22:34:53 -0500	[thread overview]
Message-ID: <CAFyQvY3a4y+u2V==e17e_Lxu9z5pm9JODQY9kfPLdeD-EWEoRg@mail.gmail.com> (raw)

Hello,

I am using a package which starts a command in a subprocess (async) using
`start-process' and the results of the command are dumped in the buffer arg
passed to subprocess.

But the stdout sent to the buffer has ANSI escape codes.

If I manually visit that buffer, and eval (ansi-color-apply-on-region-int
(point-min) (point-max)), I can see the ANSI color codes nicely rendered.

But I cannot figure out how to do that *when* the start-process initiated
command ends *in* the specified stdout buffer.

If I do:

(apply #'start-process ..)
(with-current-buffer buffer
  (ansi-color-apply-on-region-int (point-min) (point-max)) )

.. it of course doesn't work because the a-c-a-o-r-i is getting called
before start-process initiated command ends.

So I somehow need to define a hook that can get triggered when that command
ends, and then call the a-c-a-o-r-i function. But I don't know how.

--
Kaushal Modi


             reply	other threads:[~2019-01-12  3:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-12  3:34 Kaushal Modi [this message]
2019-01-12  6:32 ` How to post-process the buffer populated by the async `start-process' mail
2019-01-12 16:10   ` Kaushal Modi

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='CAFyQvY3a4y+u2V==e17e_Lxu9z5pm9JODQY9kfPLdeD-EWEoRg@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).