PROBLEMS: Update Cygwin-related info regarding GCC versions.
[bpt/emacs.git] / lisp / w32-fns.el
CommitLineData
e8af40ee 1;;; w32-fns.el --- Lisp routines for Windows NT
b578f267 2
597e2240 3;; Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
114f9c96 4;; 2009, 2010 Free Software Foundation, Inc.
95ed0025 5
68429d86 6;; Author: Geoff Voelker <voelker@cs.washington.edu>
284b3043 7;; Keywords: internal
95ed0025
RS
8
9;; This file is part of GNU Emacs.
10
eb3fa2cf 11;; GNU Emacs is free software: you can redistribute it and/or modify
95ed0025 12;; it under the terms of the GNU General Public License as published by
eb3fa2cf
GM
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
95ed0025
RS
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
eb3fa2cf 22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
95ed0025
RS
23
24;;; Commentary:
25
95ed0025
RS
26
27;;; Code:
2f42c75f 28(require 'w32-vars)
95ed0025 29
b5de9ae0
JB
30(defvar explicit-shell-file-name)
31
716eb574
JR
32;;;; Function keys
33
34(defvar x-alternatives-map
35 (let ((map (make-sparse-keymap)))
36 ;; Map certain keypad keys into ASCII characters that people usually expect.
716eb574
JR
37 (define-key map [M-backspace] [?\M-\d])
38 (define-key map [M-delete] [?\M-\d])
39 (define-key map [M-tab] [?\M-\t])
40 (define-key map [M-linefeed] [?\M-\n])
41 (define-key map [M-clear] [?\M-\C-l])
42 (define-key map [M-return] [?\M-\C-m])
43 (define-key map [M-escape] [?\M-\e])
44 (define-key map [iso-lefttab] [backtab])
45 (define-key map [S-iso-lefttab] [backtab])
c56e37dd 46 (define-key map [S-tab] [backtab])
716eb574
JR
47 map)
48 "Keymap of possible alternative meanings for some keys.")
49
50(defun x-setup-function-keys (frame)
3077d1f6 51 "Set up `function-key-map' on the graphical frame FRAME."
716eb574
JR
52 ;; Don't do this twice on the same display, or it would break
53 ;; normal-erase-is-backspace-mode.
54 (unless (terminal-parameter frame 'x-setup-function-keys)
55 ;; Map certain keypad keys into ASCII characters that people usually expect.
56 (with-selected-frame frame
57 (let ((map (copy-keymap x-alternatives-map)))
58 (set-keymap-parent map (keymap-parent local-function-key-map))
59 (set-keymap-parent local-function-key-map map)))
60 (set-terminal-parameter frame 'x-setup-function-keys t)))
61
73e6adaa
DN
62(declare-function set-message-beep "w32console.c")
63(declare-function w32-get-clipboard-data "w32select.c")
64(declare-function w32-get-locale-info "w32proc.c")
65(declare-function w32-get-valid-locale-ids "w32proc.c")
66(declare-function w32-set-clipboard-data "w32select.c")
81b38822 67
bcaf1c36 68;; Map all versions of a filename (8.3, longname, mixed case) to the
d234707d
GV
69;; same buffer.
70(setq find-file-visit-truename t)
71
aa360da1
GM
72(declare-function x-server-version "w32fns.c" (&optional display))
73
161ab819
AI
74(defun w32-version ()
75 "Return the MS-Windows version numbers.
76The value is a list of three integers: the major and minor version
77numbers, and the build number."
78 (x-server-version))
79
ee82af56 80(defun w32-using-nt ()
4ff64219 81 "Return non-nil if running on a Windows NT descendant.
49bd2bfe 82That includes all Windows systems except for 9X/Me."
ee82af56
GV
83 (and (eq system-type 'windows-nt) (getenv "SystemRoot")))
84
85(defun w32-shell-name ()
d234707d 86 "Return the name of the shell being used."
551ea1bd 87 (or (bound-and-true-p explicit-shell-file-name)
ee82af56
GV
88 (getenv "ESHELL")
89 (getenv "SHELL")
90 (and (w32-using-nt) "cmd.exe")
91 "command.com"))
92
d234707d
GV
93(defun w32-system-shell-p (shell-name)
94 (and shell-name
bcaf1c36 95 (member (downcase (file-name-nondirectory shell-name))
d234707d 96 w32-system-shells)))
ee82af56 97
f3e62da2 98(defun w32-shell-dos-semantics ()
8fc29035 99 "Return non-nil if the interactive shell being used expects MS-DOS shell semantics."
f3e62da2
GV
100 (or (w32-system-shell-p (w32-shell-name))
101 (and (member (downcase (file-name-nondirectory (w32-shell-name)))
102 '("cmdproxy" "cmdproxy.exe"))
103 (w32-system-shell-p (getenv "COMSPEC")))))
104
200fe89b
DN
105(defvar w32-quote-process-args) ;; defined in w32proc.c
106
d234707d 107(defun w32-check-shell-configuration ()
72ab66eb 108 "Check the configuration of shell variables on Windows.
ee82af56 109This function is invoked after loading the init files and processing
d234707d
GV
110the command line arguments. It issues a warning if the user or site
111has configured the shell with inappropriate settings."
85f568ec 112 (interactive)
d234707d
GV
113 (let ((prev-buffer (current-buffer))
114 (buffer (get-buffer-create "*Shell Configuration*"))
115 (system-shell))
116 (set-buffer buffer)
117 (erase-buffer)
118 (if (w32-system-shell-p (getenv "ESHELL"))
119 (insert (format "Warning! The ESHELL environment variable uses %s.
bcaf1c36 120You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
d234707d
GV
121 (getenv "ESHELL"))))
122 (if (w32-system-shell-p (getenv "SHELL"))
123 (insert (format "Warning! The SHELL environment variable uses %s.
bcaf1c36 124You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
d234707d
GV
125 (getenv "SHELL"))))
126 (if (w32-system-shell-p shell-file-name)
127 (insert (format "Warning! shell-file-name uses %s.
bcaf1c36 128You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
d234707d
GV
129 shell-file-name)))
130 (if (and (boundp 'explicit-shell-file-name)
131 (w32-system-shell-p explicit-shell-file-name))
132 (insert (format "Warning! explicit-shell-file-name uses %s.
133You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
134 explicit-shell-file-name)))
135 (setq system-shell (> (buffer-size) 0))
85f568ec
GV
136
137 ;; Allow user to specify that they really do want to use one of the
138 ;; "system" shells, despite the drawbacks, but still warn if
139 ;; shell-command-switch doesn't match.
140 (if w32-allow-system-shell
141 (erase-buffer))
142
d234707d
GV
143 (cond (system-shell
144 ;; System shells.
145 (if (string-equal "-c" shell-command-switch)
146 (insert "Warning! shell-command-switch is \"-c\".
147You should set this to \"/c\" when using a system shell.\n\n"))
148 (if w32-quote-process-args
149 (insert "Warning! w32-quote-process-args is t.
150You should set this to nil when using a system shell.\n\n")))
151 ;; Non-system shells.
152 (t
153 (if (string-equal "/c" shell-command-switch)
154 (insert "Warning! shell-command-switch is \"/c\".
155You should set this to \"-c\" when using a non-system shell.\n\n"))
156 (if (not w32-quote-process-args)
157 (insert "Warning! w32-quote-process-args is nil.
158You should set this to t when using a non-system shell.\n\n"))))
159 (if (> (buffer-size) 0)
160 (display-buffer buffer)
161 (kill-buffer buffer))
162 (set-buffer prev-buffer)))
163
164(add-hook 'after-init-hook 'w32-check-shell-configuration)
165
f2b256fa 166;; Override setting chosen at startup.
b1ed8648
AI
167(defun set-default-process-coding-system ()
168 ;; Most programs on Windows will accept Unix line endings on input
169 ;; (and some programs ported from Unix require it) but most will
170 ;; produce DOS line endings on output.
171 (setq default-process-coding-system
597e2240 172 (if (default-value 'enable-multibyte-characters)
b1ed8648
AI
173 '(undecided-dos . undecided-unix)
174 '(raw-text-dos . raw-text-unix)))
a272a739
JR
175 ;; Make cmdproxy default to using DOS line endings for input,
176 ;; because some Windows programs (including command.com) require it.
177 (add-to-list 'process-coding-system-alist
178 `("[cC][mM][dD][pP][rR][oO][xX][yY]"
597e2240 179 . ,(if (default-value 'enable-multibyte-characters)
a272a739
JR
180 '(undecided-dos . undecided-dos)
181 '(raw-text-dos . raw-text-dos))))
182 ;; plink needs DOS input when entering the password.
183 (add-to-list 'process-coding-system-alist
184 `("[pP][lL][iI][nN][kK]"
597e2240 185 . ,(if (default-value 'enable-multibyte-characters)
a272a739
JR
186 '(undecided-dos . undecided-dos)
187 '(raw-text-dos . raw-text-dos)))))
b1ed8648
AI
188
189(add-hook 'before-init-hook 'set-default-process-coding-system)
190
85f568ec
GV
191
192;;; Basic support functions for managing Emacs' locale setting
193
194(defvar w32-valid-locales nil
195 "List of locale ids known to be supported.")
196
f2b256fa
SM
197;; This is the brute-force version; an efficient version is now
198;; built-in though.
85f568ec
GV
199(if (not (fboundp 'w32-get-valid-locale-ids))
200 (defun w32-get-valid-locale-ids ()
201 "Return list of all valid Windows locale ids."
202 (let ((i 65535)
203 locales)
204 (while (> i 0)
205 (if (w32-get-locale-info i)
206 (setq locales (cons i locales)))
207 (setq i (1- i)))
208 locales)))
209
210(defun w32-list-locales ()
211 "List the name and id of all locales supported by Windows."
212 (interactive)
ac62ec16
JB
213 (when (null w32-valid-locales)
214 (setq w32-valid-locales (sort (w32-get-valid-locale-ids) #'<)))
555e23cf
JB
215 (with-output-to-temp-buffer "*Supported Locales*"
216 (princ "LCID\tAbbrev\tFull name\n\n")
011a0143
JB
217 (dolist (locale w32-valid-locales)
218 (princ (format "%d\t%s\t%s\n"
219 locale
220 (w32-get-locale-info locale)
221 (w32-get-locale-info locale t))))))
85f568ec 222
f2b256fa
SM
223;; Setup Info-default-directory-list to include the info directory
224;; near where Emacs executable was installed. We used to set INFOPATH,
225;; but when this is set Info-default-directory-list is ignored. We
226;; also cannot rely upon what is set in paths.el because they assume
227;; that configuration during build time is correct for runtime.
d234707d
GV
228(defun w32-init-info ()
229 (let* ((instdir (file-name-directory invocation-directory))
85f568ec 230 (dir1 (expand-file-name "../info/" instdir))
d234707d
GV
231 (dir2 (expand-file-name "../../../info/" instdir)))
232 (if (file-exists-p dir1)
bcaf1c36 233 (setq Info-default-directory-list
d234707d
GV
234 (append Info-default-directory-list (list dir1)))
235 (if (file-exists-p dir2)
236 (setq Info-default-directory-list
237 (append Info-default-directory-list (list dir2)))))))
238
239(add-hook 'before-init-hook 'w32-init-info)
3eab6a03 240
f2b256fa
SM
241;; The variable source-directory is used to initialize Info-directory-list.
242;; However, the common case is that Emacs is being used from a binary
243;; distribution, and the value of source-directory is meaningless in that
244;; case. Even worse, source-directory can refer to a directory on a drive
245;; on the build machine that happens to be a removable drive on the user's
246;; machine. When this happens, Emacs tries to access the removable drive
247;; and produces the abort/retry/ignore dialog. Since we do not use
248;; source-directory, set it to something that is a reasonable approximation
249;; on the user's machine.
250
251;;(add-hook 'before-init-hook
252;; (lambda ()
253;; (setq source-directory (file-name-as-directory
254;; (expand-file-name ".." exec-directory)))))
8929f478 255
98d8b17e
EZ
256(defun w32-convert-standard-filename (filename)
257 "Convert a standard file's name to something suitable for the MS-Windows.
915b0bf0
JB
258This means to guarantee valid names and perhaps to canonicalize
259certain patterns.
260
98d8b17e
EZ
261This function is called by `convert-standard-filename'.
262
263Replace invalid characters and turn Cygwin names into native
264names, and also turn slashes into backslashes if the shell
265requires it (see `w32-shell-dos-semantics')."
45b8a401
EZ
266 (save-match-data
267 (let ((name
268 (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)
bcaf1c36 269 (replace-match "\\1:/" t nil filename)
45b8a401
EZ
270 (copy-sequence filename)))
271 (start 0))
272 ;; leave ':' if part of drive specifier
273 (if (and (> (length name) 1)
274 (eq (aref name 1) ?:))
275 (setq start 2))
276 ;; destructively replace invalid filename characters with !
277 (while (string-match "[?*:<>|\"\000-\037]" name start)
278 (aset name (match-beginning 0) ?!)
279 (setq start (match-end 0)))
280 ;; convert directory separators to Windows format
281 ;; (but only if the shell in use requires it)
282 (when (w32-shell-dos-semantics)
283 (setq start 0)
284 (while (string-match "/" name start)
285 (aset name (match-beginning 0) ?\\)
286 (setq start (match-end 0))))
287 name)))
4e0cd0df 288
95ed0025 289;;; Fix interface to (X-specific) mouse.el
bffcf874 290(defun x-set-selection (type data)
d977a092 291 "Make an X selection of type TYPE and value DATA.
3077d1f6
EZ
292The argument TYPE (nil means `PRIMARY') says which selection, and
293DATA specifies the contents. TYPE must be a symbol. \(It can also
294be a string, which stands for the symbol with that name, but this
295is considered obsolete.) DATA may be a string, a symbol, an
296integer (or a cons of two integers or list of two integers).
297
298The selection may also be a cons of two markers pointing to the same buffer,
299or an overlay. In these cases, the selection is considered to be the text
300between the markers *at whatever time the selection is examined*.
301Thus, editing done in the buffer after you specify the selection
302can alter the effective value of the selection.
303
304The data may also be a vector of valid non-vector selection values.
305
306The return value is DATA.
307
308Interactively, this command sets the primary selection. Without
309prefix argument, it reads the selection in the minibuffer. With
310prefix argument, it uses the text of the region as the selection value.
311
312Note that on MS-Windows, primary and secondary selections set by Emacs
313are not available to other programs."
3f5c9cad 314 (put 'x-selections (or type 'PRIMARY) data))
bffcf874
RS
315
316(defun x-get-selection (&optional type data-type)
3077d1f6
EZ
317 "Return the value of an X Windows selection.
318The argument TYPE (default `PRIMARY') says which selection,
319and the argument DATA-TYPE (default `STRING') says
320how to convert the data.
321
322TYPE may be any symbol \(but nil stands for `PRIMARY'). However,
323only a few symbols are commonly used. They conventionally have
324all upper-case names. The most often used ones, in addition to
325`PRIMARY', are `SECONDARY' and `CLIPBOARD'.
326
327DATA-TYPE is usually `STRING', but can also be one of the symbols
328in `selection-converter-alist', which see."
3f5c9cad
CY
329 (get 'x-selections (or type 'PRIMARY)))
330
331;; x-selection-owner-p is used in simple.el
332(defun x-selection-owner-p (&optional type)
333 (and (memq type '(nil PRIMARY SECONDARY))
334 (get 'x-selections (or type 'PRIMARY))))
bffcf874 335
1b42a753 336(defun set-w32-system-coding-system (coding-system)
49bd2bfe 337 "Set the coding system used by the Windows system to CODING-SYSTEM.
1b42a753 338This is used for things like passing font names with non-ASCII
551ea1bd 339characters in them to the system. For a list of possible values of
086ceb30
JR
340CODING-SYSTEM, use \\[list-coding-systems].
341
342This function is provided for backward compatibility, since
49bd2bfe 343`w32-system-coding-system' is now an alias for `locale-coding-system'."
1b42a753 344 (interactive
086ceb30 345 (list (let ((default locale-coding-system))
1b42a753 346 (read-coding-system
5b76833f 347 (format "Coding system for system calls (default %s): "
1b42a753
GV
348 default)
349 default))))
350 (check-coding-system coding-system)
086ceb30
JR
351 (setq locale-coding-system coding-system))
352
353;; locale-coding-system was introduced to do the same thing as
354;; w32-system-coding-system. Use that instead.
355(defvaralias 'w32-system-coding-system 'locale-coding-system)
1b42a753 356
f2b256fa 357;; Set to a system sound if you want a fancy bell.
81b38822
KH
358(set-message-beep nil)
359
f2b256fa
SM
360;; The "Windows" keys on newer keyboards bring up the Start menu
361;; whether you want it or not - make Emacs ignore these keystrokes
362;; rather than beep.
d234707d
GV
363(global-set-key [lwindow] 'ignore)
364(global-set-key [rwindow] 'ignore)
365
15fa6efb
JR
366(defun w32-add-charset-info (xlfd-charset windows-charset codepage)
367 "Function to add character sets to display with Windows fonts.
368Creates entries in `w32-charset-info-alist'.
369XLFD-CHARSET is a string which will appear in the XLFD font name to
72ab66eb 370identify the character set. WINDOWS-CHARSET is a symbol identifying
551ea1bd
JB
371the Windows character set this maps to. For the list of possible
372values, see the documentation for `w32-charset-info-alist'. CODEPAGE
15fa6efb
JR
373can be a numeric codepage that Windows uses to display the character
374set, t for Unicode output with no codepage translation or nil for 8
375bit output with no translation."
376 (add-to-list 'w32-charset-info-alist
72ab66eb 377 (cons xlfd-charset (cons windows-charset codepage))))
15fa6efb 378
4c7ec703
JR
379;; The last charset we add becomes the "preferred" charset for the return
380;; value from w32-select-font etc, so list the most important charsets last.
15fa6efb
JR
381(w32-add-charset-info "iso8859-14" 'w32-charset-ansi 28604)
382(w32-add-charset-info "iso8859-15" 'w32-charset-ansi 28605)
2005121f
JR
383;; The following two are included for pattern matching.
384(w32-add-charset-info "jisx0201" 'w32-charset-shiftjis 932)
385(w32-add-charset-info "jisx0208" 'w32-charset-shiftjis 932)
15fa6efb
JR
386(w32-add-charset-info "jisx0201-latin" 'w32-charset-shiftjis 932)
387(w32-add-charset-info "jisx0201-katakana" 'w32-charset-shiftjis 932)
751be31e
JR
388(w32-add-charset-info "ksc5601.1989" 'w32-charset-hangeul 949)
389(w32-add-charset-info "big5" 'w32-charset-chinesebig5 950)
390(w32-add-charset-info "gb2312.1980" 'w32-charset-gb2312 936)
15fa6efb
JR
391(w32-add-charset-info "ms-symbol" 'w32-charset-symbol nil)
392(w32-add-charset-info "ms-oem" 'w32-charset-oem 437)
393(w32-add-charset-info "ms-oemlatin" 'w32-charset-oem 850)
57016d37
JR
394(w32-add-charset-info "iso8859-2" 'w32-charset-easteurope 28592)
395(w32-add-charset-info "iso8859-3" 'w32-charset-turkish 28593)
396(w32-add-charset-info "iso8859-4" 'w32-charset-baltic 28594)
397(w32-add-charset-info "iso8859-6" 'w32-charset-arabic 28596)
398(w32-add-charset-info "iso8859-7" 'w32-charset-greek 28597)
399(w32-add-charset-info "iso8859-8" 'w32-charset-hebrew 1255)
400(w32-add-charset-info "iso8859-9" 'w32-charset-turkish 1254)
401(w32-add-charset-info "iso8859-13" 'w32-charset-baltic 1257)
402(w32-add-charset-info "koi8-r" 'w32-charset-russian 20866)
403(w32-add-charset-info "iso8859-5" 'w32-charset-russian 28595)
18885c11 404(w32-add-charset-info "tis620-2533" 'w32-charset-thai 874)
57016d37
JR
405(w32-add-charset-info "windows-1258" 'w32-charset-vietnamese 1258)
406(w32-add-charset-info "ksc5601.1992" 'w32-charset-johab 1361)
7992f52c
JR
407(w32-add-charset-info "mac-roman" 'w32-charset-mac 10000)
408(w32-add-charset-info "iso10646-1" 'w32-charset-default t)
57016d37 409
2005121f
JR
410;; ;; If unicode windows charset is not defined, use ansi fonts.
411;; (w32-add-charset-info "iso10646-1" 'w32-charset-ansi t))
412
413;; Prefered names
414(w32-add-charset-info "big5-0" 'w32-charset-chinesebig5 950)
415(w32-add-charset-info "gb2312.1980-0" 'w32-charset-gb2312 936)
416(w32-add-charset-info "jisx0208-sjis" 'w32-charset-shiftjis 932)
417(w32-add-charset-info "ksc5601.1987-0" 'w32-charset-hangeul 949)
418(w32-add-charset-info "tis620-0" 'w32-charset-thai 874)
4c7ec703 419(w32-add-charset-info "iso8859-1" 'w32-charset-ansi 1252)
52f32671 420
47092217
JR
421(make-obsolete-variable 'w32-enable-italics
422 'w32-enable-synthesized-fonts "21.1")
d4b7d6b4 423(make-obsolete-variable 'w32-charset-to-codepage-alist
47092217 424 'w32-charset-info-alist "21.1")
d4b7d6b4 425
3b4cf5db
AI
426\f
427;;;; Selections and cut buffers
428
f2b256fa
SM
429;; We keep track of the last text selected here, so we can check the
430;; current selection against it, and avoid passing back our own text
431;; from x-cut-buffer-or-selection-value.
3b4cf5db
AI
432(defvar x-last-selected-text nil)
433
f2b256fa
SM
434;; It is said that overlarge strings are slow to put into the cut buffer.
435;; Note this value is overridden below.
3b4cf5db
AI
436(defvar x-cut-buffer-max 20000
437 "Max number of characters to put in the cut buffer.")
438
3b4cf5db 439(defun x-select-text (text &optional push)
3077d1f6
EZ
440 "Select TEXT, a string, according to the window system.
441
442On X, put TEXT in the primary X selection. For backward
443compatibility with older X applications, set the value of X cut
444buffer 0 as well, and if the optional argument PUSH is non-nil,
445rotate the cut buffers. If `x-select-enable-clipboard' is
446non-nil, copy the text to the X clipboard as well.
447
448On Windows, make TEXT the current selection. If
449`x-select-enable-clipboard' is non-nil, copy the text to the
450clipboard as well. The argument PUSH is ignored.
451
452On Nextstep, put TEXT in the pasteboard; PUSH is ignored."
3b4cf5db
AI
453 (if x-select-enable-clipboard
454 (w32-set-clipboard-data text))
455 (setq x-last-selected-text text))
bcaf1c36 456
3b4cf5db
AI
457(defun x-get-selection-value ()
458 "Return the value of the current selection.
459Consult the selection, then the cut buffer. Treat empty strings as if
460they were unset."
461 (if x-select-enable-clipboard
462 (let (text)
463 ;; Don't die if x-get-selection signals an error.
464 (condition-case c
465 (setq text (w32-get-clipboard-data))
466 (error (message "w32-get-clipboard-data:%s" c)))
467 (if (string= text "") (setq text nil))
468 (cond
469 ((not text) nil)
470 ((eq text x-last-selected-text) nil)
471 ((string= text x-last-selected-text)
472 ;; Record the newer string, so subsequent calls can use the 'eq' test.
473 (setq x-last-selected-text text)
474 nil)
475 (t
476 (setq x-last-selected-text text))))))
477\f
478(defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value)
479
f2b256fa 480;; Arrange for the kill and yank functions to set and check the clipboard.
3b4cf5db
AI
481(setq interprogram-cut-function 'x-select-text)
482(setq interprogram-paste-function 'x-get-selection-value)
483
3712a0b3
EZ
484\f
485;;;; Support for build process
486(defun w32-batch-update-autoloads ()
487 "Like `batch-update-autoloads', but takes the name of the autoloads file
488from the command line.
489
490This is required because some Windows build environments, such as MSYS,
491munge command-line arguments that include file names to a horrible mess
492that Emacs is unable to cope with."
493 (let ((generated-autoload-file
af9fb32f
GM
494 (expand-file-name (pop command-line-args-left)))
495 ;; I can only assume the same considerations may apply here...
496 (autoload-make-program (pop command-line-args-left)))
3712a0b3 497 (batch-update-autoloads)))
3b4cf5db 498
d1dcf3e7
EZ
499(defun w32-append-code-lines (orig extra)
500 "Append non-empty non-comment lines in the file EXTRA to the file ORIG.
501
502This function saves all buffers and kills the Emacs session, without asking
503for any permissions.
504
505This is required because the Windows build environment is not required
506to include Sed, which is used by leim/Makefile.in to do the job."
507 (find-file orig)
508 (goto-char (point-max))
509 (insert-file-contents extra)
510 (delete-matching-lines "^$\\|^;")
511 (save-buffers-kill-emacs t))
512
cbee283d 513;; arch-tag: c49b48cc-0f4f-454f-a274-c2dc34815e14
a0d14345 514;;; w32-fns.el ends here