1 ;;; winnt.el --- Lisp routines for MS Windows.
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
5 ;; Maintainer: XEmacs Development Team
6 ;; Keywords: mouse, dumped
8 ;; This file is part of XEmacs.
10 ;; XEmacs is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; XEmacs is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;;; Synched up with: Not synched with FSF. Almost completely divergent.
29 ;; This file is dumped with XEmacs for MS Windows (without cygwin).
31 ;; Based on NT Emacs version by Geoff Voelker (voelker@cs.washington.edu)
32 ;; Ported to XEmacs by Marc Paquette <marcpa@cam.org>
33 ;; Largely modified by Kirill M. Katsnelson <kkm@kis.ru>
37 ;; The cmd.exe shell uses the "/c" switch instead of the "-c" switch
38 ;; for executing its command line argument (from simple.el).
39 ;; #### Oh if we had an alist of shells and their command switches.
40 (setq shell-command-switch "/c")
42 ;; For appending suffixes to directories and files in shell
43 ;; completions. This screws up cygwin users so we leave it out for
44 ;; now. Uncomment this if you only ever want to use cmd.
46 ;(defun nt-shell-mode-hook ()
47 ; (setq comint-completion-addsuffix '("\\" . " ")
48 ; comint-process-echoes t))
49 ;(add-hook 'shell-mode-hook 'nt-shell-mode-hook)
51 ;; Use ";" instead of ":" as a path separator (from files.el).
52 (setq path-separator ";")
54 ;; Set the null device (for compile.el).
55 ;; #### There should be such a global thingy as null-device - kkm
56 (setq grep-null-device "NUL")
58 ;; Set the grep regexp to match entries with drive letters.
59 (setq grep-regexp-alist
60 '(("^\\(\\([a-zA-Z]:\\)?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 3)))
62 ;;----------------------------------------------------------------------
64 ;;--------------------
66 ;; Avoid creating auto-save file names containing invalid characters
67 ;; (primarily "*", eg. for the *mail* buffer).
68 ;; Avoid "doc lost for function" warning
69 (defun original-make-auto-save-file-name (&optional junk)
70 "You do not want to call this."
72 (fset 'original-make-auto-save-file-name
73 (symbol-function 'make-auto-save-file-name))
75 (defun make-auto-save-file-name ()
76 "Return file name to use for auto-saves of current buffer.
77 Does not consider `auto-save-visited-file-name' as that variable is checked
78 before calling this function. You can redefine this for customization.
79 See also `auto-save-file-name-p'."
80 (let ((name (original-make-auto-save-file-name))
82 ;; destructively replace occurrences of * or ? with $
83 (while (string-match "[?*]" name start)
84 (aset name (match-beginning 0) ?$)
85 (setq start (1+ (match-end 0))))
88 ;;----------------------------------------------------------------------
89 ;; Quoting process args
90 ;;--------------------
92 (defun nt-quote-args-verbatim (args)
93 "Copy ARG list verbatim, separating each arg with space."
94 (mapconcat #'identity args " "))
96 (defun nt-quote-args-prefix-quote (prefix args)
97 (mapconcat (lambda (str)
99 (mapconcat (lambda (ch)
100 (concat (if (eq ch ?\") prefix)
101 (char-to-string ch)))
106 (defun nt-quote-args-backslash-quote (args)
107 "Place ARG list in quotes, prefixing quotes in args with backslashes."
108 (nt-quote-args-prefix-quote "\\" args))
110 (defun nt-quote-args-double-quote (args)
111 "Place ARG list in quotes, doubling quotes in args."
112 (nt-quote-args-prefix-quote "\"" args))
114 (defvar nt-quote-args-functions-alist
115 '(("^.?.?sh\\." . nt-quote-args-double-quote))
116 "An alist for determining proper argument quoting given executable file name.
117 Car of each cons must be a string, a regexp against which a file name sans
118 directory is matched. Cdr is a function symbol. The list is mathced in
119 forward order, and mathcing entry cdr's funcrion is called with a list of
120 strings, process arguments. It must return a string which is passed to
121 the newly created process.
123 If not found, then `nt-quote-args-verbatim' is called on the argument list.")
125 (defun nt-quote-process-args (args)
126 ;;Properly quote process ARGS for executing (car ARGS).
127 (let ((fname (file-name-nondirectory (car args)))
128 (alist nt-quote-args-functions-alist)
129 (case-fold-search nil)
134 (setq assoc (pop alist))
135 (if (string-match (car assoc) fname)
136 (setq return-me (funcall (cdr assoc) (cdr args)))))
138 (nt-quote-args-verbatim (cdr args)))))
140 ;;; winnt.el ends here