From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sMGiMegBRmNaKQAAbAwnHQ (envelope-from ) for ; Wed, 12 Oct 2022 01:53:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id uDN0MegBRmMFvwAAauVa8A (envelope-from ) for ; Wed, 12 Oct 2022 01:53:12 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5A73E353B1 for ; Wed, 12 Oct 2022 01:53:12 +0200 (CEST) Received: from localhost ([::1]:43990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oiP3e-0002hR-Vy for larch@yhetil.org; Tue, 11 Oct 2022 19:53:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiP2x-0002h4-K3 for emacs-orgmode@gnu.org; Tue, 11 Oct 2022 19:52:27 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:44685) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oiP2v-0002gU-Tm for emacs-orgmode@gnu.org; Tue, 11 Oct 2022 19:52:27 -0400 Received: by mail-pj1-x102d.google.com with SMTP id t10-20020a17090a4e4a00b0020af4bcae10so435866pjl.3 for ; Tue, 11 Oct 2022 16:52:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=/JuT4OjVTs7g15KtkmAy74s4xxseYVC+8KNwj16O+Y8=; b=ndGeKPAl5qQ2tnaR355nBSHu9fq/+b/z3+i2wiWiJWmZaqYPc+xaMYaoHDe+ig4QYO tR7WdvVVYDskaePYp3IXeTBCHQ8sMF2iTmKgZeWzcEwZV5/ZoWOwpzYnOn7XmrhBtBBg DMKra+BFea0+h6Gwqpjn8ji71Nd2mnBPJ7tnGX8kTXsajOnOM/DWsZemXmJb/UAaaaQY gCRw3pMSjPvHi4H3j0iFf5H1RbfXoTGGW4t/knAdEvNhuN236iH9TTbSXdoTC70RhsDe vVLmh0wWps1JwWS+Jsdi/2jNoy+OlqYrp2ofkwSSE10aB31QP9timY0K+RKKlAnaHCW1 MK7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/JuT4OjVTs7g15KtkmAy74s4xxseYVC+8KNwj16O+Y8=; b=NWph6XMwpSTBMvll7jqClLEB5ezlpfJvpQRxwBADNj7aHof62p5hSMY2qh6q4p4iaD /kHqGLGhC3bqvBM9cydKTvAhTmdzgrjbL4PemXIEijTuVxv9dn+r5/GjtRnLC+nqQuA0 Rd8bzmeZ4PG2O/AWVDbF75jt69BQFh8adb2Fdq1PwPSN+yu+3sPusuxftaiZCdXo6bnG NYlMaecHKlie+zZTvu4qzKY4xubTHqJSvLhdUhFnq8CblHJYJC/4Koji9Y0FtPBx9zdO OiS+cSSOoP71NFRiTZ9fbiy17DRmr0Om9b3Bk1dUisXISWDVdiQOUO0fIBNaftKWuL73 5keg== X-Gm-Message-State: ACrzQf2ERc8eAfoqZ3XLR5y8DC/9BjcX1LBPyOKEweUGhJjjydD7GBHm 2ReMQi5zwFiFfxc2+gqNWVw= X-Google-Smtp-Source: AMsMyM4r3kRgThcWrK32HigA9ZyPJnrbA3kiaIuvfmeoKPkxRpAanV+8tT0WnbW7C8yzcudO5e0WZg== X-Received: by 2002:a17:90a:c388:b0:20a:db9d:8337 with SMTP id h8-20020a17090ac38800b0020adb9d8337mr1789079pjt.61.1665532344017; Tue, 11 Oct 2022 16:52:24 -0700 (PDT) Received: from localhost (ResNet-33-76.resnet.ucsb.edu. [169.231.33.76]) by smtp.gmail.com with ESMTPSA id u15-20020a17090abb0f00b0020d51aefb82sm143878pjr.19.2022.10.11.16.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 16:52:23 -0700 (PDT) From: Karthik Chikmagalur To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] LSP support in org-src buffers In-Reply-To: <87mta5ease.fsf@localhost> References: <87bkqmdhqz.fsf@gmail.com> <87mta5ease.fsf@localhost> Date: Tue, 11 Oct 2022 16:52:22 -0700 Message-ID: <877d157wax.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=karthikchikmagalur@gmail.com; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665532392; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/JuT4OjVTs7g15KtkmAy74s4xxseYVC+8KNwj16O+Y8=; b=F/CmoHsy4G679r+NXIlYDmxr3oRXslsSuABm7Dx6S6/MTM0Gr+z2N7TuJ0H5HNr0prMs9k 2teV3qYfvpK73fsxnSM37ub4fI2OO/Z5xgUGeHTENWajGN42uVWr40MezGQ/zXBty/Jb5I 0ErDvSFum1RgSGfmSqyOhVXkNOstK4DU8VzN6v8fLQn1XkjDPvuzHKnyEihCWaeDIuzjVI 8Bu7AqcSQPxWDbHeU1qt1E1HKaq+YDBQ0d0YawXHL0W3UizGNBlH6ZN4zqoTBeZwv9tAXv tRelu9c+x9U4K5N+3Y3ZR4Jy3hmQ1MpPqCB3j6JPiUkHGZ5iVQUvFxpk1qsSmg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665532392; a=rsa-sha256; cv=none; b=YVd8M66B49bo3CJmk08EmLn4I6DQ1opYPrbLKe0XmSA9LUTDH7jbXb/x7nwrfDau5nUI/B W8ZJK2/rls39zsTbRuIzT5unDANSF+fjiJFNp+MYIuZigA4xhdhr1EuKCm5eaXSN09S9wT x5iSFx7WYOqRPZzHnEmOuS0BY9v/DP6NfC6wyx1oQMuYa1s6pUHNI106qQSEhd7a7I+O3N srSyR1Mq7IQuLKQw9yDttEvS2UP6yzzXGYeCgJYMClitpYyKWoT987FwVJ6r/SOm8oC3Cx xS9VIlCkTJsPtei2TCSGrhnnQ0mIfnQLA+Pw0fjsnuFvSYizg2xWq97y+oDM9w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ndGeKPAl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.89 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ndGeKPAl; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 5A73E353B1 X-Spam-Score: -3.89 X-Migadu-Scanner: scn1.migadu.com X-TUID: k+7rX6Q+/MJ+ > This is not limited to Eglot support. M-x compile, eglot, project.el, > xrefs, and similar tools all assume that current code buffer is > associated with a real file in a real project folder, possibly > containing all kinds of hints like .gitignore, .dir-locals.el, etc. I hadn't considered this. This makes context-aware org-src support even more important. > This sounds a bit fragile and full of caveats. > > You already implemented a way to associate the org-edit-src buffer with > the fully tangled code. Then, why not make it simple and do the real > tangling first and then make org-edit-src work directly with a real > file buffer associated with the tangled file? > > All the tools, including Eglot will then work naturally and as intended. This will drastically simplify the patch, true. I was working on the assumption that since tangling overwrites the file on disk, it should not be an implicit operation invoked as a side-effect of another action. It causes other changes that the user might not have intended, like updating timestamps on the tangled file, etc. What do you suggest? Moreover, for Eglot to function correctly it is sufficient to (i) associate the buffer with a file -- any file, and (ii) Set the default-directory variable to the correct value. "Tangling" to a file in /tmp (as I do in the patch) will not work with all the non-Eglot use-cases you describe above. > The only tricky problem I am seeing with your approach is dealing with > noweb references. Care should be taken about editing code blocks > containing noweb. If I reuse the actual tangling machinery in ob-tangle instead of writing my own version reusing only some of the primitives in this library, this should be handled automatically for me. Is this correct? > Our to-be-released main branch does tangling orders of magnitude faster. > For example, my config.org with 660 src blocks tangles within 1.3 sec. > > This can be made even faster by extra caching if there is a real demand > for super-fast tangling. That's a giant improvement over the current implementation. I'll keep this in mind when working on the patch. Also: org-src-context-mode works by advising some org-edit-src-* functions. Is it preferable to edit these functions directly instead and add a check for whether org-src-context-mode is enabled? Karthik