]> code.delx.au - gnu-emacs/blobdiff - lisp/vc/diff-mode.el
Merge from trunk.
[gnu-emacs] / lisp / vc / diff-mode.el
index 392973e08feeb476501d6c661314f4221d573326..7de9d17e3f77bffbc0e67be03c975d04b171be30 100644 (file)
@@ -1,6 +1,6 @@
 ;;; diff-mode.el --- a mode for viewing/editing context diffs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998-2011  Free Software Foundation, Inc.
+;; Copyright (C) 1998-2012  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: convenience patch diff vc
@@ -146,7 +146,7 @@ when editing big diffs)."
                ;; but not all since they may hide useful M-<foo> global
                ;; bindings when editing.
                (set-keymap-parent map diff-mode-shared-map)
-               (dolist (key '("A" "r" "R" "g" "q" "W"))
+               (dolist (key '("A" "r" "R" "g" "q" "W" "z"))
                  (define-key map key nil))
                map))
     ;; From compilation-minor-mode.
@@ -225,9 +225,16 @@ when editing big diffs)."
   "Keymap for `diff-minor-mode'.  See also `diff-mode-shared-map'.")
 
 (define-minor-mode diff-auto-refine-mode
-  "Automatically highlight changes in detail as the user visits hunks.
-When transitioning from disabled to enabled,
-try to refine the current hunk, as well."
+  "Toggle automatic diff hunk highlighting (Diff Auto Refine mode).
+With a prefix argument ARG, enable Diff Auto Refine mode if ARG
+is positive, and disable it otherwise.  If called from Lisp,
+enable the mode if ARG is omitted or nil.
+
+Diff Auto Refine mode is a buffer-local minor mode used with
+`diff-mode'.  When enabled, Emacs automatically highlights
+changes in detail as the user visits hunks.  When transitioning
+from disabled to enabled, it tries to refine the current hunk, as
+well."
   :group 'diff-mode :init-value t :lighter nil ;; " Auto-Refine"
   (when diff-auto-refine-mode
     (condition-case-no-debug nil (diff-refine-hunk) (error nil))))
@@ -808,9 +815,11 @@ PREFIX is only used internally: don't use it."
            (diff-find-file-name old noprompt (match-string 1)))
        ;; if all else fails, ask the user
        (unless noprompt
-         (let ((file (read-file-name (format "Use file %s: "
-                                             (or (first fs) ""))
-                                     nil (first fs) t (first fs))))
+         (let ((file (expand-file-name (or (first fs) ""))))
+          (setq file
+                (read-file-name (format "Use file %s: " file)
+                                (file-name-directory file) file t
+                                (file-name-nondirectory file)))
            (set (make-local-variable 'diff-remembered-files-alist)
                 (cons (cons fs file) diff-remembered-files-alist))
            file))))))
@@ -1306,7 +1315,11 @@ a diff with \\[diff-reverse-direction].
 
 ;;;###autoload
 (define-minor-mode diff-minor-mode
-  "Minor mode for viewing/editing context diffs.
+  "Toggle Diff minor mode.
+With a prefix argument ARG, enable Diff minor mode if ARG is
+positive, and disable it otherwise.  If called from Lisp, enable
+the mode if ARG is omitted or nil.
+
 \\{diff-minor-mode-map}"
   :group 'diff-mode :lighter " Diff"
   ;; FIXME: setup font-lock