aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii <[email protected]>2011-03-19 11:30:56 +0200
committerEli Zaretskii <[email protected]>2011-03-19 11:30:56 +0200
commit576bce32675146e772183647c4750c1f5f9b7de7 (patch)
tree4584c1d0bc3b546bbde542e86e151037447bf8a4
parent45763476fcc967a750bb2abe3bd7a43b7a19e537 (diff)
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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emerge.el23
2 files changed, 21 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5bd208ba3c..602b60c6aa 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-19 Eli Zaretskii <[email protected]>
+
+ * 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 <[email protected]>
* info.el (info-initialize): Replace all uses of `:' with
diff --git a/lisp/emerge.el b/lisp/emerge.el
index 997077aa08..ffae5529e1 100644
--- a/lisp/emerge.el
+++ b/lisp/emerge.el
@@ -3187,21 +3187,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)