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.devel Subject: Re: project.el: git submodules? Date: Thu, 14 May 2020 22:29:23 +0300 Message-ID: References: <875zd1ni5i.fsf@md5i.com> <55769244-c84c-dff0-4427-9ff688f81af5@yandex.ru> <87v9l0nar5.fsf@md5i.com> <95a8c285-125f-afda-b1bc-d1c0452e5c31@yandex.ru> <1bc2052e-b26b-1f3d-f78c-a22112861f27@yandex.ru> <7b247aac-28bd-94c1-2546-524edde9b781@yandex.ru> <42510ba9-1235-7180-af36-2d9de24835b4@yandex.ru> 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="36445"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cc: Michael Welsh Duggan , Gary Oberbrunner , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu May 14 21:48:27 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 1jZJqE-0009Mq-8J for ged-emacs-devel@m.gmane-mx.org; Thu, 14 May 2020 21:48:26 +0200 Original-Received: from localhost ([::1]:46746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jZJqD-0008UH-6B for ged-emacs-devel@m.gmane-mx.org; Thu, 14 May 2020 15:48:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jZJXt-0003RF-4r for emacs-devel@gnu.org; Thu, 14 May 2020 15:29:29 -0400 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:36763) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jZJXs-0000Ek-3D for emacs-devel@gnu.org; Thu, 14 May 2020 15:29:28 -0400 Original-Received: by mail-wr1-x434.google.com with SMTP id y16so120600wrs.3 for ; Thu, 14 May 2020 12:29:27 -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=Kc37ca8dK1Ke+7g01bs8rpMjxibFaTjmzfOtrvZwThY=; b=k6KWitFsCFMPNwG57TsUKivHgRhbMy/8RAjudZ5gOyHWpPERdCSOqHt3YEky28FC6U rbN/JrvDNCaoXEJkPUcy4LmPltq2rbBX1vP7MA/vS4rtkH2f5p8/Mhp317p0pwc1HC8U 0oJW9ibbas0mVUT2M9FCPQolfdNyLiuxsw2TEd5YDNBtXoh9YI0TpPQOPkiBjova1gsj CH7gZQokWtIekHAUxQuE9hf4DlkCoSACL/ICnBkCCnNEk4uFKj/KnxyHgjj7J3sGX9ui FeKyCnLwXCzXhFlvM7arcs1o4hM2NPfMMK+34Ju3SSfpL1WTahCxlU3gN0p2fiUmhHsz DweA== 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=Kc37ca8dK1Ke+7g01bs8rpMjxibFaTjmzfOtrvZwThY=; b=LTCF/GrHYVm+rPqXsb8EOrEUVXLh7ixkqx43zgV9t0tmDWfRwAsbPsgAlnaHZMi0bE O+L3zKi0GN10/erBB4mKxfXr8e0DLEJI5WusHAVaIKzE1flB5/zLxpeIawa1SiVXRbuV sdttxAnZ6+md1QtpKbrT5rZJA47Pyofkd1uZoUQ8bbizlg3zCUQIElsmVYMPjczvxvJF r7JewjPTOHp8espmaRxc5YkDBQxf7HVaKaDz/qVyESZG2TRqeGGGKtnHHrqTWJh79SGX oy92kAF1h3usEVVOHC6Czusa7erjKufuW+LzKlaSy03IW1WmsQGs6rkgoIa5yyhhtrRq xWtg== X-Gm-Message-State: AOAM533lXEnYZ3TZbifQJTg61YqzI9I6NhJlRjGzDONGLP7I56PJ3LHg 1wLTTS2Ad7PlPy03uarLBnqyKgyQ X-Google-Smtp-Source: ABdhPJzVByHlPpiWO03I9CuqJdkoCC8DFMj5PTGbnI81T3XcA2nOvMvtn6Nvf4Zl9f6U1bgHSSnAnQ== X-Received: by 2002:a5d:6ac1:: with SMTP id u1mr6966445wrw.319.1589484566111; Thu, 14 May 2020 12:29:26 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id j2sm5536242wrp.47.2020.05.14.12.29.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 May 2020 12:29:25 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=raaahh@gmail.com; helo=mail-wr1-x434.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: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN 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:250280 Archived-At: On 14.05.2020 20:57, Stefan Monnier wrote: >>>> I even have a patch, but here's another thought: wouldn't this mistakenly >>>> punish people who keep their $HOME as a Git repository to sync >>>> between machines? >>> Depends if the Git worktrees within their $HOME use the same repository >>> as the one used for $HOME. >> Not 'git worktrees' (to be clear), just random other work directories, for >> work/hobby/etc projects. > > Yes, I make "work trees" in a generic sense not just in the `git worktree` sense. > >> Yes, a user option (inrended for dir-locals) is likely in order, but users >> such as described above would have to set it in _all_ of their >> work directories. > > Not if the repository they use for $HOME is different than the one they > use for ~/work, ~/my/hobby/, ... Then they'll only have to set it in ~/.dir-locals.el? Is that what you mean? Here's the patch I made according to your description: diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ac56537b97..bf737e821a 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -266,11 +266,18 @@ project-try-vc (let* ((backend (ignore-errors (vc-responsible-backend dir))) (root (pcase backend - ('Git + (`(or ,'Git ,'Hg) ;; Don't stop at submodule boundary. - (or (vc-file-getprop dir 'project-git-root) - (vc-file-setprop dir 'project-git-root - (vc-find-root dir ".git/")))) + (or (vc-file-getprop dir 'project-vc-root) + (let* ((default-directory dir) + (root (vc-root-dir)) + (parent (file-name-directory + (directory-file-name root)))) + (vc-file-setprop dir 'project-vc-root + (or + (let ((default-directory parent)) + (vc-root-dir)) + root))))) ('nil nil) (_ (ignore-errors (vc-call-backend backend 'root dir)))))) (and root (cons 'vc root))))