emacs-diffs
[Top][All Lists]
Advanced

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

master 7aa106b8bf3: Move error check from vc-next-action to diff-vc-dedu


From: Sean Whitton
Subject: master 7aa106b8bf3: Move error check from vc-next-action to diff-vc-deduce-fileset
Date: Tue, 1 Oct 2024 21:23:39 -0400 (EDT)

branch: master
commit 7aa106b8bf382f18342975e388720399554e2968
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    Move error check from vc-next-action to diff-vc-deduce-fileset
    
    * lisp/vc/diff-mode.el (diff-vc-deduce-fileset): Signal
    user-error when the buffer is narrowed.
    * lisp/vc/vc.el (vc-next-action): Remove code signalling a
    user-error when the buffer is narrowed.
---
 lisp/vc/diff-mode.el | 11 +++++++++++
 lisp/vc/vc.el        | 11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 948d89c579e..51e7d90f98b 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -3202,6 +3202,17 @@ hunk text is not found in the source file."
 
 ;;;###autoload
 (defun diff-vc-deduce-fileset ()
+  (when (buffer-narrowed-p)
+    ;; If user used `diff-restrict-view' then we may not have the
+    ;; file header, and the commit will not succeed (bug#73387).
+    (user-error "Cannot commit patch when narrowed; consider %s"
+                (mapconcat (lambda (c)
+                             (key-description
+                              (where-is-internal c nil t)))
+                           '(widen
+                             diff-delete-other-hunks
+                             vc-next-action)
+                           " ")))
   (let ((backend (vc-responsible-backend default-directory))
         files)
     (save-excursion
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index fce98d091bf..597a1622f5a 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1302,17 +1302,6 @@ from which to check out the file(s)."
      ;; Fileset comes from a diff-mode buffer, see
      ;; 'diff-vc-deduce-fileset', and the buffer is the patch to apply.
      ((eq model 'patch)
-      (when (buffer-narrowed-p)
-        ;; If user used `diff-restrict-view' then we may not have the
-        ;; file header, and the commit will not succeed (bug#73387).
-        (user-error "Cannot commit patch when narrowed; consider %s"
-                    (mapconcat (lambda (c)
-                                 (key-description
-                                  (where-is-internal c nil t)))
-                               '(widen
-                                 diff-delete-other-hunks
-                                 vc-next-action)
-                               " ")))
       (vc-checkin files backend nil nil nil (buffer-string)))
      ((or (null state) (eq state 'unregistered))
       (cond (verbose



reply via email to

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