diff options
| author | Dan Nicolaescu | 2009-01-10 17:21:04 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2009-01-10 17:21:04 +0000 |
| commit | ac7020b35ea1ebb4d979fb956465c03ede2ca4ae (patch) | |
| tree | 613321db800a3e36eb72b2b13cc2a3c6556ea68a /lisp/diff-mode.el | |
| parent | 2833b3fffd6e3cef1cb472ef11eb611772521caa (diff) | |
| download | emacs-ac7020b35ea1ebb4d979fb956465c03ede2ca4ae.tar.gz emacs-ac7020b35ea1ebb4d979fb956465c03ede2ca4ae.zip | |
(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.
Diffstat (limited to 'lisp/diff-mode.el')
| -rw-r--r-- | lisp/diff-mode.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index cbd1aaf48b2..7eddf3b37e7 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el | |||
| @@ -183,6 +183,9 @@ when editing big diffs)." | |||
| 183 | ["Unified -> Context" diff-unified->context | 183 | ["Unified -> Context" diff-unified->context |
| 184 | :help "Convert unified diffs to context diffs"] | 184 | :help "Convert unified diffs to context diffs"] |
| 185 | ;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)] | 185 | ;;["Fixup Headers" diff-fixup-modifs (not buffer-read-only)] |
| 186 | ["Show trailing whitespace" whitespace-mode | ||
| 187 | :style toggle :selected whitespace-mode | ||
| 188 | :help "Show trailing whitespace in modified lines"] | ||
| 186 | "-----" | 189 | "-----" |
| 187 | ["Split hunk" diff-split-hunk | 190 | ["Split hunk" diff-split-hunk |
| 188 | :active (diff-splittable-p) | 191 | :active (diff-splittable-p) |
| @@ -1264,6 +1267,12 @@ a diff with \\[diff-reverse-direction]. | |||
| 1264 | (set (make-local-variable 'end-of-defun-function) | 1267 | (set (make-local-variable 'end-of-defun-function) |
| 1265 | 'diff-end-of-file) | 1268 | 'diff-end-of-file) |
| 1266 | 1269 | ||
| 1270 | ;; Set up `whitespace-mode' so that turning it on will show trailing | ||
| 1271 | ;; whitespace problems on the modified lines of the diff. | ||
| 1272 | (set (make-local-variable 'whitespace-style) '(trailing)) | ||
| 1273 | (set (make-local-variable 'whitespace-trailing-regexp) | ||
| 1274 | "^[-\+!<>].*?\\([\t ]+\\)$") | ||
| 1275 | |||
| 1267 | (setq buffer-read-only diff-default-read-only) | 1276 | (setq buffer-read-only diff-default-read-only) |
| 1268 | ;; setup change hooks | 1277 | ;; setup change hooks |
| 1269 | (if (not diff-update-on-the-fly) | 1278 | (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." | |||
| 1885 | ;; When there's no more hunks, diff-hunk-next signals an error. | 1894 | ;; When there's no more hunks, diff-hunk-next signals an error. |
| 1886 | (error nil))))) | 1895 | (error nil))))) |
| 1887 | 1896 | ||
| 1888 | (defun diff-show-trailing-whitespaces () | ||
| 1889 | "Show trailing whitespaces in modified lines for diff-mode." | ||
| 1890 | (interactive) | ||
| 1891 | (let ((whitespace-style '(trailing)) | ||
| 1892 | (whitespace-trailing-regexp "^[-+!<>].*?\\([\t ]+\\)$")) | ||
| 1893 | (whitespace-mode 1))) ; display trailing whitespace in diff buffer | ||
| 1894 | |||
| 1895 | ;; provide the package | 1897 | ;; provide the package |
| 1896 | (provide 'diff-mode) | 1898 | (provide 'diff-mode) |
| 1897 | 1899 | ||