Document diff-remove-trailing-whitespace
authorGlenn Morris <rgm@gnu.org>
Thu, 8 Nov 2012 08:14:23 +0000 (00:14 -0800)
committerGlenn Morris <rgm@gnu.org>
Thu, 8 Nov 2012 08:14:23 +0000 (00:14 -0800)
* doc/emacs/files.texi (Diff Mode): Trailing whitespace updates.

* lisp/vc/diff-mode.el (diff-remove-trailing-whitespace): Doc fix.

* etc/NEWS: Related markup.

doc/emacs/ChangeLog
doc/emacs/files.texi
etc/NEWS
lisp/ChangeLog
lisp/vc/diff-mode.el

index 7ffb22d..3893e3c 100644 (file)
@@ -1,3 +1,7 @@
+2012-11-08  Glenn Morris  <rgm@gnu.org>
+
+       * files.texi (Diff Mode): Trailing whitespace updates.
+
 2012-11-07  Chong Yidong  <cyd@gnu.org>
 
        * misc.texi (Terminal emulator): Document Term mode faces.
index 36cd365..e2a85c6 100644 (file)
@@ -1470,11 +1470,19 @@ name from the patch itself.  This is useful for making log entries for
 functions that are deleted by the patch.
 @end table
 
-  By default, Diff mode highlights trailing whitespace on modified
-lines, so that they are more obvious.  This is done by enabling
-Whitespace mode in the Diff buffer (@pxref{Useless Whitespace}).  Diff
-mode buffers are set up so that Whitespace mode avoids highlighting
-trailing whitespace occurring in the diff context.
+@c Trailing whitespace is NOT shown by default.
+@c Emacs's dir-locals file enables this (for some reason).
+@cindex trailing whitespace, in diffs
+@findex diff-remove-trailing-whitespace
+  Diff mode has various features for dealing with trailing whitespace
+on modified lines, since this is often an unintentional and unwanted
+change.  If you enable Whitespace mode in a Diff buffer, trailing
+whitespace is highlighted (@pxref{Useless Whitespace}).  The command
+@kbd{M-x diff-remove-trailing-whitespace} searches for trailing
+whitespace in the lines modified or added by a diff.  If it finds any,
+it tries to visit the associated file(s) and remove it.  It does not
+save the modifications, rather it lists any buffers that were modified
+so you can decide for yourself what to do.
 
 @node Misc File Ops
 @section Miscellaneous File Operations
index 275e33d..5fa57ac 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -392,18 +392,21 @@ details.
 
 ** Diff mode
 
+---
 *** Changes are now highlighted using the same color scheme as in
 modern VCSes.  Deletions are displayed in red (new faces
-`diff-refine-removed' and `smerge-refined-removed' and new definition
+`diff-refine-removed' and `smerge-refined-removed', and new definition
 of `diff-removed'), insertions in green (new faces `diff-refine-added'
-and `smerge-refined-added' and new definition of `diff-added').
+and `smerge-refined-added', and new definition of `diff-added').
 
+---
 *** The variable `diff-use-changed-face' defines whether to use the
 face `diff-changed', or `diff-removed' and `diff-added' to highlight
 changes in context diffs.
 
-*** The new command `diff-remove-trailing-whitespace' fixes trailing
-whitespace problems introduced by the diff.
++++
+*** The new command `diff-remove-trailing-whitespace' removes trailing
+whitespace introduced by a diff.
 
 ** Dired
 +++
index 6a574f4..b141afe 100644 (file)
@@ -1,3 +1,7 @@
+2012-11-08  Glenn Morris  <rgm@gnu.org>
+
+       * vc/diff-mode.el (diff-remove-trailing-whitespace): Doc fix.
+
 2012-11-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * emacs-lisp/gv.el (gv-define-simple-setter): Fix last change
index 49b76a8..daf43c5 100644 (file)
@@ -2049,12 +2049,12 @@ I.e. like `add-change-log-entry-other-window' but applied to all hunks."
       (error nil))))
 
 (defun diff-remove-trailing-whitespace ()
-  "When on a buffer that contains a diff, inspects the
-differences and removes trailing whitespace (spaces, tabs) from
-the lines modified or introduced by this diff. Shows a message
-with the name of the altered buffers, which are unsaved.  If a
-file referenced on the diff has no buffer and needs to be fixed,
-a buffer visiting that file is created."
+  "Remove trailing whitespace from the lines modified/added by a diff.
+Called from a buffer containing a diff, this searches for trailing
+whitespace (spaces, tabs) in the modified/added lines.  If the
+file that such a line refers to can be found, it visits it and
+removes the associated whitespace, if it is present.  It does not
+save any changed buffers, it just gives a message naming them."
   (interactive)
   ;; We assume that the diff header has no trailing whitespace.
   (let ((modified-buffers nil))