-(defun stgit-patched-file-at-point (&optional both-files)
- "Returns a cons of the patchsym and file name at point. For
-copies and renames, return the new file if the patch is either
-applied. If BOTH-FILES is non-nil, return a cons of the old and
-the new file names instead of just one name."
- (let ((patchsym (get-text-property (point) 'stgit-file-patchsym))
- (file (get-text-property (point) 'stgit-file)))
- (cond ((not patchsym) nil)
- (file (cons patchsym file))
- (both-files
- (cons patchsym (cons (get-text-property (point) 'stgit-old-file)
- (get-text-property (point) 'stgit-new-file))))
- (t
- (let ((file-sym (save-excursion
- (stgit-previous-patch)
- (unless (eq (stgit-patch-name-at-point)
- patchsym)
- (error "Cannot find the %s patch" patchsym))
- (beginning-of-line)
- (if (= (char-after) ?-)
- 'stgit-old-file
- 'stgit-new-file))))
- (cons patchsym (get-text-property (point) file-sym)))))))