Function: diff-hunk-file-names
diff-hunk-file-names is a byte-compiled function defined in
diff-mode.el.gz.
Signature
(diff-hunk-file-names &optional OLD)
Documentation
Give the list of file names textually mentioned for the current hunk.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/diff-mode.el.gz
(defun diff-hunk-file-names (&optional old)
"Give the list of file names textually mentioned for the current hunk."
(save-excursion
(unless (looking-at diff-file-header-re)
(or (ignore-errors (diff-beginning-of-file))
(re-search-forward diff-file-header-re nil t)))
(let ((limit (save-excursion
(condition-case ()
(progn (diff-hunk-prev) (point))
(error (point-min)))))
(header-files
;; handle file names with spaces;
;; cf. diff-font-lock-keywords / diff-file-header
;; FIXME if there are nonascii characters in the file names,
;; GNU diff displays them as octal escapes.
;; This function should undo that, so as to return file names
;; that are usable in Emacs.
(if (looking-at "[-*][-*][-*] \\([^\t\n]+\\).*\n[-+][-+][-+] \\([^\t\n]+\\)")
(list (if old (match-string 1) (match-string 2))
(if old (match-string 2) (match-string 1)))
(forward-line 1) nil)))
(delq nil
(append
(when (and (not old)
(save-excursion
(re-search-backward "^Index: \\(.+\\)" limit t)))
(list (match-string 1)))
header-files
;; this assumes that there are no spaces in filenames
(and (re-search-backward "^diff " nil t)
(looking-at
"^diff \\(-[^ \t\nL]+ +\\)*\\(-L +\\S-+ +\\)*\\(\\S-+\\)\\( +\\(\\S-+\\)\\)?")
(list (if old (match-string 3) (match-string 5))
(if old (match-string 4) (match-string 3)))))))))