From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61350: Eglot over Tramp freezes with large project Date: Thu, 16 Mar 2023 16:36:03 -0400 Message-ID: References: <87y1ootw2t.fsf@gmail.com> <87pm9fk6ht.fsf@gmx.de> <87mt4jzf8q.fsf@gmail.com> <87fsabh2z2.fsf@gmx.de> <87edpvxu7w.fsf@gmail.com> <87bkkzgyb8.fsf@gmx.de> <87lek2x09t.fsf@gmail.com> <875yb646d1.fsf@gmx.de> <87fsa7mw9x.fsf@gmx.de> <87fsa7l6o6.fsf@gmx.de> <87a60fl4p7.fsf@gmx.de> <878rfx6bqe.fsf@gmail.com> <8e031bc5-7ac3-620e-b1ca-aaa872b3cdde@gmail.com> <87lejw3jx4.fsf@gmail.com> <874jqk3cxp.fsf@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15737"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Thomas Koch , Jim Porter , Michael Albinus , 61350@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 16 21:37:18 2023 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 1pcuLd-0003qP-CE for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Mar 2023 21:37:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcuLS-0005Gz-6f; Thu, 16 Mar 2023 16:37:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcuLP-0005Gb-Nq for bug-gnu-emacs@gnu.org; Thu, 16 Mar 2023 16:37:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcuLO-0002uQ-Eg for bug-gnu-emacs@gnu.org; Thu, 16 Mar 2023 16:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pcuLO-0003Lk-5l for bug-gnu-emacs@gnu.org; Thu, 16 Mar 2023 16:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Mar 2023 20:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61350 X-GNU-PR-Package: emacs Original-Received: via spool by 61350-submit@debbugs.gnu.org id=B61350.167899897512822 (code B ref 61350); Thu, 16 Mar 2023 20:37:02 +0000 Original-Received: (at 61350) by debbugs.gnu.org; 16 Mar 2023 20:36:15 +0000 Original-Received: from localhost ([127.0.0.1]:43179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcuKd-0003Kk-A3 for submit@debbugs.gnu.org; Thu, 16 Mar 2023 16:36:15 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:29135) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcuKZ-0003KV-W2 for 61350@debbugs.gnu.org; Thu, 16 Mar 2023 16:36:13 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D61741000D6; Thu, 16 Mar 2023 16:36:05 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4F5481000BD; Thu, 16 Mar 2023 16:36:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1678998964; bh=ND2MkrHTnElMzQ1S6u2U8ReTbQVCz6Rd/HH1YwJKSOY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HrsUnALbnLt5xB2yKerREtw1UwVwnRdmamjE+FBSm44qgTeAWEp7POk2uvVAymfSQ e1emqeYcobFWEuR9Q9zDn5xQrh24d+gIR0nLMqai5//+butGuIV8PqH8FRAC7tVXgy lUddLJ4pLLxu+4xqCWMkOAbl2xr0f2F/vcb3dY7N8vOzXFbGOeGVVin1SRU2+c8W2I stcSOE3X0FNNwcRf9CaxAJTOswtL+fAo3/1BjlXwcl9ItCr/u5d3HuMbLjIK/SekZQ 9CGQjxwYyvq30eq/W3uguqjZq3nO/nfbUa6sk0ugSLRLR4UrNMPA83VhRy1fbTEjHa xhHOb9LsWQgHg== Original-Received: from ceviche (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 171A9120903; Thu, 16 Mar 2023 16:36:04 -0400 (EDT) In-Reply-To: <874jqk3cxp.fsf@gmail.com> ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Thu, 16 Mar 2023 15:58:58 +0000") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258037 Archived-At: > The gist it is, but also very broken. As ever, vapourware sucks. This > is what that snippet should have been: > > ;;; hal.el --- asdasd -*- lexical-binding: t; -*- > (defvar hal-proc nil) > (defun hal-connect() > (interactive) > (when (processp hal-proc) (delete-process hal-proc)) > (setq hal-proc > (make-process > :name "halproc" > :command (list (expand-file-name "hal" default-directory)) > :buffer (generate-new-buffer "*halbuf*") > :filter (lambda (proc output) > (internal-default-process-filter proc output) > (when-let* ((buffer (process-buffer proc)) > (callback (and (buffer-live-p buffer) > (process-get proc 'callback)))) > (with-current-buffer buffer > (save-excursion > (goto-char (point-min)) > (when (search-forward ", DAVE\n" nil t) > (unwind-protect (funcall callback > (buffer-substring > (point-min) (point))) > (process-put proc 'callback nil) > (delete-region (point-min) > (point))))))))))) > > (defun hal-command () "Synch command to HAL that doesn't block others." > (interactive) > (message > (catch 'hal-done > (process-put hal-proc 'callback > (lambda (result) (throw 'hal-done result))) > (process-send-string hal-proc "OPEN THE POD BAY DOORS!\n") > (while (accept-process-output hal-proc))))) :-) I think doing more of the work asynchronously (i.e. from the process's filters/sentinels rather than after `accept-process-output`), like in this example, is virtually always better, yes. The use of `catch/throw` is not applicable to code which may be used asynchronously (i.e. where we don't know that there's always a `catch` waiting for our `throw`), so I hope we can get code to work just as reliably without using `catch/throw`. This mission is too important for me to allow you to jeopardize it. Stefan