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#41821: 28.0.50; read-directory-name in vc commands should provide defaults from projects Date: Sat, 20 Jun 2020 04:35:40 +0300 Message-ID: References: <87r1ulxk48.fsf@mail.linkov.net> <7164426e-8c37-8839-64da-563cfa829b53@yandex.ru> <87mu50j5cu.fsf@mail.linkov.net> 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="86949"; 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: 41821@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 20 03:36:10 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 1jmSQU-000MYC-Gd for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Jun 2020 03:36:10 +0200 Original-Received: from localhost ([::1]:45646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jmSQT-00011G-J2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Jun 2020 21:36:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jmSQM-00010s-Ic for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 21:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45540) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jmSQM-0002cc-9I for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 21:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jmSQM-0005E4-3f for bug-gnu-emacs@gnu.org; Fri, 19 Jun 2020 21:36: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: Sat, 20 Jun 2020 01:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41821 X-GNU-PR-Package: emacs Original-Received: via spool by 41821-submit@debbugs.gnu.org id=B41821.159261695320071 (code B ref 41821); Sat, 20 Jun 2020 01:36:02 +0000 Original-Received: (at 41821) by debbugs.gnu.org; 20 Jun 2020 01:35:53 +0000 Original-Received: from localhost ([127.0.0.1]:57086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmSQC-0005Df-Oy for submit@debbugs.gnu.org; Fri, 19 Jun 2020 21:35:52 -0400 Original-Received: from mail-wr1-f42.google.com ([209.85.221.42]:37547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jmSQ9-0005DM-9y for 41821@debbugs.gnu.org; Fri, 19 Jun 2020 21:35:51 -0400 Original-Received: by mail-wr1-f42.google.com with SMTP id a6so9406228wrm.4 for <41821@debbugs.gnu.org>; Fri, 19 Jun 2020 18:35:49 -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=232sxVBX7ZMxjMVfpPpPmK+3mDh2fOqUNWUC0f72Jzg=; b=nWScD2V3QMVQHYt16IohZwEneufpbveLpD4ht1rD3kHydAeJPr0c7S9VqLkZkzO83m 3iHcDVxhAjvDx4+kDM4QNiFGdjJZ/PbvWVE634onX+TcwhGP1sLtFoJXQN9nvz6ysqtT 22eS2Nb17bF3VQg+AdE6JjtruaDGrb50egwC2+opM/zRe4BQvqQ5zQpLssesWNsMmxUa 9OVJDa7BGGQsaT8YbMfOBX+x8h0j5dr1ExbUSgc/2U5TYnHfHcRWuhXu3GOaGUSQ949j TEas0xNm9O6k88YikZa/bmTTP1t9gkMZnJ4Sw+cLvIo6A9XSH25MvWj4REGnQBn+EC+v zCaA== 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=232sxVBX7ZMxjMVfpPpPmK+3mDh2fOqUNWUC0f72Jzg=; b=ZIwKb10LsdVBEbJbYbvND5usVAFvhk7kDmwDpIOEGWTR9+Jb8bW/qwVUnITwxfYdzP ZnwHVKL6CHuhYQv1JFCJzlu4+fXq/qBAHs2VMwfbGghsfifDEYeYdiwn9Fmv7eZsH/A5 visSq16nGERREUO6SITlbKacEZQ6OjGIeuE5BQGtS/H60A9lXqRn7fVA1brYFM7m0ut5 25o61D4XZ1ClbdbZ9xOcmzu/TMTQwgck6/d4OL1GYvddtIDYspGfGco5u+SHtalUOpeF MpNLD0UVp1/qV5Osd05BYzEO8muI1jO51D3DYBQh6KV+cL2p4RbfSPeUHHqzC6u8BJaf ojAg== X-Gm-Message-State: AOAM531vHGFU3fdnKbDXKqLhwo8MQ87skj8/ov8PypGbpX5dF09YhAlW ALus8FlInkwepQrG/394EGgLqJj8 X-Google-Smtp-Source: ABdhPJyVCY55juFoUoqxLwY1dpmDp6kx8wbAIuP6yKblen7s8Ku1Zl+KNQG7O+Nr2/iFI9oeKHYmAA== X-Received: by 2002:adf:ce8d:: with SMTP id r13mr3860408wrn.392.1592616943140; Fri, 19 Jun 2020 18:35:43 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id y25sm15030623wmi.2.2020.06.19.18.35.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Jun 2020 18:35:42 -0700 (PDT) In-Reply-To: <87mu50j5cu.fsf@mail.linkov.net> 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:182191 Archived-At: On 19.06.2020 02:28, Juri Linkov wrote: > Maybe something like: Not too bad. Though I'd rather not extend the public contract of project.el with a function that special-cases VC projects. So maybe something like this instead: diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 9b12d44978..19a4c7f60d 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2508,6 +2508,19 @@ vc-print-log ) (vc-print-log-internal backend files working-revision nil limit))) +;; Or use project-try-vc after all. But this should be faster in the +;; event when there actually are non-VC based projects in the list. +(defun vc--known-vc-roots () + (require 'project) + (defvar project--list) + (project--ensure-read-project-list) + (seq-filter (lambda (dir) + (let ((backend (vc-responsible-backend dir))) + (if backend + (condition-case nil + (vc-call-backend backend 'root dir) + (vc-not-supported + nil))))) + (mapcar #'car project--list))) + ;;;###autoload (defun vc-print-root-log (&optional limit revision) "List the revision history for the current VC controlled tree in a window. @@ -2547,7 +2560,9 @@ vc-print-root-log rootdir) (if backend (setq rootdir (vc-call-backend backend 'root default-directory)) - (setq rootdir (read-directory-name "Directory for VC revision log: ")) + (setq rootdir (read-directory-name "Directory for VC revision log: " + nil + (vc--known-vc-roots))) (setq backend (vc-responsible-backend rootdir)) (unless backend (error "Directory is not version controlled"))) Personally, though, when I want behavior like this, I would probably just type 'C-x p v'. The directory name reading with completion performed by project-prompt-project-dir is more quick and handy (though I'll confess to using Ivy as the completion UI for this and one other function; vertical completion fits these long string values best). It also puts the selected project on the top of the list, which vc--known-vc-roots (or your function) don't do.