GNU bug report logs - #32596
27.0.50; Support VC single file operations from Dired

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Thu, 30 Aug 2018 22:13:02 UTC

Severity: wishlist

Tags: patch

Found in version 27.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32596 in the body.
You can then email your comments to 32596 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32596; Package emacs. (Thu, 30 Aug 2018 22:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 30 Aug 2018 22:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Support VC single file operations from Dired
Date: Fri, 31 Aug 2018 01:02:30 +0300
[Message part 1 (text/plain, inline)]
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 ‘(unless backend (error "Directory not under VC"))’
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.

[vc-ensure-vc-buffer.1.patch (text/x-diff, inline)]
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

Severity set to 'wishlist' from 'normal' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 10 Sep 2018 22:28:01 GMT) Full text and rfc822 format available.

Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 10 Sep 2018 22:28:01 GMT) Full text and rfc822 format available.

Reply sent to Juri Linkov <juri <at> linkov.net>:
You have taken responsibility. (Wed, 07 Nov 2018 22:55:01 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> linkov.net>:
bug acknowledged by developer. (Wed, 07 Nov 2018 22:55:02 GMT) Full text and rfc822 format available.

Message #14 received at 32596-done <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: 32596-done <at> debbugs.gnu.org
Subject: Re: bug#32596: 27.0.50; Support VC single file operations from Dired
Date: Thu, 08 Nov 2018 00:53:25 +0200
> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 06 Dec 2018 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.