* 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.
(cherry picked from commit
7aa106b8bf382f18342975e388720399554e2968)
;;;###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
;; 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