From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#41572: 28.0.50; [PATCH] Support plain project marked with file .emacs-project Date: Sat, 6 Jun 2020 02:11:37 +0300 Message-ID: <0ab90cf2-eab2-6fea-6698-4164d7753cd7@yandex.ru> References: <5f584d83-ef45-9912-bfbc-d2f00b24b9fd@yandex.ru> <87pnahjgdr.fsf@linkov.net> <87ftb92u8q.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="107751"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cc: Zhu Zihao , 41572@debbugs.gnu.org To: Theodor Thornhill , Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 06 01:12: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 1jhLVR-000Rui-NG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Jun 2020 01:12:09 +0200 Original-Received: from localhost ([::1]:53006 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhLVQ-0001Z2-B3 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jun 2020 19:12:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhLVK-0001Yp-Dx for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 19:12:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jhLVK-0003g3-5K for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 19:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jhLVK-0001Nr-18 for bug-gnu-emacs@gnu.org; Fri, 05 Jun 2020 19:12:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jun 2020 23:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41572 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 41572-submit@debbugs.gnu.org id=B41572.15913987075291 (code B ref 41572); Fri, 05 Jun 2020 23:12:01 +0000 Original-Received: (at 41572) by debbugs.gnu.org; 5 Jun 2020 23:11:47 +0000 Original-Received: from localhost ([127.0.0.1]:50296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhLV4-0001NH-Sv for submit@debbugs.gnu.org; Fri, 05 Jun 2020 19:11:47 -0400 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:52638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jhLV4-0001Mz-4P for 41572@debbugs.gnu.org; Fri, 05 Jun 2020 19:11:46 -0400 Original-Received: by mail-wm1-f43.google.com with SMTP id r9so9774921wmh.2 for <41572@debbugs.gnu.org>; Fri, 05 Jun 2020 16:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kO7Jv1p8ZOXkM42UdXLgn3IWoqVFuub4zLRVpfhEGEU=; b=IWmdshvJ6BHWKz0ZEx+jFZrxmEK6M8iucBSyFrREHK3JB4Uf8KJolgdQyVEGG4m744 UIL0d8SR+0PKJVW6YI4jCqSj7/HA534ufObZEowA6XOW5e7I8RMrinc0JwCh34CQSC5F pRbkRjRvQQ4z8p4QBacKZDV7R2G8PMje/kpq0TdMkEIBT//wehJIAIyT6UQ1z7t5uP6M 2NDqatv57Rwvs6oyzcXNX+i0bgOQUcYDzeH7cRryaU79fDUQncTbSkRbmfpOJWVnvZ6X mCbEeF/w1dak9GfY/f2ZQDYvIwdHWan2D0KsBcXBSR37UrGXeApGUbW1L8bA5cZnsQLm x8jw== 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:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kO7Jv1p8ZOXkM42UdXLgn3IWoqVFuub4zLRVpfhEGEU=; b=Z2PfGyIzJWQY079LWTXsG3Okhyrizq8SJJY/Jx50fpbx2R9QCDN4E3hHa/308drerK L/grqO9V2Y88ob175nYJmT0vosNUACg61vl66aWsuA8dW6g6mzdIePQkb8xgb+SixRCd /tZUQ6bsitfTpel9U2fhwFwhEGqKq6RfcFwzJhKtFN6TxCBNc47FzyTNM9/Ivxvnofso Ft+3zctNsztsU/6rfQBeOBN1iseel9djrb99Zou5tFwTqiNbUYjL3wFQQGaMRmr51jY+ vxoThn0/H3448vQNFqYwcQlnXpbFUamCDZ76LxSGjYy4eJIJZcksEvdzBC/E6mJTWg+5 jH9g== X-Gm-Message-State: AOAM530cmWVKeaaPdfUZfx+RnibB+DyKsCeQsH2S9vSk2sWB05Jmt/l7 q641hQ+cYQRUxBZWXm+Y8pXy153+ X-Google-Smtp-Source: ABdhPJy8H/O1eZdQ1Yjil3QX3fI3qZZod93JZBNsRrPUioyggr6DR4Lplwa+lqaR+Fa0fXpQ8KF95A== X-Received: by 2002:a1c:2e58:: with SMTP id u85mr4753495wmu.123.1591398699876; Fri, 05 Jun 2020 16:11:39 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id k13sm12299458wmj.40.2020.06.05.16.11.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 Jun 2020 16:11:39 -0700 (PDT) In-Reply-To: <87ftb92u8q.fsf@thornhill.no> Content-Language: en-US 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:181585 Archived-At: Hi! On 05.06.2020 22:22, Theodor Thornhill wrote: > "Dmitry Gutov" writes: > >> I like this suggestion better (no "special" files), but would we be able >> to avoid scope creep? Wouldn't users then expect being able to specify >> ignored directories in such projects? And then faster indexing (e.g. >> using caching), compared to the VC backend? > > Isn't this already supported? Not in the "plain" project backend as proposed. > In a major mode I'm making right now I believe I have covered both options: Ignoring is covered by the API, yes. How did you cover the caching issue? Also note that unless your new project backend is "good enough", you might make the users' experience worse as a result, at least in some respects. > (defcustom elm-root-file "elm.json" > "...") > > (defun elm-project-root (dir) > "Create the cons cell `project-root' needs to discover root." > (let ((root (locate-dominating-file dir elm-root-file))) > (when root > (cons 'elm root)))) > > (cl-defmethod project-root ((project (head elm))) > (cdr project)) > > (cl-defmethod project-ignores ((project (head elm)) dir) > (append vc-directory-exclusion-list > ;; This could also be a defcustom ofc > (list "./elm-stuff/"))) > > (add-hook 'project-find-functions #'elm-project-root) The code is good. With probably one exception: if you have a big enough project, and it's checked into Git, the VC project will be much faster at indexing files than your project implementation (because project-files by default uses 'find'). But if you also define a faster project-files override, it should be fine. Another issue is, well, if the user has a different package that defines projects installed (maybe Projectile grows project.el integration someday), or they're simply used to the VC backend, they might be surprised with some finer details unless you clearly document that your package does add a new project backend.