-;;----------------------------------------------------------------------
-;; Autosave hack
-;;--------------------
-
-;; Avoid creating auto-save file names containing invalid characters
-;; (primarily "*", eg. for the *mail* buffer).
-;; Avoid "doc lost for function" warning
-(defun original-make-auto-save-file-name (&optional junk)
- "You do not want to call this."
- )
-(fset 'original-make-auto-save-file-name
- (symbol-function 'make-auto-save-file-name))
-
-(defun make-auto-save-file-name ()
- "Return file name to use for auto-saves of current buffer.
-Does not consider `auto-save-visited-file-name' as that variable is checked
-before calling this function. You can redefine this for customization.
-See also `auto-save-file-name-p'."
- (let ((name (original-make-auto-save-file-name))
- (start 0))
- ;; destructively replace occurrences of * or ? with $
- (while (string-match "[?*]" name start)
- (aset name (match-beginning 0) ?$)
- (setq start (1+ (match-end 0))))
- name))
+(defvar mswindows-system-shells '("cmd" "cmd.exe" "command" "command.com"
+ "4nt" "4nt.exe" "4dos" "4dos.exe"
+ "ndos" "ndos.exe")
+ "List of strings recognized as Windows NT/9X system shells.
+These are shells with native semantics, e.g. they use `/c', not '-c',
+to pass a command in.")
+
+(defun mswindows-system-shell-p (shell-name)
+ (member (downcase (file-name-nondirectory shell-name))
+ mswindows-system-shells))
+
+(defun init-mswindows-at-startup ()
+ ;; shell-file-name is initialized in the C code (callproc.c) from
+ ;; SHELL or COMSPEC.
+ ;; #### If only shell-command-switch could be a function. But there
+ ;; is code littered around that uses it.
+ ;; #### Maybe we should set a symbol-value handler on `shell-file-name'
+ ;; that automatically sets shell-command-switch?
+ (if (mswindows-system-shell-p shell-file-name)
+ (setq shell-command-switch "/c")))