]> code.delx.au - gnu-emacs/blobdiff - lisp/compare-w.el
New icons for debugger.
[gnu-emacs] / lisp / compare-w.el
index 479bd72125e9285dd0c7cfd47888aec98d2ef6ef..8772cfcc6df9f0ba68eda6749414aca2e7410866 100644 (file)
@@ -1,8 +1,9 @@
-;;; compare-w.el --- compare text between windows for Emacs.
+;;; compare-w.el --- compare text between windows for Emacs
 
 ;; Copyright (C) 1986, 1989, 1993, 1997 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Keywords: convenience files
 
 ;; This file is part of GNU Emacs.
 
 
 ;;; Code:
 
-(defvar compare-windows-whitespace "[ \t\n]+"
+(defgroup compare-w nil
+  "Compare text between windows."
+  :prefix "compare-"
+  :group 'tools)
+
+(defcustom compare-windows-whitespace "\\(\\s-\\|\n\\)+"
   "*Regexp that defines whitespace sequences for \\[compare-windows].
-Changes in whitespace are optionally ignored.
+That command optionally ignores changes in whitespace.
 
-The value of `compare-windows-whitespace' may instead be a function; this
-function is called in each buffer, with point at the current scanning point.
-The function's job is to categorize any whitespace around (including before)
-point; it should also advance past any whitespace.
+The value of `compare-windows-whitespace' is normally a regexp, but it
+can also be a function.  The function's job is to categorize any
+whitespace around (including before) point; it should also advance
+past any whitespace.  The function is called in each buffer, with
+point at the current scanning point.  It gets one argument, the point
+where `compare-windows' was originally called; it should not look at
+any text before that point.
 
-The function is passed one argument, the point where `compare-windows'
-was originally called; it should not consider any text before that point.
 If the function returns the same value for both buffers, then the
-whitespace is considered to match, and is skipped.")
+whitespace is considered to match, and is skipped."
+  :type '(choice regexp function)
+  :group 'compare-w)
 
-(defvar compare-ignore-case nil
-  "*Non-nil means \\[compare-windows] ignores case differences.")
+(defcustom compare-ignore-case nil
+  "*Non-nil means \\[compare-windows] ignores case differences."
+  :type 'boolean
+  :group 'compare-w)
 
 ;;;###autoload
 (defun compare-windows (ignore-whitespace)
@@ -73,6 +84,8 @@ If `compare-ignore-case' is non-nil, changes in case are also ignored."
                           compare-windows-whitespace))))
     (setq p1 (point) b1 (current-buffer))
     (setq w2 (next-window (selected-window)))
+    (if (eq w2 (selected-window))
+       (setq w2 (next-window (selected-window) nil 'visible)))
     (if (eq w2 (selected-window))
        (error "No other window"))
     (setq p2 (window-point w2)