]> git.eshelyaron.com Git - emacs.git/commitdiff
(diff-show-trailing-whitespaces): Remove function.
authorDan Nicolaescu <dann@ics.uci.edu>
Sat, 10 Jan 2009 17:21:04 +0000 (17:21 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sat, 10 Jan 2009 17:21:04 +0000 (17:21 +0000)
Move setting up whitepace-mode ...
(diff-mode): ... here.
(diff-mode-menu): Add a menu entry for showing trailing whitespace.

etc/NEWS
lisp/ChangeLog
lisp/diff-mode.el

index 143342b5ad6d08238477b2010e337d449cdace4f..98d3d216b6fd58a3c02cc0f8de452afe9c08fbea 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -781,8 +781,8 @@ diff-auto-refine-mode.  It is bound to `C-c C-b'.
 buffer and tries to create ChangeLog entries for each change.
 It is bound to `C-x 4 A'.
 +++
-*** The new function `diff-show-trailing-whitespaces' shows
-trailing whitespace problems in the modified lines of a diff buffer.
+*** Turning on `whitespace-mode' in a diff buffer will show trailing
+whitespace problems in the modified lines.
 
 ** Dired
 +++
index 7e07d87f753ef53500330a66ac9986623b01ae4d..a94006499ad7cb8162674cc5237898634b74a954 100644 (file)
@@ -1,3 +1,10 @@
+2009-01-10  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * diff-mode.el (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.
+
 2009-01-10  Chong Yidong  <cyd@stupidchicken.com>
 
        * faces.el (x-font-family-list): Remove entirely.
index cbd1aaf48b2d02199665a9e6c2a902ffc87b16e4..7eddf3b37e7fa5daddbc2aef1608cfa7526324b6 100644 (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)