;;; w32-fns.el --- Lisp routines for Windows NT
-;; Copyright (C) 1994, 2001, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: Geoff Voelker <voelker@cs.washington.edu>
;; Keywords: internal
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; audio bell initialized.
;;; Code:
+(require 'w32-vars)
+
+(defvar explicit-shell-file-name)
;; Map delete and backspace
(define-key function-key-map [backspace] "\177")
(defun w32-shell-name ()
"Return the name of the shell being used."
- (or (and (boundp 'explicit-shell-file-name) explicit-shell-file-name)
+ (or (bound-and-true-p explicit-shell-file-name)
(getenv "ESHELL")
(getenv "SHELL")
(and (w32-using-nt) "cmd.exe")
'("cmdproxy" "cmdproxy.exe"))
(w32-system-shell-p (getenv "COMSPEC")))))
+(defvar w32-quote-process-args) ;; defined in w32proc.c
+
(defun w32-check-shell-configuration ()
"Check the configuration of shell variables on Windows NT/9X.
This function is invoked after loading the init files and processing
(if default-enable-multibyte-characters
'(undecided-dos . undecided-unix)
'(raw-text-dos . raw-text-unix)))
- (or (w32-using-nt)
- ;; On Windows 9x, make cmdproxy default to using DOS line endings
- ;; for input, because command.com requires this.
- (setq process-coding-system-alist
- `(("[cC][mM][dD][pP][rR][oO][xX][yY]"
- . ,(if default-enable-multibyte-characters
- '(undecided-dos . undecided-dos)
- '(raw-text-dos . raw-text-dos)))))))
+ ;; Make cmdproxy default to using DOS line endings for input,
+ ;; because some Windows programs (including command.com) require it.
+ (add-to-list 'process-coding-system-alist
+ `("[cC][mM][dD][pP][rR][oO][xX][yY]"
+ . ,(if default-enable-multibyte-characters
+ '(undecided-dos . undecided-dos)
+ '(raw-text-dos . raw-text-dos))))
+ ;; plink needs DOS input when entering the password.
+ (add-to-list 'process-coding-system-alist
+ `("[pP][lL][iI][nN][kK]"
+ . ,(if default-enable-multibyte-characters
+ '(undecided-dos . undecided-dos)
+ '(raw-text-dos . raw-text-dos)))))
(add-hook 'before-init-hook 'set-default-process-coding-system)
sure to obey the 8.3 limitations. On Windows, turn Cygwin names
into native names, and also turn slashes into backslashes if the
shell requires it (see `w32-shell-dos-semantics')."
- (let ((name
- (save-match-data
- (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)
+ (save-match-data
+ (let ((name
+ (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)
(replace-match "\\1:/" t nil filename)
- (copy-sequence filename))))
- (start 0))
- ;; leave ':' if part of drive specifier
- (if (and (> (length name) 1)
- (eq (aref name 1) ?:))
- (setq start 2))
- ;; destructively replace invalid filename characters with !
- (while (string-match "[?*:<>|\"\000-\037]" name start)
- (aset name (match-beginning 0) ?!)
- (setq start (match-end 0)))
- ;; convert directory separators to Windows format
- ;; (but only if the shell in use requires it)
- (when (w32-shell-dos-semantics)
- (setq start 0)
- (while (string-match "/" name start)
- (aset name (match-beginning 0) ?\\)
- (setq start (match-end 0))))
- name))
+ (copy-sequence filename)))
+ (start 0))
+ ;; leave ':' if part of drive specifier
+ (if (and (> (length name) 1)
+ (eq (aref name 1) ?:))
+ (setq start 2))
+ ;; destructively replace invalid filename characters with !
+ (while (string-match "[?*:<>|\"\000-\037]" name start)
+ (aset name (match-beginning 0) ?!)
+ (setq start (match-end 0)))
+ ;; convert directory separators to Windows format
+ ;; (but only if the shell in use requires it)
+ (when (w32-shell-dos-semantics)
+ (setq start 0)
+ (while (string-match "/" name start)
+ (aset name (match-beginning 0) ?\\)
+ (setq start (match-end 0))))
+ name)))
;;; Fix interface to (X-specific) mouse.el
(defun x-set-selection (type data)
(defun set-w32-system-coding-system (coding-system)
"Set the coding system used by the Windows system to CODING-SYSTEM.
This is used for things like passing font names with non-ASCII
-characters in them to the system. For a list of possible values of
+characters in them to the system. For a list of possible values of
CODING-SYSTEM, use \\[list-coding-systems].
This function is provided for backward compatibility, since
(interactive
(list (let ((default locale-coding-system))
(read-coding-system
- (format "Coding system for system calls (default, %s): "
+ (format "Coding system for system calls (default %s): "
default)
default))))
(check-coding-system coding-system)
Creates entries in `w32-charset-info-alist'.
XLFD-CHARSET is a string which will appear in the XLFD font name to
identify the character set. WINDOWS-CHARSET is a symbol identifying
-the Windows character set this maps to. For the list of possible
-values, see the documentation for `w32-charset-info-alist'. CODEPAGE
+the Windows character set this maps to. For the list of possible
+values, see the documentation for `w32-charset-info-alist'. CODEPAGE
can be a numeric codepage that Windows uses to display the character
set, t for Unicode output with no codepage translation or nil for 8
bit output with no translation."
(w32-add-charset-info "jisx0201-latin" 'w32-charset-shiftjis 932)
(w32-add-charset-info "jisx0201-katakana" 'w32-charset-shiftjis 932)
(w32-add-charset-info "jisx0208-sjis" 'w32-charset-shiftjis 932)
-(w32-add-charset-info "ksc5601.1987" 'w32-charset-hangeul 949)
-(w32-add-charset-info "big5" 'w32-charset-chinesebig5 950)
-(w32-add-charset-info "gb2312" 'w32-charset-gb2312 936)
+(w32-add-charset-info "ksc5601.1989-1" 'w32-charset-hangeul 949)
+(w32-add-charset-info "big5-1" 'w32-charset-chinesebig5 950)
+(w32-add-charset-info "gb2312.1980-1" 'w32-charset-gb2312 936)
(w32-add-charset-info "ms-symbol" 'w32-charset-symbol nil)
(w32-add-charset-info "ms-oem" 'w32-charset-oem 437)
(w32-add-charset-info "ms-oemlatin" 'w32-charset-oem 850)
(w32-add-charset-info "iso8859-13" 'w32-charset-baltic 1257)
(w32-add-charset-info "koi8-r" 'w32-charset-russian 20866)
(w32-add-charset-info "iso8859-5" 'w32-charset-russian 28595)
- (w32-add-charset-info "tis620" 'w32-charset-thai 874)
- (w32-add-charset-info "ksc5601.1992" 'w32-charset-johab 1361)
- (w32-add-charset-info "mac" 'w32-charset-mac nil)))
+ (w32-add-charset-info "tis620-1" 'w32-charset-thai 874)
+ (w32-add-charset-info "ksc5601.1992-1" 'w32-charset-johab 1361)
+ (w32-add-charset-info "mac-latin" 'w32-charset-mac nil)))
(if (boundp 'w32-unicode-charset-defined)
(progn
- (w32-add-charset-info "unicode" 'w32-charset-unicode t)
(w32-add-charset-info "iso10646-1" 'w32-charset-unicode t))
;; If unicode windows charset is not defined, use ansi fonts.
(w32-add-charset-info "iso10646-1" 'w32-charset-ansi t))
(defun x-select-text (text &optional push)
"Make TEXT the last selected text.
If `x-select-enable-clipboard' is non-nil, copy the text to the system
-clipboard as well. Optional PUSH is ignored on Windows."
+clipboard as well. Optional PUSH is ignored on Windows."
(if x-select-enable-clipboard
(w32-set-clipboard-data text))
(setq x-last-selected-text text))
(setq interprogram-cut-function 'x-select-text)
(setq interprogram-paste-function 'x-get-selection-value)
+\f
+;;;; Support for build process
+(defun w32-batch-update-autoloads ()
+ "Like `batch-update-autoloads', but takes the name of the autoloads file
+from the command line.
+
+This is required because some Windows build environments, such as MSYS,
+munge command-line arguments that include file names to a horrible mess
+that Emacs is unable to cope with."
+ (let ((generated-autoload-file
+ (expand-file-name (pop command-line-args-left))))
+ (batch-update-autoloads)))
+
+(defun w32-append-code-lines (orig extra)
+ "Append non-empty non-comment lines in the file EXTRA to the file ORIG.
+
+This function saves all buffers and kills the Emacs session, without asking
+for any permissions.
+
+This is required because the Windows build environment is not required
+to include Sed, which is used by leim/Makefile.in to do the job."
+ (find-file orig)
+ (goto-char (point-max))
+ (insert-file-contents extra)
+ (delete-matching-lines "^$\\|^;")
+ (save-buffers-kill-emacs t))
;;; arch-tag: c49b48cc-0f4f-454f-a274-c2dc34815e14
;;; w32-fns.el ends here