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