Commit e4456fdf authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(diff-find-file-name): Add arg `batch'.

parent fd691799
2007-07-22 Stefan Monnier <>
* diff-mode.el (diff-find-file-name): Add arg `batch'.
* diff-mode.el (diff-beginning-of-file-and-junk): New function.
(diff-file-kill): Use it.
(diff-beginning-of-hunk): Add arg `try-harder' using it.
......@@ -611,9 +611,11 @@ If the OLD prefix arg is passed, tell the file NAME of the old file."
(list (if old (match-string 2) (match-string 4))
(if old (match-string 4) (match-string 2)))))))))
(defun diff-find-file-name (&optional old prefix)
(defun diff-find-file-name (&optional old batch prefix)
"Return the file corresponding to the current patch.
Non-nil OLD means that we want the old file.
Non-nil BATCH means to prefer returning an incorrect answer than to prompt
the user.
PREFIX is only used internally: don't use it."
(unless (looking-at diff-file-header-re)
......@@ -648,7 +650,10 @@ PREFIX is only used internally: don't use it."
(boundp 'cvs-pcl-cvs-dirchange-re)
(re-search-backward cvs-pcl-cvs-dirchange-re nil t))
(diff-find-file-name old (match-string 1)))
(diff-find-file-name old batch (match-string 1)))
;; Invent something, if necessary.
(when batch
(or (car fs) default-directory))
;; if all else fails, ask the user
(let ((file (read-file-name (format "Use file %s: " (or (first fs) ""))
nil (first fs) t (first fs))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment