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

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

bug#41640: 28.0.50; shell startup very slow when init file is used


From: Pip Cet
Subject: bug#41640: 28.0.50; shell startup very slow when init file is used
Date: Fri, 05 Jun 2020 08:30:11 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:
>> From: Pip Cet <pipcet@gmail.com>
>> Date: Thu, 04 Jun 2020 21:21:00 +0000
>> Cc: 41640@debbugs.gnu.org
>> 
>> diff --git a/lisp/comint.el b/lisp/comint.el
>> index ea06f8af87..4354a155c3 100644
>> --- a/lisp/comint.el
>> +++ b/lisp/comint.el
>> @@ -809,18 +809,10 @@ comint-exec
>>        (goto-char (point-max))
>>        (set-marker (process-mark proc) (point))
>>        ;; Feed it the startfile.
>> -      (cond (startfile
>> -         ;;This is guaranteed to wait long enough
>> -         ;;but has bad results if the comint does not prompt at all
>> -         ;;      (while (= size (buffer-size))
>> -         ;;        (sleep-for 1))
>> -         ;;I hope 1 second is enough!
>> -         (sleep-for 1)
>> -         (goto-char (point-max))
>> -         (insert-file-contents startfile)
>> -         (setq startfile (buffer-substring (point) (point-max)))
>> -         (delete-region (point) (point-max))
>> -         (comint-send-string proc startfile)))
>> +      (when startfile
>> +        (comint-send-string proc (with-temp-buffer
>> +                                   (insert-file-contents startfile)
>> +                                   (buffer-string))))
>
> The code and the comments don't say why we used sleep-for, which your
> patch removes.  Did you succeed in understanding what was that for,
> and if so, can you describe that reason and the rationale for removing
> the sleep?

I'll try. (According to git, this code has been here since 1990). The
code inserted the file contents of the startfile at (point-max) in the
comint *output* buffer. I believe the concern was that
insert-file-contents would accept process output, corrupting the start
file, and it's possible this may happen, at least with tramp
handlers. Therefore, to avoid the process output being sent back to the
process, I think the sleep-for was added as a way to ensure the program
was done displaying the prompt.

If the patch helps (it does here), we're going to have to think about
whether to apply it on master, but I'm not that far yet.





reply via email to

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