1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(diff-show-trailing-whitespaces): Remove function.

Move setting up whitepace-mode ...
(diff-mode): ... here.
(diff-mode-menu): Add a menu entry for showing trailing whitespace.
This commit is contained in:
Dan Nicolaescu 2009-01-10 17:21:04 +00:00
parent 2833b3fffd
commit ac7020b35e
3 changed files with 18 additions and 9 deletions

View file

@ -183,6 +183,9 @@ when editing big diffs)."
["Unified -> Context" diff-unified->context
:help "Convert unified diffs to context diffs"]
;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)]
["Show trailing whitespace" whitespace-mode
:style toggle :selected whitespace-mode
:help "Show trailing whitespace in modified lines"]
"-----"
["Split hunk" diff-split-hunk
:active (diff-splittable-p)
@ -1264,6 +1267,12 @@ a diff with \\[diff-reverse-direction].
(set (make-local-variable 'end-of-defun-function)
'diff-end-of-file)
;; Set up `whitespace-mode' so that turning it on will show trailing
;; whitespace problems on the modified lines of the diff.
(set (make-local-variable 'whitespace-style) '(trailing))
(set (make-local-variable 'whitespace-trailing-regexp)
"^[-\+!<>].*?\\([\t ]+\\)$")
(setq buffer-read-only diff-default-read-only)
;; setup change hooks
(if (not diff-update-on-the-fly)
@ -1885,13 +1894,6 @@ I.e. like `add-change-log-entry-other-window' but applied to all hunks."
;; When there's no more hunks, diff-hunk-next signals an error.
(error nil)))))
(defun diff-show-trailing-whitespaces ()
"Show trailing whitespaces in modified lines for diff-mode."
(interactive)
(let ((whitespace-style '(trailing))
(whitespace-trailing-regexp "^[-+!<>].*?\\([\t ]+\\)$"))
(whitespace-mode 1))) ; display trailing whitespace in diff buffer
;; provide the package
(provide 'diff-mode)