emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#32596: closed (27.0.50; Support VC single file ope


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#32596: closed (27.0.50; Support VC single file operations from Dired)
Date: Wed, 07 Nov 2018 22:55:01 +0000

Your message dated Thu, 08 Nov 2018 00:53:25 +0200
with message-id <address@hidden>
and subject line Re: bug#32596: 27.0.50; Support VC single file operations from 
Dired
has caused the debbugs.gnu.org bug report #32596,
regarding 27.0.50; Support VC single file operations from Dired
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
32596: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=32596
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 27.0.50; Support VC single file operations from Dired Date: Fri, 31 Aug 2018 01:02:30 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
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.

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

--- End Message ---
--- Begin Message --- Subject: Re: bug#32596: 27.0.50; Support VC single file operations from Dired Date: Thu, 08 Nov 2018 00:53:25 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
> 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.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]