help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: call-process and incremental display of output


From: Stefan Monnier
Subject: Re: call-process and incremental display of output
Date: Fri, 19 Oct 2018 22:06:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> spin up a curl process that connects to our CI server and display the
> log output of a build.  The server stream the log output as a sequence
> of json messages that have to be parsed and appended to the buffer.  I
> used to do that with the following snippet of code:
>
>     (with-current-buffer log-buffer
>       (save-excursion
>         (goto-char (point-max))
>         (insert log-line)))

Ah, this one.

> FYI, what I currently have is something like this:
>
>     (let ((pos (copy-marker (point) t)))
>       (ignore-errors
>         (goto-char (point-max))
>         (insert payload))
>       (goto-char pos))

Yes, many/most process filters end up doing that (tho others use
insert-before-markers instead, which comes with other problems).

Given how pervasively save-excursion is used, I think changing its
behavior is very risky.  Admittedly, it didn't prevent me from changing
it by dropping the mark handling from it.
And window-point-insertion-type is used fairly rarely, so maybe the
impact would not be quite as widespread as it seems.

Anyway, it's luckily not my call to make ;-)

I'd suggest you try running with such a change for some months, trying
to use a variety of packages and see if you bump into problems.


        Stefan



reply via email to

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