;;; diff-mode.el --- a mode for viewing/editing context diffs -*- lexical-binding: t -*-
-;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2016 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
;; Keywords: convenience patch diff vc
(header-files
;; handle filenames with spaces;
;; cf. diff-font-lock-keywords / diff-file-header-face
- (if (looking-at "[-*][-*][-*] \\([^\t]+\\)\t.*\n[-+][-+][-+] \\([^\t]+\\)")
+ (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)))
(diff-hunk-style)))))
(set (make-local-variable 'whitespace-trailing-regexp)
(if (eq style 'context)
- "^[-\+!] .*?\\([\t ]+\\)$"
- "^[-\+!<>].*?\\([\t ]+\\)$"))))
+ "^[-+!] .*?\\([\t ]+\\)$"
+ "^[-+!<>].*?\\([\t ]+\\)$"))))
(defun diff-delete-if-empty ()
;; An empty diff file means there's no more diffs to integrate, so we
"Kill all hunks that have already been applied starting at point."
(interactive)
(while (not (eobp))
- (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
+ (pcase-let ((`(,_buf ,line-offset ,_pos ,_src ,_dst ,switched)
(diff-find-source-location nil nil)))
(if (and line-offset switched)
(diff-hunk-kill)
(goto-char hunk-end))
(if modified-buffers
(message "Deleted trailing whitespace from %s."
- (mapconcat (lambda (buf) (concat "`" (buffer-name buf) "'"))
+ (mapconcat (lambda (buf) (format-message
+ "`%s'" (buffer-name buf)))
modified-buffers ", "))
(message "No trailing whitespace to delete.")))))