From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#41640: 28.0.50; shell startup very slow when init file is used Date: Fri, 05 Jun 2020 08:30:11 +0000 Message-ID: <87mu5h3ofg.fsf@gmail.com> References: <87d06e4jer.fsf@gmail.com> <83h7vqar34.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="64180"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: jsynacek@redhat.com, 41640@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 05 10:31:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh7ku-000GcZ-HP for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jun 2020 10:31:12 +0200 Original-Received: from localhost ([::1]:58032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jh7kt-0000Sf-K9 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jun 2020 04:31:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jh7kk-0000SL-83 for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 04:31:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36702) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jh7kj-0007xk-Uk for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 04:31:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jh7kj-0002dz-Rx for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 04:31:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jun 2020 08:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41640 X-GNU-PR-Package: emacs Original-Received: via spool by 41640-submit@debbugs.gnu.org id=B41640.159134582510095 (code B ref 41640); Fri, 05 Jun 2020 08:31:01 +0000 Original-Received: (at 41640) by debbugs.gnu.org; 5 Jun 2020 08:30:25 +0000 Original-Received: from localhost ([127.0.0.1]:48239 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jh7k9-0002cl-2A for submit@debbugs.gnu.org; Fri, 05 Jun 2020 04:30:25 -0400 Original-Received: from mail-wr1-f65.google.com ([209.85.221.65]:36806) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jh7k7-0002cW-QS for 41640@debbugs.gnu.org; Fri, 05 Jun 2020 04:30:24 -0400 Original-Received: by mail-wr1-f65.google.com with SMTP id q11so8833201wrp.3 for <41640@debbugs.gnu.org>; Fri, 05 Jun 2020 01:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=a0pMZ3YOV6vNJUc8qhOLngY4vyMRTISynlFq2lPe+0E=; b=TWKiv5z9nLKV4Z+qbUzhTndeszPW7IdubI6RTksUAHClNBXKjHyqBza2eUP0aBeGKf REm6FYw4GPdR/av4Kj+BmvFSxO9pIA9kcF8YzFQdfxWGp5coVuJspm7eLbCzNYgvj56M IHG/DlpIey1AtqkywrRo+A/t1BUfDr6mssxiHXrJxSYOJi+p2z6bxKcyt9LvtY89dIHT Qv67qP5kjFcqFv+XiupuC1bo+qQ9FCZudpBJq8CR5rU+sn+80N8+BNln5WwqJPJf00ce Ydxz1Zxyk9CaGYMTJy222Si4RRg+IU/oHmyEmUUT8xnplvzt5N/RulpZsuTqly++6svT ZIYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=a0pMZ3YOV6vNJUc8qhOLngY4vyMRTISynlFq2lPe+0E=; b=Cr1xeB7V4VrKNufaRIX4AveQAAJKoM0ZIZDWr/s6upu2T5eHMFhFG2ewLTAmE0bv8O R8qVbysrULv9QmpxWOH9Nwvhvlc+n/1V397Ei/pe/9j1+3fweC9AeyIDP7FZo1qU7L13 NoBrnRgvlI9m6Cys9FKWr2EExVWyoeP/95h+9bwO5yCzhpbxWJb//TTPgmLQC5Iwkki+ PFg9S2pUIEyM/ZKXZdzehWDKx+gBYRJpHYDwWTHTnGfD0a/ysHC4XHRD52GqVaUXr1zQ QpNUnTRKY3+wo6xfRT2H/f/3GUtJigGnL9fgljWSjxAhqcHO7lg3c+Pc2Yr2ouYiQJOx oOGQ== X-Gm-Message-State: AOAM531DvQAMFkQT2fX0ucF6eIiPfDrpxqAEGDfPlpSROf1kjZNOOtOJ BxXX5aD489/rG0vvfQOTgGZDNtTv5F8= X-Google-Smtp-Source: ABdhPJy5a8awDO4DtsJ26oj2TroVasblnardPBREttkl6Xt+nGl+fzd/Xia20Q6WoRcdegjzyhlnkg== X-Received: by 2002:a5d:6288:: with SMTP id k8mr8025784wru.94.1591345817722; Fri, 05 Jun 2020 01:30:17 -0700 (PDT) Original-Received: from chametz ([85.248.227.165]) by smtp.gmail.com with ESMTPSA id a15sm11732336wra.86.2020.06.05.01.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 01:30:17 -0700 (PDT) In-Reply-To: <83h7vqar34.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 05 Jun 2020 10:50:55 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181539 Archived-At: Eli Zaretskii writes: >> From: Pip Cet >> 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.