From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Subprojects in project.el (Was: Eglot, project.el, and python virtual environments) Date: Fri, 25 Nov 2022 23:57:51 +0200 Message-ID: <7c34024e-c2b6-033f-ff37-a0fdfc9f0cdb@yandex.ru> References: <87zgcq68zp.fsf@ericabrahamsen.net> <84781346-5b88-2be5-38bb-02696fcf1364@yandex.ru> <87o7t2vj19.fsf@dfreeman.email> <877czqtyfy.fsf@dfreeman.email> <87zgcml7g7.fsf@gmail.com> <2ba04533-097a-a1da-ff3f-2c9506fd488e@yandex.ru> <875yf9bbzb.fsf@gmail.com> <87wn7oa0aw.fsf@gmail.com> <7a5b76fd-fb15-8c1e-ea29-bf11f7e0d2ae@yandex.ru> <87bkoya815.fsf@gmail.com> <0024a67d-b8e5-b35c-1b22-82541a170eb3@yandex.ru> <871qptai4d.fsf_-_@gmail.com> <83o7swyipe.fsf@gnu.org> <83sfi7v6dj.fsf@gnu.org> <45549e6b-942f-ee99-9123-8176545a159e@yandex.ru> <83zgceu8ch.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31804"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: joaotavora@gmail.com, monnier@iro.umontreal.ca, danny@dfreeman.email, eric@ericabrahamsen.net, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Nov 25 22:58:34 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oygiQ-00087j-3f for ged-emacs-devel@m.gmane-mx.org; Fri, 25 Nov 2022 22:58:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyghs-0006I6-BD; Fri, 25 Nov 2022 16:58:00 -0500 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 1oyghr-0006Hy-H3 for emacs-devel@gnu.org; Fri, 25 Nov 2022 16:57:59 -0500 Original-Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oygho-0000U4-Mu; Fri, 25 Nov 2022 16:57:58 -0500 Original-Received: by mail-wm1-x332.google.com with SMTP id ay14-20020a05600c1e0e00b003cf6ab34b61so7107403wmb.2; Fri, 25 Nov 2022 13:57:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=gHGtHj5ycrUyNdx1xcktHqyLPr5iIjYbeGDXhjnxaK4=; b=dOGm7EaSEX/RjsD5OvNIu01GNVW7tXXhgqj9xIBnAgH87DKSOWjA/Pkwow6jiO3Los QfK8GjY0ORM8O2YCgxE0K5ZG+90AKpdG/W9sHV5miCBK0vm4i+WnfqYKkb8TzruSMqku X6LK/7hRuiS1NE3Z4xDXtlX3GdZ8r+b6KJsfY3eZdcCMTB9lO9vGisV5KzZjVV/Qgsbz a+4YCeHZweSEJX1Vm5v/1KwkNxF3qefur1FmioJ03v59XkTAW5o9jjFgrw1ev9Nuj2vW LVXyQi15M9VKAJz0mBLeTsXZ3I+JeaMZXrY61n25+nB5RW/zr8OEINwPKAXLQkqnHg7r 5MCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gHGtHj5ycrUyNdx1xcktHqyLPr5iIjYbeGDXhjnxaK4=; b=ZbRLXq7Ptn3v+su+w+1ib+NQBkDGFk1PlFkbUfPwaFThmFN/wp0KOXqaI6lCKsLSxz 5/LIhFcbBsJfKWlqem3ESXy6Y2VQ8hAcZDaN5NHH3s9tFbTVDLzedrQzBHHSZTgqAxa+ oyeE0uhC3PK+S29yyproY0PbF+6iwYf8vMuEcPKQLBtULYCB/12YeIDs351VHIi5BKB+ 5DF2cgzsIr2cw4oTrWVpPoxdSSgNCNfkkh8LOQfd4GltQNHim1m5g7GqiAwmIYzUys6/ g0BoVjUSVY5sIGMkAZHF3sfSFGpiePV8AKJ0+3h7KFfIBDxVY1aA+VTNBja5hr4wNigC klMA== X-Gm-Message-State: ANoB5pnwvvOx4p0bBY0lSuWdrofA/2l5uaL/3K4ORe/PEIFylcDc8x3w 6AumPms3bbhXwycAUtqQ4iCNRhTZLSw= X-Google-Smtp-Source: AA0mqf5Ca0nbYthOFEcLkmN8NTVRyP3khmHEHCzu2c0cyKfUm5EXqIny+7QyDiccV0wow8wrJClZAA== X-Received: by 2002:a1c:f401:0:b0:3c7:84d:72d with SMTP id z1-20020a1cf401000000b003c7084d072dmr16075165wma.181.1669413474208; Fri, 25 Nov 2022 13:57:54 -0800 (PST) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bi8-20020a05600c3d8800b003c701c12a17sm10268335wmb.12.2022.11.25.13.57.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Nov 2022 13:57:53 -0800 (PST) Content-Language: en-US In-Reply-To: <83zgceu8ch.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=raaahh@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.243, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300525 Archived-At: On 25/11/22 21:45, Eli Zaretskii wrote: >> Date: Fri, 25 Nov 2022 19:24:26 +0200 >> Cc: joaotavora@gmail.com, monnier@iro.umontreal.ca, danny@dfreeman.email, >> eric@ericabrahamsen.net, emacs-devel@gnu.org >> From: Dmitry Gutov >> >> On 25/11/22 09:30, Eli Zaretskii wrote: >>> I'm probably missing something: how does a Lisp program construct an >>> instance of a project with a known backend? For example, if the project is >>> of the 'transient' kind, how would such a Lisp program go about constructing >>> an instance without exposing/knowing about the internals of the project >>> object? I see no generic make-project API that such a Lisp program could >>> call. What did I miss? >> >> The Lisp program that constructs instances of 'transient' is >> 'project-current'. > > I meant to ask about building customized project objects, not the standard > ones that are already created by project-current. This started with a > function João wrote to that effect, and he wrote it, AFAIU, because the > standard kinds of project objects didn't satisfy his needs. No, again, he just wanted to show a quick example. With pseudocode, almost like. >> The program that creates instances of 'vc' type is called >> 'project-try-vc'. But we could similarly add a generic method belonging >> to the same unit of code (called 'project-subprojects') which would >> "belong" to the VC project backend and create a list of instances of its >> type. > > Again, you are talking about project kinds already supported by project.el > as its built-ins. I'm asking how to produce a project of a custom type. To produce a project of custom type, you decide the data structure for that type, write implementations for all the required (and perhaps some optional) generic methods, then create that structure. You asked, however, how to instantiate a project of a type belonging to "someone else". But didn't explain why. In most cases we will say it's not a good idea, but when a practical goal is described we will decide to either say "go ahead, it's okay in this case", or, hopefully, suggest a different way to reach that goal (just like I did with the 'project-parent' definition example). Or rethink and throw away the whole design (hopefully not). The reasons not to rely on internal structure, as a reminder: - The internal structures are prone to change, and you don't want your code to break when that happens. - When implementing some feature that works with projects, you generally want it to work with all kinds of projects (which was the whole point of project.el -- to make this approach work). And that would mean talking to them through common methods, rather that examine the internals of this or that project type.