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: Project local variables. Date: Sun, 8 Nov 2020 03:48:45 +0200 Message-ID: References: <20201103194140.cyjy56zgx7757pxx.ref@Ergus> <20201103194140.cyjy56zgx7757pxx@Ergus> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5198"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 To: Ergus , Emacs-Devel List Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 08 02:49:33 2020 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 1kbZpl-0001Hd-AM for ged-emacs-devel@m.gmane-mx.org; Sun, 08 Nov 2020 02:49:33 +0100 Original-Received: from localhost ([::1]:41922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbZpk-00085H-C3 for ged-emacs-devel@m.gmane-mx.org; Sat, 07 Nov 2020 20:49:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47072) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbZp6-0007eZ-Ip for emacs-devel@gnu.org; Sat, 07 Nov 2020 20:48:52 -0500 Original-Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]:41005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kbZp4-0006Cz-3g for emacs-devel@gnu.org; Sat, 07 Nov 2020 20:48:52 -0500 Original-Received: by mail-ed1-x52f.google.com with SMTP id t9so1712453edq.8 for ; Sat, 07 Nov 2020 17:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gX+7Rw6OHwnJbqDqN9nJVN4WrcEbl0SLiu8zQjztvhk=; b=bSdaYapEFaFRzW4dCZkO12ZM3R1nF9+b1Vt5kvJmHjf593gb6CPAbMItDPfCiYIdCN 0tG8QAsDYoug0eB81XZbNLZYNksBnbKnlH4F2Im86iOu3oCrGfFJ4TbwXxbLC6WY255e dTMt6Ob34rtT/bSRHpBoB3oYebM4xLfWdHGHqhqG7EbROVTd+PD8EW/1mTscH868Dwdh 96TBCF6HX4VLmHocTDwS54CgwoMuoo8bC/spuZBM49wn/e69DNA08ZbKzf53/M6dUBrS v4l2rwbg6mFuMqIOjNqBcsrisVa5HyeFaT7Gk8AYfg7O6LYPL/xDIUjrqm/cH+YbJqjv yxSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gX+7Rw6OHwnJbqDqN9nJVN4WrcEbl0SLiu8zQjztvhk=; b=rFILJvNO9yxrJMl2PsAXQmVroXKZhQ3jO/JVADwoduEQutF4Oun8VwU2lEJKsA6Hdv 98EveYifLBbnkrr/NGxrXIf8zXMxaxmZxsvQXjxR/OuCx3xJ/AhYXz4issd/afvmPZsk FXJWv/n4k+7AYRNYxfbZvtbNedtHl/tX7KP0uixwMSf0WxL7yM3Ds/oO5C2myVFmqJ5q ODTpMXpkNqITd1K2OAubX7S19H3QF+yYswleO8nzYiv+j87tGO9CR5ShSJ2Kj+PzvlVn kb7R23aS/kuhBXJAxKg9KbFaobtqrqlTlaPHObHkX/USzR4+ZzY6s4HlnpqTzuKVc5AY PNHw== X-Gm-Message-State: AOAM533Za/dbNxA99fIYtipaaHkBr/XuqUkK9rxuTHqfOVr2y+019j+0 QXdUDvPPKF+e9KByip7IxV5YC0H1IFWhjw== X-Google-Smtp-Source: ABdhPJwJBBUciNB1fOAWCY28VtONfNtnVLLF+/PFHbmdwvbQIBsHEtv/IZDSiCfHLz/baMEx9MSU9w== X-Received: by 2002:a50:ff02:: with SMTP id a2mr8717507edu.364.1604800127663; Sat, 07 Nov 2020 17:48:47 -0800 (PST) Original-Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id u23sm4746516ejy.87.2020.11.07.17.48.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 07 Nov 2020 17:48:47 -0800 (PST) In-Reply-To: <20201103194140.cyjy56zgx7757pxx@Ergus> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=raaahh@gmail.com; helo=mail-ed1-x52f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.25, 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.23 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" Xref: news.gmane.io gmane.emacs.devel:258881 Archived-At: Hi! On 03.11.2020 21:41, Ergus wrote: > Looking at the evolution of project.el I want to know if there is any > sort of project local environment/namespace/scope. The idea is to > provide some variables that could be shared by all the files in the same > project but that could be modified by external-packages at the elisp > level. something like "setq-project"?? Something like project-set and project-get could be arranged (or perhaps just a project-session hash table). But given that the values won't persist between Emacs sessions, we'd have to consider to use cases first. > A use case is for example when working in tramp some operations are > expensive like looking for an executable in the remote system. The > search could be made only once; but then if a local file is open the > cached value will be wrong. The other case is to use the buffer-local > variables, but then it will need to be initialized once/per file every > time a file is open. Something that in my case affected performance > especially with lsp and elpy Two things to consider: the performance of the operation you're trying to "cache", and the performance of 'project-current'. The latter is not "free". And my near-term plan is to make project-try-vc slower by removing the vc-file-getprop/vc-file-setprop dance because it can lead to outdated information. Or at least try that and see which problems that brings. In any case, what I'm saying is, 'project-current' on a remote host might not be fast either. Though it could be cached to at least only do the search once per user command. > Currently I am using a work-around with a global hash-table and a > variable definer in the dir-locals.el as a prefix, but maybe something > more elegant should/must be already implemented and I am not aware of?? Have you tried using (file-remote-p buffer-file-name) as the hash key? If the operation to be sped up is really (executable-find "cat"), the result is really project-independent and should only depend on the host. If there are other, actually project-dependent examples, the project-local variables (or "session cache", rather) could be implemented as a hash of hashes, keyed by project instance. There implementation seems like it will be rather trivial, but first I would like to know the use cases.