Mercurial > emacs
comparison lisp/w32-fns.el @ 17549:f57de209f01b
(w32-using-nt, w32-shell-name, w32-using-system-shell-p,
w32-startup): New functions.
(w32-system-shells): New variable.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Thu, 24 Apr 1997 02:58:11 +0000 |
parents | 2a3cc82fa1ea |
children | 4b8ff0021dcb |
comparison
equal
deleted
inserted
replaced
17548:dab7558986cd | 17549:f57de209f01b |
---|---|
40 (define-key function-key-map [C-M-backspace] [\C-\M-delete]) | 40 (define-key function-key-map [C-M-backspace] [\C-\M-delete]) |
41 | 41 |
42 ;; Ignore case on file-name completion | 42 ;; Ignore case on file-name completion |
43 (setq completion-ignore-case t) | 43 (setq completion-ignore-case t) |
44 | 44 |
45 ;; The cmd.exe shell uses the "/c" switch instead of the "-c" switch | 45 (defvar w32-system-shells '("cmd" "cmd.exe" "command" "command.com") |
46 ;; for executing its command line argument (from simple.el). | 46 "List of strings recognized as Windows NT/95 system shells.") |
47 (setq shell-command-switch "/c") | |
48 | 47 |
49 ;; For appending suffixes to directories and files in shell completions. | 48 (defun w32-using-nt () |
50 (add-hook 'shell-mode-hook | 49 "Return t if running on Windows NT (as oppposed to, e.g., Windows 95)." |
51 '(lambda () (setq comint-completion-addsuffix '("\\" . " ")))) | 50 (and (eq system-type 'windows-nt) (getenv "SystemRoot"))) |
51 | |
52 (defun w32-shell-name () | |
53 "Return the name of the shell being used on Windows NT/95." | |
54 (or (and (boundp 'explicit-shell-file-name) explicit-shell-file-name) | |
55 (getenv "ESHELL") | |
56 (getenv "SHELL") | |
57 (and (w32-using-nt) "cmd.exe") | |
58 "command.com")) | |
59 | |
60 (defun w32-using-system-shell-p () | |
61 "Return t if using a Windows NT/95 system shell (cmd.exe or command.com)." | |
62 (member (downcase (file-name-nondirectory (w32-shell-name))) | |
63 w32-system-shells)) | |
64 | |
65 (defun w32-startup () | |
66 "Configure Emacs during startup for running on Windows NT/95. | |
67 This function is invoked after loading the init files and processing | |
68 the command line, and is intended to initialize anything important | |
69 not initialized by the user or site." | |
70 ;; Configure shell mode if using a system shell. | |
71 (cond ((w32-using-system-shell-p) | |
72 (let ((shell (file-name-nondirectory (w32-shell-name)))) | |
73 ;; "/c" is used for executing command line arguments. | |
74 (setq shell-command-switch "/c") | |
75 ;; Complete directories using a backslash. | |
76 (setq comint-completion-addsuffix '("\\" . " ")) | |
77 ;; Initialize the explicit-"shell"-args variable. | |
78 (cond ((member (downcase shell) '("cmd" "cmd.exe")) | |
79 (let* ((args-sym-name (format "explicit-%s-args" shell)) | |
80 (args-sym (intern-soft args-sym-name))) | |
81 (cond ((not args-sym) | |
82 (setq args-sym (intern args-sym-name)) | |
83 ;; The "/q" prevents cmd.exe from echoing commands. | |
84 (set args-sym '("/q"))))))))))) | |
85 | |
86 (add-hook 'emacs-startup-hook 'w32-startup) | |
52 | 87 |
53 ;; Avoid creating auto-save file names containing invalid characters. | 88 ;; Avoid creating auto-save file names containing invalid characters. |
54 (fset 'original-make-auto-save-file-name | 89 (fset 'original-make-auto-save-file-name |
55 (symbol-function 'make-auto-save-file-name)) | 90 (symbol-function 'make-auto-save-file-name)) |
56 | 91 |