Mercurial > emacs
comparison lisp/w32-fns.el @ 21597:409211e285bc
(w32-system-shells): Add 4dos and 4nt.
(w32-allow-system-shell, w32-valid-locales): New variable.
(w32-check-shell-configuration): Make interactive.
Obey w32-allow-system-shell.
(w32-get-valid-locale-ids, w32-list-locales): New functions.
(w32-init-info): Fix relative path to info directory.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Fri, 17 Apr 1998 05:03:43 +0000 |
parents | cbd9e55a6cdc |
children | 073e555c28c8 |
comparison
equal
deleted
inserted
replaced
21596:de7ecc11ba03 | 21597:409211e285bc |
---|---|
44 | 44 |
45 ;; Map all versions of a filename (8.3, longname, mixed case) to the | 45 ;; Map all versions of a filename (8.3, longname, mixed case) to the |
46 ;; same buffer. | 46 ;; same buffer. |
47 (setq find-file-visit-truename t) | 47 (setq find-file-visit-truename t) |
48 | 48 |
49 (defvar w32-system-shells '("cmd" "cmd.exe" "command" "command.com") | 49 (defvar w32-system-shells '("cmd" "cmd.exe" "command" "command.com" |
50 "4nt" "4nt.exe" "4dos" "4dos.exe" | |
51 "ndos" "ndos.exe") | |
50 "List of strings recognized as Windows NT/9X system shells.") | 52 "List of strings recognized as Windows NT/9X system shells.") |
51 | 53 |
52 (defun w32-using-nt () | 54 (defun w32-using-nt () |
53 "Return t if literally running on Windows NT (i.e., not Windows 9X)." | 55 "Return t if literally running on Windows NT (i.e., not Windows 9X)." |
54 (and (eq system-type 'windows-nt) (getenv "SystemRoot"))) | 56 (and (eq system-type 'windows-nt) (getenv "SystemRoot"))) |
64 (defun w32-system-shell-p (shell-name) | 66 (defun w32-system-shell-p (shell-name) |
65 (and shell-name | 67 (and shell-name |
66 (member (downcase (file-name-nondirectory shell-name)) | 68 (member (downcase (file-name-nondirectory shell-name)) |
67 w32-system-shells))) | 69 w32-system-shells))) |
68 | 70 |
71 (defvar w32-allow-system-shell nil | |
72 "*Disable startup warning when using \"system\" shells.") | |
73 | |
69 (defun w32-check-shell-configuration () | 74 (defun w32-check-shell-configuration () |
70 "Check the configuration of shell variables on Windows NT/9X. | 75 "Check the configuration of shell variables on Windows NT/9X. |
71 This function is invoked after loading the init files and processing | 76 This function is invoked after loading the init files and processing |
72 the command line arguments. It issues a warning if the user or site | 77 the command line arguments. It issues a warning if the user or site |
73 has configured the shell with inappropriate settings." | 78 has configured the shell with inappropriate settings." |
79 (interactive) | |
74 (let ((prev-buffer (current-buffer)) | 80 (let ((prev-buffer (current-buffer)) |
75 (buffer (get-buffer-create "*Shell Configuration*")) | 81 (buffer (get-buffer-create "*Shell Configuration*")) |
76 (system-shell)) | 82 (system-shell)) |
77 (set-buffer buffer) | 83 (set-buffer buffer) |
78 (erase-buffer) | 84 (erase-buffer) |
92 (w32-system-shell-p explicit-shell-file-name)) | 98 (w32-system-shell-p explicit-shell-file-name)) |
93 (insert (format "Warning! explicit-shell-file-name uses %s. | 99 (insert (format "Warning! explicit-shell-file-name uses %s. |
94 You probably want to change it so that it uses cmdproxy.exe instead.\n\n" | 100 You probably want to change it so that it uses cmdproxy.exe instead.\n\n" |
95 explicit-shell-file-name))) | 101 explicit-shell-file-name))) |
96 (setq system-shell (> (buffer-size) 0)) | 102 (setq system-shell (> (buffer-size) 0)) |
103 | |
104 ;; Allow user to specify that they really do want to use one of the | |
105 ;; "system" shells, despite the drawbacks, but still warn if | |
106 ;; shell-command-switch doesn't match. | |
107 (if w32-allow-system-shell | |
108 (erase-buffer)) | |
109 | |
97 (cond (system-shell | 110 (cond (system-shell |
98 ;; System shells. | 111 ;; System shells. |
99 (if (string-equal "-c" shell-command-switch) | 112 (if (string-equal "-c" shell-command-switch) |
100 (insert "Warning! shell-command-switch is \"-c\". | 113 (insert "Warning! shell-command-switch is \"-c\". |
101 You should set this to \"/c\" when using a system shell.\n\n")) | 114 You should set this to \"/c\" when using a system shell.\n\n")) |
115 (kill-buffer buffer)) | 128 (kill-buffer buffer)) |
116 (set-buffer prev-buffer))) | 129 (set-buffer prev-buffer))) |
117 | 130 |
118 (add-hook 'after-init-hook 'w32-check-shell-configuration) | 131 (add-hook 'after-init-hook 'w32-check-shell-configuration) |
119 | 132 |
133 | |
134 ;;; Basic support functions for managing Emacs' locale setting | |
135 | |
136 (defvar w32-valid-locales nil | |
137 "List of locale ids known to be supported.") | |
138 | |
139 ;;; This is the brute-force version; an efficient version is now | |
140 ;;; built-in though. | |
141 (if (not (fboundp 'w32-get-valid-locale-ids)) | |
142 (defun w32-get-valid-locale-ids () | |
143 "Return list of all valid Windows locale ids." | |
144 (let ((i 65535) | |
145 locales) | |
146 (while (> i 0) | |
147 (if (w32-get-locale-info i) | |
148 (setq locales (cons i locales))) | |
149 (setq i (1- i))) | |
150 locales))) | |
151 | |
152 (defun w32-list-locales () | |
153 "List the name and id of all locales supported by Windows." | |
154 (interactive) | |
155 (if (null w32-valid-locales) | |
156 (setq w32-valid-locales (w32-get-valid-locale-ids))) | |
157 (switch-to-buffer-other-window (get-buffer-create "*Supported Locales*")) | |
158 (erase-buffer) | |
159 (insert "LCID\tAbbrev\tFull name\n\n") | |
160 (insert (mapconcat | |
161 '(lambda (x) | |
162 (format "%d\t%s\t%s" | |
163 x | |
164 (w32-get-locale-info x) | |
165 (w32-get-locale-info x t))) | |
166 w32-valid-locales "\n")) | |
167 (insert "\n") | |
168 (goto-char (point-min))) | |
169 | |
170 | |
120 ;;; Setup Info-default-directory-list to include the info directory | 171 ;;; Setup Info-default-directory-list to include the info directory |
121 ;;; near where Emacs executable was installed. We used to set INFOPATH, | 172 ;;; near where Emacs executable was installed. We used to set INFOPATH, |
122 ;;; but when this is set Info-default-directory-list is ignored. We | 173 ;;; but when this is set Info-default-directory-list is ignored. We |
123 ;;; also cannot rely upon what is set in paths.el because they assume | 174 ;;; also cannot rely upon what is set in paths.el because they assume |
124 ;;; that configuration during build time is correct for runtime. | 175 ;;; that configuration during build time is correct for runtime. |
125 (defun w32-init-info () | 176 (defun w32-init-info () |
126 (let* ((instdir (file-name-directory invocation-directory)) | 177 (let* ((instdir (file-name-directory invocation-directory)) |
127 (dir1 (expand-file-name "info/" instdir)) | 178 (dir1 (expand-file-name "../info/" instdir)) |
128 (dir2 (expand-file-name "../../../info/" instdir))) | 179 (dir2 (expand-file-name "../../../info/" instdir))) |
129 (if (file-exists-p dir1) | 180 (if (file-exists-p dir1) |
130 (setq Info-default-directory-list | 181 (setq Info-default-directory-list |
131 (append Info-default-directory-list (list dir1))) | 182 (append Info-default-directory-list (list dir1))) |
132 (if (file-exists-p dir2) | 183 (if (file-exists-p dir2) |