emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100530: Fix emerge.el on MS-Windo


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100530: Fix emerge.el on MS-Windows and MS-DOS.
Date: Sat, 19 Mar 2011 11:30:56 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100530
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-23
timestamp: Sat 2011-03-19 11:30:56 +0200
message:
  Fix emerge.el on MS-Windows and MS-DOS.
  
   lisp/emerge.el (emerge-metachars): Separate value for ms-dos and
   windows-nt systems.
   (emerge-protect-metachars): Quote correctly for ms-dos and
   windows-nt systems.
modified:
  lisp/ChangeLog
  lisp/emerge.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-16 00:00:58 +0000
+++ b/lisp/ChangeLog    2011-03-19 09:30:56 +0000
@@ -1,3 +1,10 @@
+2011-03-19  Eli Zaretskii  <address@hidden>
+
+       * emerge.el (emerge-metachars): Separate value for ms-dos and
+       windows-nt systems.
+       (emerge-protect-metachars): Quote correctly for ms-dos and
+       windows-nt systems.
+
 2011-03-15  Ralph Schleicher  <address@hidden>
 
        * info.el (info-initialize): Replace all uses of `:' with

=== modified file 'lisp/emerge.el'
--- a/lisp/emerge.el    2010-01-04 05:35:18 +0000
+++ b/lisp/emerge.el    2011-03-19 09:30:56 +0000
@@ -3187,21 +3187,26 @@
 
 ;; 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)
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]