Merge from trunk
[bpt/emacs.git] / lisp / vc / emerge.el
index ee34944..a48f2af 100644 (file)
 (defmacro emerge-defvar-local (var value doc)
   "Defines SYMBOL as an advertised variable.
 Performs a defvar, then executes `make-variable-buffer-local' on
-the variable.  Also sets the `preserved' property, so that
+the variable.  Also sets the `permanent-local' property, so that
 `kill-all-local-variables' (called by major-mode setting commands)
 won't destroy Emerge control variables."
   `(progn
     (defvar ,var ,value ,doc)
     (make-variable-buffer-local ',var)
-    (put ',var 'preserved t)))
+    (put ',var 'permanent-local t)))
 
 ;; Add entries to minor-mode-alist so that emerge modes show correctly
 (defvar emerge-minor-modes-list
@@ -1271,10 +1271,10 @@ Otherwise, the A or B file present is copied to the output file."
 (defun emerge-merge-directories (a-dir b-dir ancestor-dir output-dir)
   (interactive
    (list
-    (read-file-name "A directory: " nil nil 'confirm)
-    (read-file-name "B directory: " nil nil 'confirm)
-    (read-file-name "Ancestor directory (null for none): " nil nil 'confirm)
-    (read-file-name "Output directory (null for none): " nil nil 'confirm)))
+    (read-directory-name "A directory: " nil nil 'confirm)
+    (read-directory-name "B directory: " nil nil 'confirm)
+    (read-directory-name "Ancestor directory (null for none): " nil nil 'confirm)
+    (read-directory-name "Output directory (null for none): " nil nil 'confirm)))
   ;; Check that we're not on a line
   (if (not (and (bolp) (eolp)))
       (error "There is text on this line"))
@@ -1354,8 +1354,8 @@ Otherwise, the A or B file present is copied to the output file."
   (delete-other-windows)
   (switch-to-buffer merge-buffer)
   (emerge-refresh-mode-line)
-  (split-window-vertically)
-  (split-window-horizontally)
+  (split-window-below)
+  (split-window-right)
   (switch-to-buffer buffer-A)
   (if pos
       (goto-char (point-min)))
@@ -1754,7 +1754,7 @@ to the left margin, if they are in windows."
 ;; If there are min-lines lines above and below the region, then don't do
 ;; anything.
 ;; If not, recenter the region to make it so.
-;; If that isn't possible, remove context lines balancedly from top and bottom
+;; If that isn't possible, remove context lines evenly from top and bottom
 ;; so the entire region shows.
 ;; If that isn't possible, show the top of the region.
 ;; BEG must be at the beginning of a line.
@@ -2121,7 +2121,7 @@ Use C-u l to reset the windows afterward."
   (delete-other-windows)
   (let ((temp-buffer-show-function
         (lambda (buf)
-          (split-window-vertically)
+          (split-window-below)
           (switch-to-buffer buf)
           (other-window 1))))
     (with-output-to-temp-buffer "*Help*"
@@ -3176,21 +3176,26 @@ See also `auto-save-file-name-p'."
 
 ;; Metacharacters that have to be protected from the shell when executing
 ;; a diff/diff3 command.
-(defcustom emerge-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]"
-  "Characters that must be quoted with \\ when used in a shell command line.
+(defcustom emerge-metachars
+  (if (memq system-type '(ms-dos windows-nt))
+      "[ \t\"<>|?*^&=]"
+    "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]")
+  "Characters that must be quoted when used in a shell command line.
 More precisely, a [...] regexp to match any one such character."
   :type 'regexp
   :group 'emerge)
 
 ;; Quote metacharacters (using \) when executing a diff/diff3 command.
 (defun emerge-protect-metachars (s)
-  (let ((limit 0))
-    (while (string-match emerge-metachars s limit)
-      (setq s (concat (substring s 0 (match-beginning 0))
-                     "\\"
-                     (substring s (match-beginning 0))))
-      (setq limit (1+ (match-end 0)))))
-  s)
+  (if (memq system-type '(ms-dos windows-nt))
+      (shell-quote-argument s)
+    (let ((limit 0))
+      (while (string-match emerge-metachars s limit)
+       (setq s (concat (substring s 0 (match-beginning 0))
+                       "\\"
+                       (substring s (match-beginning 0))))
+       (setq limit (1+ (match-end 0)))))
+    s))
 
 (provide 'emerge)