annotate lisp/w32-fns.el @ 64909:777c4aaf636a

*** empty log message ***
author Lute Kamstra <lute@gnu.org>
date Thu, 11 Aug 2005 13:31:36 +0000
parents 41bb365f41c4
children 0028f546a4d3 2d92f5c9d6ae
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37621
diff changeset
1 ;;; w32-fns.el --- Lisp routines for Windows NT
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14121
diff changeset
2
64762
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64563
diff changeset
3 ;; Copyright (C) 1994, 2001, 2002, 2003, 2004,
41bb365f41c4 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64563
diff changeset
4 ;; 2005 Free Software Foundation, Inc.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
21059
cbd9e55a6cdc Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 19692
diff changeset
6 ;; Author: Geoff Voelker <voelker@cs.washington.edu>
39117
abd085bfec0c Add Keywords header.
Gerd Moellmann <gerd@gnu.org>
parents: 38436
diff changeset
7 ;; Keywords: internal
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14121
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 55865
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 55865
diff changeset
24 ;; Boston, MA 02110-1301, USA.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; (August 12, 1993)
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
29 ;; Created.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
31 ;; (November 21, 1994)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
32 ;; [C-M-backspace] defined.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
33 ;; mode-line-format defined to show buffer file type.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
34 ;; audio bell initialized.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;; Code:
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; Map delete and backspace
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (define-key function-key-map [backspace] "\177")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 (define-key function-key-map [delete] "\C-d")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 (define-key function-key-map [M-backspace] [?\M-\177])
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
42 (define-key function-key-map [C-M-backspace] [\C-\M-delete])
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
43
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; Ignore case on file-name completion
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 (setq completion-ignore-case t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
47 ;; Map all versions of a filename (8.3, longname, mixed case) to the
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
48 ;; same buffer.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
49 (setq find-file-visit-truename t)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
50
33212
5298b23b61be (w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents: 32716
diff changeset
51 (defun w32-version ()
5298b23b61be (w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents: 32716
diff changeset
52 "Return the MS-Windows version numbers.
5298b23b61be (w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents: 32716
diff changeset
53 The value is a list of three integers: the major and minor version
5298b23b61be (w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents: 32716
diff changeset
54 numbers, and the build number."
5298b23b61be (w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents: 32716
diff changeset
55 (x-server-version))
5298b23b61be (w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents: 32716
diff changeset
56
17549
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
57 (defun w32-using-nt ()
55792
0d890eccf70f (w32-using-nt, w32-shell-dos-semantics, set-w32-system-coding-system):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
58 "Return non-nil if running on a 32-bit Windows system.
0d890eccf70f (w32-using-nt, w32-shell-dos-semantics, set-w32-system-coding-system):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
59 That includes all Windows systems except for 9X/Me."
17549
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
60 (and (eq system-type 'windows-nt) (getenv "SystemRoot")))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
61
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
62 (defun w32-shell-name ()
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
63 "Return the name of the shell being used."
64563
3a895c8815ed (w32-shell-name): Use `bound-and-true-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64091
diff changeset
64 (or (bound-and-true-p explicit-shell-file-name)
17549
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
65 (getenv "ESHELL")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
66 (getenv "SHELL")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
67 (and (w32-using-nt) "cmd.exe")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
68 "command.com"))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
69
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
70 (defun w32-system-shell-p (shell-name)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
71 (and shell-name
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
72 (member (downcase (file-name-nondirectory shell-name))
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
73 w32-system-shells)))
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74
23173
073e555c28c8 (w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21597
diff changeset
75 (defun w32-shell-dos-semantics ()
55792
0d890eccf70f (w32-using-nt, w32-shell-dos-semantics, set-w32-system-coding-system):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
76 "Return non-nil if the interactive shell being used expects MSDOS shell semantics."
23173
073e555c28c8 (w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21597
diff changeset
77 (or (w32-system-shell-p (w32-shell-name))
073e555c28c8 (w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21597
diff changeset
78 (and (member (downcase (file-name-nondirectory (w32-shell-name)))
073e555c28c8 (w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21597
diff changeset
79 '("cmdproxy" "cmdproxy.exe"))
073e555c28c8 (w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21597
diff changeset
80 (w32-system-shell-p (getenv "COMSPEC")))))
073e555c28c8 (w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21597
diff changeset
81
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
82 (defun w32-check-shell-configuration ()
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
83 "Check the configuration of shell variables on Windows NT/9X.
17549
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
84 This function is invoked after loading the init files and processing
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
85 the command line arguments. It issues a warning if the user or site
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
86 has configured the shell with inappropriate settings."
21597
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
87 (interactive)
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
88 (let ((prev-buffer (current-buffer))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
89 (buffer (get-buffer-create "*Shell Configuration*"))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
90 (system-shell))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
91 (set-buffer buffer)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
92 (erase-buffer)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
93 (if (w32-system-shell-p (getenv "ESHELL"))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
94 (insert (format "Warning! The ESHELL environment variable uses %s.
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
95 You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
96 (getenv "ESHELL"))))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
97 (if (w32-system-shell-p (getenv "SHELL"))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
98 (insert (format "Warning! The SHELL environment variable uses %s.
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
99 You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
100 (getenv "SHELL"))))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
101 (if (w32-system-shell-p shell-file-name)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
102 (insert (format "Warning! shell-file-name uses %s.
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
103 You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
104 shell-file-name)))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
105 (if (and (boundp 'explicit-shell-file-name)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
106 (w32-system-shell-p explicit-shell-file-name))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
107 (insert (format "Warning! explicit-shell-file-name uses %s.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
108 You probably want to change it so that it uses cmdproxy.exe instead.\n\n"
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
109 explicit-shell-file-name)))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
110 (setq system-shell (> (buffer-size) 0))
21597
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
111
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
112 ;; Allow user to specify that they really do want to use one of the
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
113 ;; "system" shells, despite the drawbacks, but still warn if
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
114 ;; shell-command-switch doesn't match.
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
115 (if w32-allow-system-shell
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
116 (erase-buffer))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
117
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
118 (cond (system-shell
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
119 ;; System shells.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
120 (if (string-equal "-c" shell-command-switch)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
121 (insert "Warning! shell-command-switch is \"-c\".
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
122 You should set this to \"/c\" when using a system shell.\n\n"))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
123 (if w32-quote-process-args
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
124 (insert "Warning! w32-quote-process-args is t.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
125 You should set this to nil when using a system shell.\n\n")))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
126 ;; Non-system shells.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
127 (t
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
128 (if (string-equal "/c" shell-command-switch)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
129 (insert "Warning! shell-command-switch is \"/c\".
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
130 You should set this to \"-c\" when using a non-system shell.\n\n"))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
131 (if (not w32-quote-process-args)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
132 (insert "Warning! w32-quote-process-args is nil.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
133 You should set this to t when using a non-system shell.\n\n"))))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
134 (if (> (buffer-size) 0)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
135 (display-buffer buffer)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
136 (kill-buffer buffer))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
137 (set-buffer prev-buffer)))
17549
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
138
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
139 (add-hook 'after-init-hook 'w32-check-shell-configuration)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
140
24514
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
141 ;;; Override setting chosen at startup.
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
142 (defun set-default-process-coding-system ()
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
143 ;; Most programs on Windows will accept Unix line endings on input
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
144 ;; (and some programs ported from Unix require it) but most will
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
145 ;; produce DOS line endings on output.
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
146 (setq default-process-coding-system
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
147 (if default-enable-multibyte-characters
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
148 '(undecided-dos . undecided-unix)
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
149 '(raw-text-dos . raw-text-unix)))
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
150 (or (w32-using-nt)
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
151 ;; On Windows 9x, make cmdproxy default to using DOS line endings
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
152 ;; for input, because command.com requires this.
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
153 (setq process-coding-system-alist
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
154 `(("[cC][mM][dD][pP][rR][oO][xX][yY]"
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
155 . ,(if default-enable-multibyte-characters
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
156 '(undecided-dos . undecided-dos)
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
157 '(raw-text-dos . raw-text-dos)))))))
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
158
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
159 (add-hook 'before-init-hook 'set-default-process-coding-system)
06762ce530be (set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents: 24498
diff changeset
160
21597
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
161
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
162 ;;; Basic support functions for managing Emacs' locale setting
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
163
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
164 (defvar w32-valid-locales nil
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
165 "List of locale ids known to be supported.")
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
166
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
167 ;;; This is the brute-force version; an efficient version is now
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
168 ;;; built-in though.
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
169 (if (not (fboundp 'w32-get-valid-locale-ids))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
170 (defun w32-get-valid-locale-ids ()
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
171 "Return list of all valid Windows locale ids."
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
172 (let ((i 65535)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
173 locales)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
174 (while (> i 0)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
175 (if (w32-get-locale-info i)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
176 (setq locales (cons i locales)))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
177 (setq i (1- i)))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
178 locales)))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
179
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
180 (defun w32-list-locales ()
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
181 "List the name and id of all locales supported by Windows."
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
182 (interactive)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
183 (if (null w32-valid-locales)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
184 (setq w32-valid-locales (w32-get-valid-locale-ids)))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
185 (switch-to-buffer-other-window (get-buffer-create "*Supported Locales*"))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
186 (erase-buffer)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
187 (insert "LCID\tAbbrev\tFull name\n\n")
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
188 (insert (mapconcat
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
189 '(lambda (x)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
190 (format "%d\t%s\t%s"
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
191 x
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
192 (w32-get-locale-info x)
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
193 (w32-get-locale-info x t)))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
194 w32-valid-locales "\n"))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
195 (insert "\n")
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
196 (goto-char (point-min)))
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
197
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
198
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
199 ;;; Setup Info-default-directory-list to include the info directory
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
200 ;;; near where Emacs executable was installed. We used to set INFOPATH,
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
201 ;;; but when this is set Info-default-directory-list is ignored. We
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
202 ;;; also cannot rely upon what is set in paths.el because they assume
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
203 ;;; that configuration during build time is correct for runtime.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
204 (defun w32-init-info ()
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
205 (let* ((instdir (file-name-directory invocation-directory))
21597
409211e285bc (w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21059
diff changeset
206 (dir1 (expand-file-name "../info/" instdir))
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
207 (dir2 (expand-file-name "../../../info/" instdir)))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
208 (if (file-exists-p dir1)
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
209 (setq Info-default-directory-list
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
210 (append Info-default-directory-list (list dir1)))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
211 (if (file-exists-p dir2)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
212 (setq Info-default-directory-list
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
213 (append Info-default-directory-list (list dir2)))))))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
214
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
215 (add-hook 'before-init-hook 'w32-init-info)
15338
b0d95c32f026 (shell-mode-hook): Set comint-completion-addsuffix
Richard M. Stallman <rms@gnu.org>
parents: 15257
diff changeset
216
23571
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
217 ;;; The variable source-directory is used to initialize Info-directory-list.
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
218 ;;; However, the common case is that Emacs is being used from a binary
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
219 ;;; distribution, and the value of source-directory is meaningless in that
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
220 ;;; case. Even worse, source-directory can refer to a directory on a drive
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
221 ;;; on the build machine that happens to be a removable drive on the user's
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
222 ;;; machine. When this happens, Emacs tries to access the removable drive
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
223 ;;; and produces the abort/retry/ignore dialog. Since we do not use
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
224 ;;; source-directory, set it to something that is a reasonable approximation
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
225 ;;; on the user's machine.
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
226
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
227 ;(add-hook 'before-init-hook
31616
4c03111f81ac Comment out before-init-hook function which resets
Andrew Innes <andrewi@gnu.org>
parents: 30435
diff changeset
228 ; '(lambda ()
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
229 ; (setq source-directory (file-name-as-directory
31616
4c03111f81ac Comment out before-init-hook function which resets
Andrew Innes <andrewi@gnu.org>
parents: 30435
diff changeset
230 ; (expand-file-name ".." exec-directory)))))
23571
ae5eea3cc314 Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents: 23173
diff changeset
231
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
232 (defun convert-standard-filename (filename)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
233 "Convert a standard file's name to something suitable for the current OS.
55865
ccd8cdf69359 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents: 55792
diff changeset
234 This means to guarantee valid names and perhaps to canonicalize
ccd8cdf69359 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents: 55792
diff changeset
235 certain patterns.
ccd8cdf69359 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents: 55792
diff changeset
236
ccd8cdf69359 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents: 55792
diff changeset
237 On Windows and DOS, replace invalid characters. On DOS, make
ccd8cdf69359 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents: 55792
diff changeset
238 sure to obey the 8.3 limitations. On Windows, turn Cygwin names
ccd8cdf69359 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents: 55792
diff changeset
239 into native names, and also turn slashes into backslashes if the
ccd8cdf69359 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents: 55792
diff changeset
240 shell requires it (see `w32-shell-dos-semantics')."
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
241 (let ((name
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
242 (save-match-data
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
243 (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
244 (replace-match "\\1:/" t nil filename)
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
245 (copy-sequence filename))))
15135
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
246 (start 0))
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
247 ;; leave ':' if part of drive specifier
34996
271ffc04a20d (convert-standard-filename): Do length check on name
Andrew Innes <andrewi@gnu.org>
parents: 34369
diff changeset
248 (if (and (> (length name) 1)
271ffc04a20d (convert-standard-filename): Do length check on name
Andrew Innes <andrewi@gnu.org>
parents: 34369
diff changeset
249 (eq (aref name 1) ?:))
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
250 (setq start 2))
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
251 ;; destructively replace invalid filename characters with !
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
252 (while (string-match "[?*:<>|\"\000-\037]" name start)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
253 (aset name (match-beginning 0) ?!)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
254 (setq start (match-end 0)))
24441
6643d1ccd5a1 (convert-standard-filename): Convert directory
Andrew Innes <andrewi@gnu.org>
parents: 23571
diff changeset
255 ;; convert directory separators to Windows format
24661
a969304198eb (convert-standard-filename): Only convert directory
Andrew Innes <andrewi@gnu.org>
parents: 24514
diff changeset
256 ;; (but only if the shell in use requires it)
37621
fc0f7a044da4 (convert-standard-filename): Start replacing slashes
Eli Zaretskii <eliz@gnu.org>
parents: 34996
diff changeset
257 (when (w32-shell-dos-semantics)
fc0f7a044da4 (convert-standard-filename): Start replacing slashes
Eli Zaretskii <eliz@gnu.org>
parents: 34996
diff changeset
258 (setq start 0)
fc0f7a044da4 (convert-standard-filename): Start replacing slashes
Eli Zaretskii <eliz@gnu.org>
parents: 34996
diff changeset
259 (while (string-match "/" name start)
fc0f7a044da4 (convert-standard-filename): Start replacing slashes
Eli Zaretskii <eliz@gnu.org>
parents: 34996
diff changeset
260 (aset name (match-beginning 0) ?\\)
fc0f7a044da4 (convert-standard-filename): Start replacing slashes
Eli Zaretskii <eliz@gnu.org>
parents: 34996
diff changeset
261 (setq start (match-end 0))))
fc0f7a044da4 (convert-standard-filename): Start replacing slashes
Eli Zaretskii <eliz@gnu.org>
parents: 34996
diff changeset
262 name))
15135
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
263
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 ;;; Fix interface to (X-specific) mouse.el
15350
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
265 (defun x-set-selection (type data)
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
266 (or type (setq type 'PRIMARY))
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
267 (put 'x-selections type data))
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
268
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
269 (defun x-get-selection (&optional type data-type)
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
270 (or type (setq type 'PRIMARY))
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
271 (get 'x-selections type))
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
272
24498
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
273 (defun set-w32-system-coding-system (coding-system)
55792
0d890eccf70f (w32-using-nt, w32-shell-dos-semantics, set-w32-system-coding-system):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
274 "Set the coding system used by the Windows system to CODING-SYSTEM.
24498
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
275 This is used for things like passing font names with non-ASCII
64563
3a895c8815ed (w32-shell-name): Use `bound-and-true-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64091
diff changeset
276 characters in them to the system. For a list of possible values of
41325
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
277 CODING-SYSTEM, use \\[list-coding-systems].
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
278
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
279 This function is provided for backward compatibility, since
55792
0d890eccf70f (w32-using-nt, w32-shell-dos-semantics, set-w32-system-coding-system):
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
280 `w32-system-coding-system' is now an alias for `locale-coding-system'."
24498
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
281 (interactive
41325
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
282 (list (let ((default locale-coding-system))
24498
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
283 (read-coding-system
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
284 (format "Coding system for system calls (default, %s): "
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
285 default)
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
286 default))))
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
287 (check-coding-system coding-system)
41325
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
288 (setq locale-coding-system coding-system))
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
289
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
290 ;; locale-coding-system was introduced to do the same thing as
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
291 ;; w32-system-coding-system. Use that instead.
65bad70edb17 (w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents: 40458
diff changeset
292 (defvaralias 'w32-system-coding-system 'locale-coding-system)
24498
756058742361 (set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24441
diff changeset
293
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
294 ;;; Set to a system sound if you want a fancy bell.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
295 (set-message-beep nil)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
296
19692
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
297 ;;; The "Windows" keys on newer keyboards bring up the Start menu
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
298 ;;; whether you want it or not - make Emacs ignore these keystrokes
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
299 ;;; rather than beep.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
300 (global-set-key [lwindow] 'ignore)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
301 (global-set-key [rwindow] 'ignore)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
302
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
303 ;; Map certain keypad keys into ASCII characters
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
304 ;; that people usually expect.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
305 (define-key function-key-map [tab] [?\t])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
306 (define-key function-key-map [linefeed] [?\n])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
307 (define-key function-key-map [clear] [11])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
308 (define-key function-key-map [return] [13])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
309 (define-key function-key-map [escape] [?\e])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
310 (define-key function-key-map [M-tab] [?\M-\t])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
311 (define-key function-key-map [M-linefeed] [?\M-\n])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
312 (define-key function-key-map [M-clear] [?\M-\013])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
313 (define-key function-key-map [M-return] [?\M-\015])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
314 (define-key function-key-map [M-escape] [?\M-\e])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
315
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
316 ;; These don't do the right thing (voelker)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
317 ;(define-key function-key-map [backspace] [127])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
318 ;(define-key function-key-map [delete] [127])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
319 ;(define-key function-key-map [M-backspace] [?\M-\d])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
320 ;(define-key function-key-map [M-delete] [?\M-\d])
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
321
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
322 ;; These tell read-char how to convert
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
323 ;; these special chars to ASCII.
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
324 (put 'tab 'ascii-character ?\t)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
325 (put 'linefeed 'ascii-character ?\n)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
326 (put 'clear 'ascii-character 12)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
327 (put 'return 'ascii-character 13)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
328 (put 'escape 'ascii-character ?\e)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
329 (put 'backspace 'ascii-character 127)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
330 (put 'delete 'ascii-character 127)
4b8ff0021dcb Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents: 17549
diff changeset
331
27521
719f644e7cec Define w32-tty-standard-colors.
Jason Rumney <jasonr@gnu.org>
parents: 24661
diff changeset
332 ;; W32 uses different color indexes than standard:
719f644e7cec Define w32-tty-standard-colors.
Jason Rumney <jasonr@gnu.org>
parents: 24661
diff changeset
333
719f644e7cec Define w32-tty-standard-colors.
Jason Rumney <jasonr@gnu.org>
parents: 24661
diff changeset
334 (defvar w32-tty-standard-colors
42950
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
335 '(("black" 0 0 0 0)
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
336 ("blue" 1 0 0 52480) ; MediumBlue
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
337 ("green" 2 8704 35584 8704) ; ForestGreen
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
338 ("cyan" 3 0 52736 53504) ; DarkTurquoise
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
339 ("red" 4 45568 8704 8704) ; FireBrick
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
340 ("magenta" 5 35584 0 35584) ; DarkMagenta
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
341 ("brown" 6 40960 20992 11520) ; Sienna
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
342 ("lightgray" 7 48640 48640 48640) ; Gray
27521
719f644e7cec Define w32-tty-standard-colors.
Jason Rumney <jasonr@gnu.org>
parents: 24661
diff changeset
343 ("darkgray" 8 26112 26112 26112) ; Gray40
42950
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
344 ("lightblue" 9 0 0 65535) ; Blue
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
345 ("lightgreen" 10 0 65535 0) ; Green
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
346 ("lightcyan" 11 0 65535 65535) ; Cyan
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
347 ("lightred" 12 65535 0 0) ; Red
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
348 ("lightmagenta" 13 65535 0 65535) ; Magenta
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
349 ("yellow" 14 65535 65535 0) ; Yellow
65a061ec7803 (w32-tty-standard-colors): Reverse the order of standard console colors.
Eli Zaretskii <eliz@gnu.org>
parents: 42847
diff changeset
350 ("white" 15 65535 65535 65535))
27521
719f644e7cec Define w32-tty-standard-colors.
Jason Rumney <jasonr@gnu.org>
parents: 24661
diff changeset
351 "A list of VGA console colors, their indices and 16-bit RGB values.")
719f644e7cec Define w32-tty-standard-colors.
Jason Rumney <jasonr@gnu.org>
parents: 24661
diff changeset
352
33385
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
353
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
354 (defun w32-add-charset-info (xlfd-charset windows-charset codepage)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
355 "Function to add character sets to display with Windows fonts.
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
356 Creates entries in `w32-charset-info-alist'.
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
357 XLFD-CHARSET is a string which will appear in the XLFD font name to
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
358 identify the character set. WINDOWS-CHARSET is a symbol identifying
64563
3a895c8815ed (w32-shell-name): Use `bound-and-true-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64091
diff changeset
359 the Windows character set this maps to. For the list of possible
3a895c8815ed (w32-shell-name): Use `bound-and-true-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64091
diff changeset
360 values, see the documentation for `w32-charset-info-alist'. CODEPAGE
33385
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
361 can be a numeric codepage that Windows uses to display the character
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
362 set, t for Unicode output with no codepage translation or nil for 8
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
363 bit output with no translation."
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
364 (add-to-list 'w32-charset-info-alist
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
365 (cons xlfd-charset (cons windows-charset codepage)))
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
366 )
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
367
45814
8e79905a56dd (w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents: 43756
diff changeset
368 ;; The last charset we add becomes the "preferred" charset for the return
8e79905a56dd (w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents: 43756
diff changeset
369 ;; value from w32-select-font etc, so list the most important charsets last.
33385
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
370 (w32-add-charset-info "iso8859-14" 'w32-charset-ansi 28604)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
371 (w32-add-charset-info "iso8859-15" 'w32-charset-ansi 28605)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
372 (w32-add-charset-info "jisx0201-latin" 'w32-charset-shiftjis 932)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
373 (w32-add-charset-info "jisx0201-katakana" 'w32-charset-shiftjis 932)
45814
8e79905a56dd (w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents: 43756
diff changeset
374 (w32-add-charset-info "jisx0208-sjis" 'w32-charset-shiftjis 932)
33385
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
375 (w32-add-charset-info "ksc5601.1987" 'w32-charset-hangeul 949)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
376 (w32-add-charset-info "big5" 'w32-charset-chinesebig5 950)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
377 (w32-add-charset-info "gb2312" 'w32-charset-gb2312 936)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
378 (w32-add-charset-info "ms-symbol" 'w32-charset-symbol nil)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
379 (w32-add-charset-info "ms-oem" 'w32-charset-oem 437)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
380 (w32-add-charset-info "ms-oemlatin" 'w32-charset-oem 850)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
381 (if (boundp 'w32-extra-charsets-defined)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
382 (progn
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
383 (w32-add-charset-info "iso8859-2" 'w32-charset-easteurope 28592)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
384 (w32-add-charset-info "iso8859-3" 'w32-charset-turkish 28593)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
385 (w32-add-charset-info "iso8859-4" 'w32-charset-baltic 28594)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
386 (w32-add-charset-info "iso8859-6" 'w32-charset-arabic 28596)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
387 (w32-add-charset-info "iso8859-7" 'w32-charset-greek 28597)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
388 (w32-add-charset-info "iso8859-8" 'w32-charset-hebrew 1255)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
389 (w32-add-charset-info "iso8859-9" 'w32-charset-turkish 1254)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
390 (w32-add-charset-info "iso8859-13" 'w32-charset-baltic 1257)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
391 (w32-add-charset-info "koi8-r" 'w32-charset-russian 20866)
45814
8e79905a56dd (w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents: 43756
diff changeset
392 (w32-add-charset-info "iso8859-5" 'w32-charset-russian 28595)
33385
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
393 (w32-add-charset-info "tis620" 'w32-charset-thai 874)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
394 (w32-add-charset-info "ksc5601.1992" 'w32-charset-johab 1361)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
395 (w32-add-charset-info "mac" 'w32-charset-mac nil)))
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
396 (if (boundp 'w32-unicode-charset-defined)
262bed8a9ecf (w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents: 33212
diff changeset
397 (progn
45814
8e79905a56dd (w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents: 43756
diff changeset
398 (w32-add-charset-info "unicode" 'w32-charset-unicode t)
8e79905a56dd (w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents: 43756
diff changeset
399 (w32-add-charset-info "iso10646-1" 'w32-charset-unicode t))
40345
1f8fda3ed895 Use ANSI fonts for iso10646-1 if UNICODE is not defined in system headers.
Jason Rumney <jasonr@gnu.org>
parents: 39117
diff changeset
400 ;; If unicode windows charset is not defined, use ansi fonts.
1f8fda3ed895 Use ANSI fonts for iso10646-1 if UNICODE is not defined in system headers.
Jason Rumney <jasonr@gnu.org>
parents: 39117
diff changeset
401 (w32-add-charset-info "iso10646-1" 'w32-charset-ansi t))
45814
8e79905a56dd (w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents: 43756
diff changeset
402 (w32-add-charset-info "iso8859-1" 'w32-charset-ansi 1252)
28273
454890f5952d (w32-charset-info-alist): Initialize.
Jason Rumney <jasonr@gnu.org>
parents: 27521
diff changeset
403
33885
fd77fd05cecb add version to obsolete variables.
Jason Rumney <jasonr@gnu.org>
parents: 33385
diff changeset
404 (make-obsolete-variable 'w32-enable-italics
fd77fd05cecb add version to obsolete variables.
Jason Rumney <jasonr@gnu.org>
parents: 33385
diff changeset
405 'w32-enable-synthesized-fonts "21.1")
30237
c470ffbc2a4a (w32-enable-italics, w32-charset-to-codepage-alist): Declare as obsolete.
Jason Rumney <jasonr@gnu.org>
parents: 29323
diff changeset
406 (make-obsolete-variable 'w32-charset-to-codepage-alist
33885
fd77fd05cecb add version to obsolete variables.
Jason Rumney <jasonr@gnu.org>
parents: 33385
diff changeset
407 'w32-charset-info-alist "21.1")
30237
c470ffbc2a4a (w32-enable-italics, w32-charset-to-codepage-alist): Declare as obsolete.
Jason Rumney <jasonr@gnu.org>
parents: 29323
diff changeset
408
34369
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
409
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
410 ;;;; Selections and cut buffers
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
411
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
412 ;;; We keep track of the last text selected here, so we can check the
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
413 ;;; current selection against it, and avoid passing back our own text
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
414 ;;; from x-cut-buffer-or-selection-value.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
415 (defvar x-last-selected-text nil)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
416
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
417 ;;; It is said that overlarge strings are slow to put into the cut buffer.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
418 ;;; Note this value is overridden below.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
419 (defvar x-cut-buffer-max 20000
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
420 "Max number of characters to put in the cut buffer.")
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
421
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
422 (defun x-select-text (text &optional push)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
423 "Make TEXT the last selected text.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
424 If `x-select-enable-clipboard' is non-nil, copy the text to the system
64563
3a895c8815ed (w32-shell-name): Use `bound-and-true-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 64091
diff changeset
425 clipboard as well. Optional PUSH is ignored on Windows."
34369
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
426 (if x-select-enable-clipboard
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
427 (w32-set-clipboard-data text))
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
428 (setq x-last-selected-text text))
40458
de4e98791121 (convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents: 40345
diff changeset
429
34369
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
430 (defun x-get-selection-value ()
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
431 "Return the value of the current selection.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
432 Consult the selection, then the cut buffer. Treat empty strings as if
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
433 they were unset."
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
434 (if x-select-enable-clipboard
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
435 (let (text)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
436 ;; Don't die if x-get-selection signals an error.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
437 (condition-case c
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
438 (setq text (w32-get-clipboard-data))
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
439 (error (message "w32-get-clipboard-data:%s" c)))
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
440 (if (string= text "") (setq text nil))
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
441 (cond
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
442 ((not text) nil)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
443 ((eq text x-last-selected-text) nil)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
444 ((string= text x-last-selected-text)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
445 ;; Record the newer string, so subsequent calls can use the 'eq' test.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
446 (setq x-last-selected-text text)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
447 nil)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
448 (t
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
449 (setq x-last-selected-text text))))))
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
450
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
451 (defalias 'x-cut-buffer-or-selection-value 'x-get-selection-value)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
452
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
453 ;;; Arrange for the kill and yank functions to set and check the clipboard.
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
454 (setq interprogram-cut-function 'x-select-text)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
455 (setq interprogram-paste-function 'x-get-selection-value)
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
456
b5cb05f23e04 Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents: 33885
diff changeset
457
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 45814
diff changeset
458 ;;; arch-tag: c49b48cc-0f4f-454f-a274-c2dc34815e14
16592
a5e9fa379097 Use new file name w32-fns.el
Geoff Voelker <voelker@cs.washington.edu>
parents: 16028
diff changeset
459 ;;; w32-fns.el ends here