From unknown Wed Sep 10 13:55:48 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32596: 27.0.50; Support VC single file operations from Dired Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Aug 2018 22:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32596 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32596@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153566715223958 (code B ref -1); Thu, 30 Aug 2018 22:13:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 Aug 2018 22:12:32 +0000 Received: from localhost ([127.0.0.1]:39542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvVB1-0006EL-Kk for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvVAz-0006E6-CR for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvVAt-00035V-DY for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvVAt-00035J-5R for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvVAs-0001s1-5S for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 18:12:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvVAp-00031t-1D for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 18:12:22 -0400 Received: from pop.dreamhost.com ([64.90.62.162]:59468 helo=pdx1-sub0-mail-a11.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvVAo-0002zg-N7 for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 18:12:18 -0400 Received: from pdx1-sub0-mail-a11.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTP id 8B78B7FF0D for ; Thu, 30 Aug 2018 15:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=/j+qiaJ33RCk2aeddUJXgInK2YQ=; b=xvs1Tq/+pM9nQYzpz 4j9lUuDwvFF6T+LgMFEcMLPrBeIKnnWspkjikyBMx7uyD+zvcgFNnT9hrvSwbBx+ hTHYjPPjI1I9kMMwb1OTyTmetZFpJJQcJiEKFyNPgLAevMDKZ6VVqGqhEICkDGuy eBgowX9ozFTAyUFxPoWcLjSnog= Received: from localhost.linkov.net (m91-129-99-146.cust.tele2.ee [91.129.99.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTPSA id DDF607FF05 for ; Thu, 30 Aug 2018 15:12:15 -0700 (PDT) From: Juri Linkov Organization: LINKOV.NET Date: Fri, 31 Aug 2018 01:02:30 +0300 Message-ID: <87zhx3343t.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Both vc-dir-mode and dired-mode are supported in vc-deduce-fileset, but only vc-dir-mode is supported in vc-ensure-vc-buffer. This patch prepares a VC-controlled file buffer from Dired as well. Error-checking is moved outside of the last branch of cond, because in addition to dired-mode, it's also needed for vc-dir-mode to avoid the failure with a backtrace when a single-file operation is executed in vc-dir-mode on a directory. Also I noticed that the check =E2=80=98(unless backend (error "Directory = not under VC"))=E2=80=99 is not needed anymore because now vc-responsible-backend raises the same = error. There are more such useless checks in vc.el that could be removed as well= . --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-ensure-vc-buffer.1.patch diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b2bedfae93..ea1ba63f8f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1055,27 +1055,27 @@ vc-deduce-fileset (t (error "File is not under version control"))))) (defun vc-dired-deduce-fileset () - (let ((backend (vc-responsible-backend default-directory))) - (unless backend (error "Directory not under VC")) - (list backend - (dired-map-over-marks (dired-get-filename nil t) nil)))) + (list (vc-responsible-backend default-directory) + (dired-map-over-marks (dired-get-filename nil t) nil))) (defun vc-ensure-vc-buffer () "Make sure that the current buffer visits a version-controlled file." (cond ((derived-mode-p 'vc-dir-mode) (set-buffer (find-file-noselect (vc-dir-current-file)))) + ((derived-mode-p 'dired-mode) + (set-buffer (find-file-noselect (dired-get-filename)))) (t (while (and vc-parent-buffer (buffer-live-p vc-parent-buffer) ;; Avoid infinite looping when vc-parent-buffer and ;; current buffer are the same buffer. (not (eq vc-parent-buffer (current-buffer)))) - (set-buffer vc-parent-buffer)) - (if (not buffer-file-name) - (error "Buffer %s is not associated with a file" (buffer-name)) - (unless (vc-backend buffer-file-name) - (error "File %s is not under version control" buffer-file-name)))))) + (set-buffer vc-parent-buffer)))) + (if (not buffer-file-name) + (error "Buffer %s is not associated with a file" (buffer-name)) + (unless (vc-backend buffer-file-name) + (error "File %s is not under version control" buffer-file-name)))) ;;; Support for the C-x v v command. ;; This is where all the single-file-oriented code from before the fileset --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 10 18:27:37 2018 Received: (at control) by debbugs.gnu.org; 10 Sep 2018 22:27:37 +0000 Received: from localhost ([127.0.0.1]:35912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fzUef-0000CB-1z for submit@debbugs.gnu.org; Mon, 10 Sep 2018 18:27:37 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:37277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fzUed-0000Bz-53 for control@debbugs.gnu.org; Mon, 10 Sep 2018 18:27:35 -0400 Received: by mail-it0-f51.google.com with SMTP id h20-v6so30890926itf.2 for ; Mon, 10 Sep 2018 15:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=p1i6zRwC9IRYZcKIf6pcry9m48BY3KvcCfYSWN+ecOc=; b=Bueo1owh5i9m2zHE+R8oEYv1Zg5NzHPLFV/qL8+emAav+5EygZAt86lPBlrMKtNW8y 8vIs2OLja3KnTbb8FdOCOXlOGKjVWJRcr4q+nzLn8kJ6n8o5VZD8s6+VTQ7bQQVkRvY+ OG7gMVlD0RWXxbAE88/FG4o/qqFinIuPxRRFPsTLnNWswhEkf7nZk0oD4Xfm6mPsOkA+ d58g4MH1781jqUU2+dcmQFnRnFWfzKhy6IITmZONLm+EhQOePZR1BAStYJ/Qo55OsypT Wkeu0DLN3CMT4Otxv2z6t/AkadZ7mQH6arrzCF8aMkcIRrLQFOOMm1sZB7q29AgrVsm6 9uHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=p1i6zRwC9IRYZcKIf6pcry9m48BY3KvcCfYSWN+ecOc=; b=BgNfLKfxTMt4uRg38dWU5iJLwdagcpM0tYrPAgxYqhLoVTRzBpxQC8znFuRdfo76ie kIn9OWfdFtJ5bvRWY9WYHM1FZnqLbHfPf8q6ha8Vqc3LpFoZp9H4jpoC7U+ilVihISU7 BecjEba56FBEggxYYVGcBOk3Z+lMbUzLuk80OKViFcXJKDTZ8pUEqpVN43wSaTj/QoZn uM1Q/G76VJOUHZzCitwTLIoz556qBhu72YiFKJOrQjyOIrbOGOxRkM/1Ys+hpHM4geon iZHM84XR6gXNw3IC8dpFi/29HLsIfa+NIze81lfMoVpIO7ZC8V/dyJDwbEF629F7SRMp Pbyw== X-Gm-Message-State: APzg51BtpTThwWHCUjfMSvqEcZ46+lGvK0M5OT0OoNIzomxSFsuKuTEZ 5nyBG8difGGQLQKWOmpb3OGjAjEO X-Google-Smtp-Source: ANB0VdagOijOiErv/hHvisE9lcWsAoYxhUM+/7jSvvSkTTOXuXaaUtgWQRJE060nf+PyqOKssk6Ltg== X-Received: by 2002:a02:9f82:: with SMTP id a2-v6mr20578989jam.15.1536618449453; Mon, 10 Sep 2018 15:27:29 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id b195-v6sm8169754itc.42.2018.09.10.15.27.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Sep 2018 15:27:28 -0700 (PDT) From: Noam Postavsky To: control@debbugs.gnu.org Subject: control message for bug #32596 Date: Mon, 10 Sep 2018 18:27:28 -0400 Message-ID: <87r2i1f0of.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 32596 wishlist tags 32596 + patch quit From unknown Wed Sep 10 13:55:48 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Juri Linkov Subject: bug#32596: closed (Re: bug#32596: 27.0.50; Support VC single file operations from Dired) Message-ID: References: <87muqkts7u.fsf@mail.linkov.net> <87zhx3343t.fsf@mail.linkov.net> X-Gnu-PR-Message: they-closed 32596 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 32596@debbugs.gnu.org Date: Wed, 07 Nov 2018 22:55:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1541631302-2120-1" This is a multi-part message in MIME format... ------------=_1541631302-2120-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #32596: 27.0.50; Support VC single file operations from Dired which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 32596@debbugs.gnu.org. --=20 32596: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D32596 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1541631302-2120-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 32596-done) by debbugs.gnu.org; 7 Nov 2018 22:54:18 +0000 Received: from localhost ([127.0.0.1]:40051 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gKWiH-0000X8-Th for submit@debbugs.gnu.org; Wed, 07 Nov 2018 17:54:18 -0500 Received: from lavender.maple.relay.mailchannels.net ([23.83.214.99]:28129) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gKWiD-0000Wx-9f for 32596-done@debbugs.gnu.org; Wed, 07 Nov 2018 17:54:17 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 85BA65E372E for <32596-done@debbugs.gnu.org>; Wed, 7 Nov 2018 22:54:11 +0000 (UTC) Received: from pdx1-sub0-mail-a61.g.dreamhost.com (unknown [100.96.19.78]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B1A5F5E2DDA for <32596-done@debbugs.gnu.org>; Wed, 7 Nov 2018 22:53:57 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Received: from pdx1-sub0-mail-a61.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Wed, 07 Nov 2018 22:54:11 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Absorbed-Wide-Eyed: 1dfc6aa22c8efbe7_1541631237789_2286009756 X-MC-Loop-Signature: 1541631237789:3569915222 X-MC-Ingress-Time: 1541631237789 Received: from pdx1-sub0-mail-a61.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a61.g.dreamhost.com (Postfix) with ESMTP id 738DA806CE for <32596-done@debbugs.gnu.org>; Wed, 7 Nov 2018 14:53:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=R1cxleF5gmsIrsg594sessZPSNU=; b= uUrqzNvvWMEQ8yYSQ43Lz/tsms0s9XpG0TXra078qyACURLKYIj/VTy/NcKfqs7q 6EkYmTpt1tjGOgdJpbgfMRQC4theiEqLoPX6uyxjcBFotTPdrWdMUefYLblByXJ8 OsZrECQ1C+FPxkZltiWxPQOaaIdjAWy8OvX64W1mXhA= Received: from mail.jurta.org (m91-129-107-244.cust.tele2.ee [91.129.107.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a61.g.dreamhost.com (Postfix) with ESMTPSA id 6008C806CB for <32596-done@debbugs.gnu.org>; Wed, 7 Nov 2018 14:53:53 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a61 From: Juri Linkov To: 32596-done@debbugs.gnu.org Subject: Re: bug#32596: 27.0.50; Support VC single file operations from Dired Organization: LINKOV.NET References: <87zhx3343t.fsf@mail.linkov.net> Date: Thu, 08 Nov 2018 00:53:25 +0200 In-Reply-To: <87zhx3343t.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 31 Aug 2018 01:02:30 +0300") Message-ID: <87muqkts7u.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrkedtgddtfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdejrddvgeegnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtjedrvdeggedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopeefvdehleeiqdguohhnvgesuggvsggsuhhgshdrghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 32596-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > Both vc-dir-mode and dired-mode are supported in vc-deduce-fileset, > but only vc-dir-mode is supported in vc-ensure-vc-buffer. > > This patch prepares a VC-controlled file buffer from Dired as well. > > Error-checking is moved outside of the last branch of cond, > because in addition to dired-mode, it's also needed for vc-dir-mode > to avoid the failure with a backtrace when a single-file operation > is executed in vc-dir-mode on a directory. Done. ------------=_1541631302-2120-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 30 Aug 2018 22:12:32 +0000 Received: from localhost ([127.0.0.1]:39542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvVB1-0006EL-Kk for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fvVAz-0006E6-CR for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvVAt-00035V-DY for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvVAt-00035J-5R for submit@debbugs.gnu.org; Thu, 30 Aug 2018 18:12:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvVAs-0001s1-5S for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 18:12:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvVAp-00031t-1D for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 18:12:22 -0400 Received: from pop.dreamhost.com ([64.90.62.162]:59468 helo=pdx1-sub0-mail-a11.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvVAo-0002zg-N7 for bug-gnu-emacs@gnu.org; Thu, 30 Aug 2018 18:12:18 -0400 Received: from pdx1-sub0-mail-a11.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTP id 8B78B7FF0D for ; Thu, 30 Aug 2018 15:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=/j+qiaJ33RCk2aeddUJXgInK2YQ=; b=xvs1Tq/+pM9nQYzpz 4j9lUuDwvFF6T+LgMFEcMLPrBeIKnnWspkjikyBMx7uyD+zvcgFNnT9hrvSwbBx+ hTHYjPPjI1I9kMMwb1OTyTmetZFpJJQcJiEKFyNPgLAevMDKZ6VVqGqhEICkDGuy eBgowX9ozFTAyUFxPoWcLjSnog= Received: from localhost.linkov.net (m91-129-99-146.cust.tele2.ee [91.129.99.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTPSA id DDF607FF05 for ; Thu, 30 Aug 2018 15:12:15 -0700 (PDT) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: 27.0.50; Support VC single file operations from Dired Organization: LINKOV.NET Date: Fri, 31 Aug 2018 01:02:30 +0300 Message-ID: <87zhx3343t.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Both vc-dir-mode and dired-mode are supported in vc-deduce-fileset, but only vc-dir-mode is supported in vc-ensure-vc-buffer. This patch prepares a VC-controlled file buffer from Dired as well. Error-checking is moved outside of the last branch of cond, because in addition to dired-mode, it's also needed for vc-dir-mode to avoid the failure with a backtrace when a single-file operation is executed in vc-dir-mode on a directory. Also I noticed that the check =E2=80=98(unless backend (error "Directory = not under VC"))=E2=80=99 is not needed anymore because now vc-responsible-backend raises the same = error. There are more such useless checks in vc.el that could be removed as well= . --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=vc-ensure-vc-buffer.1.patch diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index b2bedfae93..ea1ba63f8f 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1055,27 +1055,27 @@ vc-deduce-fileset (t (error "File is not under version control"))))) (defun vc-dired-deduce-fileset () - (let ((backend (vc-responsible-backend default-directory))) - (unless backend (error "Directory not under VC")) - (list backend - (dired-map-over-marks (dired-get-filename nil t) nil)))) + (list (vc-responsible-backend default-directory) + (dired-map-over-marks (dired-get-filename nil t) nil))) (defun vc-ensure-vc-buffer () "Make sure that the current buffer visits a version-controlled file." (cond ((derived-mode-p 'vc-dir-mode) (set-buffer (find-file-noselect (vc-dir-current-file)))) + ((derived-mode-p 'dired-mode) + (set-buffer (find-file-noselect (dired-get-filename)))) (t (while (and vc-parent-buffer (buffer-live-p vc-parent-buffer) ;; Avoid infinite looping when vc-parent-buffer and ;; current buffer are the same buffer. (not (eq vc-parent-buffer (current-buffer)))) - (set-buffer vc-parent-buffer)) - (if (not buffer-file-name) - (error "Buffer %s is not associated with a file" (buffer-name)) - (unless (vc-backend buffer-file-name) - (error "File %s is not under version control" buffer-file-name)))))) + (set-buffer vc-parent-buffer)))) + (if (not buffer-file-name) + (error "Buffer %s is not associated with a file" (buffer-name)) + (unless (vc-backend buffer-file-name) + (error "File %s is not under version control" buffer-file-name)))) ;;; Support for the C-x v v command. ;; This is where all the single-file-oriented code from before the fileset --=-=-=-- ------------=_1541631302-2120-1--