1 ;;; winnt.el --- Lisp routines for Windows NT.
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 completions.
43 (defun nt-shell-mode-hook ()
44 (setq comint-completion-addsuffix '("\\" . " ")
45 comint-process-echoes t))
46 (add-hook 'shell-mode-hook 'nt-shell-mode-hook)
48 ;; Use ";" instead of ":" as a path separator (from files.el).
49 (setq path-separator ";")
51 ;; Set the null device (for compile.el).
52 ;; #### There should be such a global thingy as null-device - kkm
53 (setq grep-null-device "NUL")
55 ;; Set the grep regexp to match entries with drive letters.
56 (setq grep-regexp-alist
57 '(("^\\(\\([a-zA-Z]:\\)?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]" 1 3)))
59 ;;----------------------------------------------------------------------
61 ;;--------------------
63 ;; Avoid creating auto-save file names containing invalid characters
64 ;; (primarily "*", eg. for the *mail* buffer).
65 ;; Avoid "doc lost for function" warning
66 (defun original-make-auto-save-file-name (&optional junk)
67 "You do not want to call this."
69 (fset 'original-make-auto-save-file-name
70 (symbol-function 'make-auto-save-file-name))
72 (defun make-auto-save-file-name ()
73 "Return file name to use for auto-saves of current buffer.
74 Does not consider `auto-save-visited-file-name' as that variable is checked
75 before calling this function. You can redefine this for customization.
76 See also `auto-save-file-name-p'."
77 (let ((name (original-make-auto-save-file-name))
79 ;; destructively replace occurences of * or ? with $
80 (while (string-match "[?*]" name start)
81 (aset name (match-beginning 0) ?$)
82 (setq start (1+ (match-end 0))))
85 ;;----------------------------------------------------------------------
86 ;; Quoting process args
87 ;;--------------------
89 (defun nt-quote-args-verbatim (args)
90 "Copy ARG list verbatim, separating each arg with space."
91 (mapconcat 'identity args " "))
93 (defun nt-quote-args-prefix-quote (prefix args)
94 (mapconcat (lambda (str)
96 (mapconcat (lambda (ch)
97 (concat (if (eq ch ?\") prefix)
103 (defun nt-quote-args-backslash-quote (args)
104 "Place ARG list in quotes, prefixing quotes in args with backslashes."
105 (nt-quote-args-prefix-quote "\\" args))
107 (defun nt-quote-args-double-quote (args)
108 "Place ARG list in quotes, doubling quotes in args."
109 (nt-quote-args-prefix-quote "\"" args))
111 (defvar nt-quote-args-functions-alist
112 '(("^.?.?sh\\." . nt-quote-args-double-quote))
113 "An alist for determining proper argument quoting given executable file name.
114 Car of each cons must be a string, a regexp against which a file name sans
115 directory is matched. Cdr is a function symbol. The list is mathced in
116 forward order, and mathcing entry cdr's funcrion is called with a list of
117 strings, process arguments. It must return a string which is passed to
118 the newly created process.
120 If not found, then `nt-quote-args-verbatim' is called on the argument list.")
122 (defun nt-quote-process-args (args)
123 ;;Properly quote process ARGS for executing (car ARGS).
124 (let ((fname (file-name-nondirectory (car args)))
125 (alist nt-quote-args-functions-alist)
126 (case-fold-search nil)
131 (setq assoc (pop alist))
132 (if (string-match (car assoc) fname)
133 (setq return-me (funcall (cdr assoc) (cdr args)))))
135 (nt-quote-args-verbatim (cdr args)))))
137 ;;; winnt.el ends here