Mercurial > emacs
changeset 82034:11eee91b817d
(diff-find-file-name): Add arg `batch'.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Sun, 22 Jul 2007 21:28:14 +0000 |
parents | 6df2ca7b3d53 |
children | da9840648bbd |
files | lisp/ChangeLog lisp/diff-mode.el |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Jul 22 21:26:34 2007 +0000 +++ b/lisp/ChangeLog Sun Jul 22 21:28:14 2007 +0000 @@ -1,5 +1,7 @@ 2007-07-22 Stefan Monnier <monnier@iro.umontreal.ca> + * 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.
--- a/lisp/diff-mode.el Sun Jul 22 21:26:34 2007 +0000 +++ b/lisp/diff-mode.el Sun Jul 22 21:28:14 2007 +0000 @@ -611,9 +611,11 @@ (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." (save-excursion (unless (looking-at diff-file-header-re) @@ -648,7 +650,10 @@ (boundp 'cvs-pcl-cvs-dirchange-re) (save-excursion (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))))