Mercurial > emacs
annotate lisp/w32-fns.el @ 105284:1c6153d17f64
Add 2009 to copyright years.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Tue, 29 Sep 2009 07:14:01 +0000 |
parents | b520d55cdd72 |
children | f937670ddf40 |
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 | 2 |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
104706
diff
changeset
|
3 ;; Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
104706
diff
changeset
|
4 ;; 2009 Free Software Foundation, Inc. |
9803 | 5 |
21059 | 6 ;; Author: Geoff Voelker <voelker@cs.washington.edu> |
39117 | 7 ;; Keywords: internal |
9803 | 8 |
9 ;; This file is part of GNU Emacs. | |
10 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94505
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
9803 | 12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94505
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94505
diff
changeset
|
14 ;; (at your option) any later version. |
9803 | 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 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94505
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
9803 | 23 |
24 ;;; Commentary: | |
25 | |
26 | |
27 ;;; Code: | |
85503
59ee4068f60b
* progmodes/gud.el (gud-target-name): Move definition before use.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
28 (require 'w32-vars) |
9803 | 29 |
65298
0028f546a4d3
(explicit-shell-file-name): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64762
diff
changeset
|
30 (defvar explicit-shell-file-name) |
0028f546a4d3
(explicit-shell-file-name): Add defvar.
Juanma Barranquero <lekktu@gmail.com>
parents:
64762
diff
changeset
|
31 |
86268
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
32 ;;;; Function keys |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
33 |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
34 (defvar x-alternatives-map |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
35 (let ((map (make-sparse-keymap))) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
36 ;; Map certain keypad keys into ASCII characters that people usually expect. |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
37 (define-key map [M-backspace] [?\M-\d]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
38 (define-key map [M-delete] [?\M-\d]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
39 (define-key map [M-tab] [?\M-\t]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
40 (define-key map [M-linefeed] [?\M-\n]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
41 (define-key map [M-clear] [?\M-\C-l]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
42 (define-key map [M-return] [?\M-\C-m]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
43 (define-key map [M-escape] [?\M-\e]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
44 (define-key map [iso-lefttab] [backtab]) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
45 (define-key map [S-iso-lefttab] [backtab]) |
93085
d3840ccbe2f6
(x-alternatives-map): Add S-tab mapping.
Jason Rumney <jasonr@gnu.org>
parents:
91373
diff
changeset
|
46 (define-key map [S-tab] [backtab]) |
86268
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
47 map) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
48 "Keymap of possible alternative meanings for some keys.") |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
49 |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
50 (defun x-setup-function-keys (frame) |
104066 | 51 "Set up `function-key-map' on the graphical frame FRAME." |
86268
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
52 ;; Don't do this twice on the same display, or it would break |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
53 ;; normal-erase-is-backspace-mode. |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
54 (unless (terminal-parameter frame 'x-setup-function-keys) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
55 ;; Map certain keypad keys into ASCII characters that people usually expect. |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
56 (with-selected-frame frame |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
57 (let ((map (copy-keymap x-alternatives-map))) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
58 (set-keymap-parent map (keymap-parent local-function-key-map)) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
59 (set-keymap-parent local-function-key-map map))) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
60 (set-terminal-parameter frame 'x-setup-function-keys t))) |
f1604b3ab5ad
(x-alternatives-map): Copy from term/x-win.el.
Jason Rumney <jasonr@gnu.org>
parents:
86265
diff
changeset
|
61 |
86289
8a7ed478f7bc
* international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86280
diff
changeset
|
62 (declare-function set-message-beep "w32console.c") |
8a7ed478f7bc
* international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86280
diff
changeset
|
63 (declare-function w32-get-clipboard-data "w32select.c") |
8a7ed478f7bc
* international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86280
diff
changeset
|
64 (declare-function w32-get-locale-info "w32proc.c") |
8a7ed478f7bc
* international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86280
diff
changeset
|
65 (declare-function w32-get-valid-locale-ids "w32proc.c") |
8a7ed478f7bc
* international/titdic-cnv.el (dos-8+3-filename):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86280
diff
changeset
|
66 (declare-function w32-set-clipboard-data "w32select.c") |
11399 | 67 |
40458
de4e98791121
(convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents:
40345
diff
changeset
|
68 ;; 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
|
69 ;; same buffer. |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
70 (setq find-file-visit-truename t) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
71 |
95841
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
72 (declare-function x-server-version "w32fns.c" (&optional display)) |
b4e36ff621b3
Add some compiler declarations, for builds without X.
Glenn Morris <rgm@gnu.org>
parents:
94678
diff
changeset
|
73 |
33212
5298b23b61be
(w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents:
32716
diff
changeset
|
74 (defun w32-version () |
5298b23b61be
(w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents:
32716
diff
changeset
|
75 "Return the MS-Windows version numbers. |
5298b23b61be
(w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents:
32716
diff
changeset
|
76 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
|
77 numbers, and the build number." |
5298b23b61be
(w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents:
32716
diff
changeset
|
78 (x-server-version)) |
5298b23b61be
(w32-version): New function.
Andrew Innes <andrewi@gnu.org>
parents:
32716
diff
changeset
|
79 |
17549
f57de209f01b
(w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents:
16859
diff
changeset
|
80 (defun w32-using-nt () |
90935 | 81 "Return non-nil if running on a Windows NT descendant. |
55792
0d890eccf70f
(w32-using-nt, w32-shell-dos-semantics, set-w32-system-coding-system):
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
82 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
|
83 (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
|
84 |
f57de209f01b
(w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents:
16859
diff
changeset
|
85 (defun w32-shell-name () |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
86 "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
|
87 (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
|
88 (getenv "ESHELL") |
f57de209f01b
(w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents:
16859
diff
changeset
|
89 (getenv "SHELL") |
f57de209f01b
(w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents:
16859
diff
changeset
|
90 (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
|
91 "command.com")) |
f57de209f01b
(w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents:
16859
diff
changeset
|
92 |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
93 (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
|
94 (and shell-name |
40458
de4e98791121
(convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents:
40345
diff
changeset
|
95 (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
|
96 w32-system-shells))) |
9803 | 97 |
23173
073e555c28c8
(w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21597
diff
changeset
|
98 (defun w32-shell-dos-semantics () |
99540
c5c8f07bc47c
* w32-fns.el (w32-shell-dos-semantics):
Juanma Barranquero <lekktu@gmail.com>
parents:
98791
diff
changeset
|
99 "Return non-nil if the interactive shell being used expects MS-DOS shell semantics." |
23173
073e555c28c8
(w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21597
diff
changeset
|
100 (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
|
101 (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
|
102 '("cmdproxy" "cmdproxy.exe")) |
073e555c28c8
(w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21597
diff
changeset
|
103 (w32-system-shell-p (getenv "COMSPEC"))))) |
073e555c28c8
(w32-shell-dos-semantics): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21597
diff
changeset
|
104 |
85512
589532be95ec
* w32-fns.el (w32-quote-process-args):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85503
diff
changeset
|
105 (defvar w32-quote-process-args) ;; defined in w32proc.c |
589532be95ec
* w32-fns.el (w32-quote-process-args):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85503
diff
changeset
|
106 |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
107 (defun w32-check-shell-configuration () |
98778
0f8ccfd21a74
* w32-fns.el (w32-check-shell-configuration): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
97221
diff
changeset
|
108 "Check the configuration of shell variables on Windows. |
17549
f57de209f01b
(w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents:
16859
diff
changeset
|
109 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
|
110 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
|
111 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
|
112 (interactive) |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
113 (let ((prev-buffer (current-buffer)) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
114 (buffer (get-buffer-create "*Shell Configuration*")) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
115 (system-shell)) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
116 (set-buffer buffer) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
117 (erase-buffer) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
118 (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
|
119 (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
|
120 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
|
121 (getenv "ESHELL")))) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
122 (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
|
123 (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
|
124 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
|
125 (getenv "SHELL")))) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
126 (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
|
127 (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
|
128 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
|
129 shell-file-name))) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
130 (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
|
131 (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
|
132 (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
|
133 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
|
134 explicit-shell-file-name))) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
135 (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
|
136 |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
137 ;; 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
|
138 ;; "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
|
139 ;; shell-command-switch doesn't match. |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
140 (if w32-allow-system-shell |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
141 (erase-buffer)) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
142 |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
143 (cond (system-shell |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
144 ;; System shells. |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
145 (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
|
146 (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
|
147 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
|
148 (if w32-quote-process-args |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
149 (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
|
150 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
|
151 ;; Non-system shells. |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
152 (t |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
153 (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
|
154 (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
|
155 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
|
156 (if (not w32-quote-process-args) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
157 (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
|
158 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
|
159 (if (> (buffer-size) 0) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
160 (display-buffer buffer) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
161 (kill-buffer buffer)) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
162 (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
|
163 |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
164 (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
|
165 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
166 ;; Override setting chosen at startup. |
24514
06762ce530be
(set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents:
24498
diff
changeset
|
167 (defun set-default-process-coding-system () |
06762ce530be
(set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents:
24498
diff
changeset
|
168 ;; 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
|
169 ;; (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
|
170 ;; produce DOS line endings on output. |
06762ce530be
(set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents:
24498
diff
changeset
|
171 (setq default-process-coding-system |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
104706
diff
changeset
|
172 (if (default-value 'enable-multibyte-characters) |
24514
06762ce530be
(set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents:
24498
diff
changeset
|
173 '(undecided-dos . undecided-unix) |
06762ce530be
(set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents:
24498
diff
changeset
|
174 '(raw-text-dos . raw-text-unix))) |
78192
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
175 ;; Make cmdproxy default to using DOS line endings for input, |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
176 ;; because some Windows programs (including command.com) require it. |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
177 (add-to-list 'process-coding-system-alist |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
178 `("[cC][mM][dD][pP][rR][oO][xX][yY]" |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
104706
diff
changeset
|
179 . ,(if (default-value 'enable-multibyte-characters) |
78192
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
180 '(undecided-dos . undecided-dos) |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
181 '(raw-text-dos . raw-text-dos)))) |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
182 ;; plink needs DOS input when entering the password. |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
183 (add-to-list 'process-coding-system-alist |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
184 `("[pP][lL][iI][nN][kK]" |
104823
68150c643e2e
Use default-value rather than default-enable-multibyte-characters.
Glenn Morris <rgm@gnu.org>
parents:
104706
diff
changeset
|
185 . ,(if (default-value 'enable-multibyte-characters) |
78192
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
186 '(undecided-dos . undecided-dos) |
19db593f63bb
(set-default-process-coding-system): Use dos line ends
Jason Rumney <jasonr@gnu.org>
parents:
75347
diff
changeset
|
187 '(raw-text-dos . raw-text-dos))))) |
24514
06762ce530be
(set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents:
24498
diff
changeset
|
188 |
06762ce530be
(set-default-process-coding-system): Copied from
Andrew Innes <andrewi@gnu.org>
parents:
24498
diff
changeset
|
189 (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
|
190 |
21597
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
191 |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
192 ;;; 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
|
193 |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
194 (defvar w32-valid-locales nil |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
195 "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
|
196 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
197 ;; This is the brute-force version; an efficient version is now |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
198 ;; built-in though. |
21597
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
199 (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
|
200 (defun w32-get-valid-locale-ids () |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
201 "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
|
202 (let ((i 65535) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
203 locales) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
204 (while (> i 0) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
205 (if (w32-get-locale-info i) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
206 (setq locales (cons i locales))) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
207 (setq i (1- i))) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
208 locales))) |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
209 |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
210 (defun w32-list-locales () |
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
211 "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
|
212 (interactive) |
98791
eeef1de115b3
* w32-fns.el (w32-list-locales): Decode output of `w32-get-locale-info'
Juanma Barranquero <lekktu@gmail.com>
parents:
98778
diff
changeset
|
213 (when (null w32-valid-locales) |
eeef1de115b3
* w32-fns.el (w32-list-locales): Decode output of `w32-get-locale-info'
Juanma Barranquero <lekktu@gmail.com>
parents:
98778
diff
changeset
|
214 (setq w32-valid-locales (sort (w32-get-valid-locale-ids) #'<))) |
100195
caf4353286ff
* w32-fns.el (w32-list-locales): Use `with-output-to-temp-buffer',
Juanma Barranquero <lekktu@gmail.com>
parents:
99540
diff
changeset
|
215 (with-output-to-temp-buffer "*Supported Locales*" |
caf4353286ff
* w32-fns.el (w32-list-locales): Use `with-output-to-temp-buffer',
Juanma Barranquero <lekktu@gmail.com>
parents:
99540
diff
changeset
|
216 (princ "LCID\tAbbrev\tFull name\n\n") |
100351
d23b1588c7c1
Move decoding of locale info from Lisp to C.
Juanma Barranquero <lekktu@gmail.com>
parents:
100195
diff
changeset
|
217 (dolist (locale w32-valid-locales) |
d23b1588c7c1
Move decoding of locale info from Lisp to C.
Juanma Barranquero <lekktu@gmail.com>
parents:
100195
diff
changeset
|
218 (princ (format "%d\t%s\t%s\n" |
d23b1588c7c1
Move decoding of locale info from Lisp to C.
Juanma Barranquero <lekktu@gmail.com>
parents:
100195
diff
changeset
|
219 locale |
d23b1588c7c1
Move decoding of locale info from Lisp to C.
Juanma Barranquero <lekktu@gmail.com>
parents:
100195
diff
changeset
|
220 (w32-get-locale-info locale) |
d23b1588c7c1
Move decoding of locale info from Lisp to C.
Juanma Barranquero <lekktu@gmail.com>
parents:
100195
diff
changeset
|
221 (w32-get-locale-info locale t)))))) |
21597
409211e285bc
(w32-system-shells): Add 4dos and 4nt.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21059
diff
changeset
|
222 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
223 ;; Setup Info-default-directory-list to include the info directory |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
224 ;; near where Emacs executable was installed. We used to set INFOPATH, |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
225 ;; but when this is set Info-default-directory-list is ignored. We |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
226 ;; also cannot rely upon what is set in paths.el because they assume |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
227 ;; that configuration during build time is correct for runtime. |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
228 (defun w32-init-info () |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
229 (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
|
230 (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
|
231 (dir2 (expand-file-name "../../../info/" instdir))) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
232 (if (file-exists-p dir1) |
40458
de4e98791121
(convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents:
40345
diff
changeset
|
233 (setq Info-default-directory-list |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
234 (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
|
235 (if (file-exists-p dir2) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
236 (setq Info-default-directory-list |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
237 (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
|
238 |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
239 (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
|
240 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
241 ;; The variable source-directory is used to initialize Info-directory-list. |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
242 ;; However, the common case is that Emacs is being used from a binary |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
243 ;; distribution, and the value of source-directory is meaningless in that |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
244 ;; case. Even worse, source-directory can refer to a directory on a drive |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
245 ;; on the build machine that happens to be a removable drive on the user's |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
246 ;; machine. When this happens, Emacs tries to access the removable drive |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
247 ;; and produces the abort/retry/ignore dialog. Since we do not use |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
248 ;; source-directory, set it to something that is a reasonable approximation |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
249 ;; on the user's machine. |
23571
ae5eea3cc314
Remove a dangling reference to a directory on the
Geoff Voelker <voelker@cs.washington.edu>
parents:
23173
diff
changeset
|
250 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
251 ;;(add-hook 'before-init-hook |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
252 ;; (lambda () |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
253 ;; (setq source-directory (file-name-as-directory |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
254 ;; (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
|
255 |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
256 (defun convert-standard-filename (filename) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
257 "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
|
258 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
|
259 certain patterns. |
ccd8cdf69359
Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents:
55792
diff
changeset
|
260 |
ccd8cdf69359
Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
Juanma Barranquero <lekktu@gmail.com>
parents:
55792
diff
changeset
|
261 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
|
262 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
|
263 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
|
264 shell requires it (see `w32-shell-dos-semantics')." |
74832
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
265 (save-match-data |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
266 (let ((name |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
267 (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename) |
40458
de4e98791121
(convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents:
40345
diff
changeset
|
268 (replace-match "\\1:/" t nil filename) |
74832
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
269 (copy-sequence filename))) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
270 (start 0)) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
271 ;; leave ':' if part of drive specifier |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
272 (if (and (> (length name) 1) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
273 (eq (aref name 1) ?:)) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
274 (setq start 2)) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
275 ;; destructively replace invalid filename characters with ! |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
276 (while (string-match "[?*:<>|\"\000-\037]" name start) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
277 (aset name (match-beginning 0) ?!) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
278 (setq start (match-end 0))) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
279 ;; convert directory separators to Windows format |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
280 ;; (but only if the shell in use requires it) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
281 (when (w32-shell-dos-semantics) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
282 (setq start 0) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
283 (while (string-match "/" name start) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
284 (aset name (match-beginning 0) ?\\) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
285 (setq start (match-end 0)))) |
d53f5b616853
(convert-standard-filename): Wrap in save-match-data.
Eli Zaretskii <eliz@gnu.org>
parents:
74511
diff
changeset
|
286 name))) |
15135
72a1f82a6748
(original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents:
15003
diff
changeset
|
287 |
9803 | 288 ;;; 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
|
289 (defun x-set-selection (type data) |
104135
decfa3e02ba0
* select.el (x-set-selection): Doc fix (Bug#4021).
Chong Yidong <cyd@stupidchicken.com>
parents:
104066
diff
changeset
|
290 "Make an X selection of type TYPE and value DATA. |
104066 | 291 The argument TYPE (nil means `PRIMARY') says which selection, and |
292 DATA specifies the contents. TYPE must be a symbol. \(It can also | |
293 be a string, which stands for the symbol with that name, but this | |
294 is considered obsolete.) DATA may be a string, a symbol, an | |
295 integer (or a cons of two integers or list of two integers). | |
296 | |
297 The selection may also be a cons of two markers pointing to the same buffer, | |
298 or an overlay. In these cases, the selection is considered to be the text | |
299 between the markers *at whatever time the selection is examined*. | |
300 Thus, editing done in the buffer after you specify the selection | |
301 can alter the effective value of the selection. | |
302 | |
303 The data may also be a vector of valid non-vector selection values. | |
304 | |
305 The return value is DATA. | |
306 | |
307 Interactively, this command sets the primary selection. Without | |
308 prefix argument, it reads the selection in the minibuffer. With | |
309 prefix argument, it uses the text of the region as the selection value. | |
310 | |
311 Note that on MS-Windows, primary and secondary selections set by Emacs | |
312 are not available to other programs." | |
103947
37177e1f2fcb
* w32-fns.el (x-selection-owner-p): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
313 (put 'x-selections (or type 'PRIMARY) data)) |
15350
a8bd6f986389
(x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
15338
diff
changeset
|
314 |
a8bd6f986389
(x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
15338
diff
changeset
|
315 (defun x-get-selection (&optional type data-type) |
104066 | 316 "Return the value of an X Windows selection. |
317 The argument TYPE (default `PRIMARY') says which selection, | |
318 and the argument DATA-TYPE (default `STRING') says | |
319 how to convert the data. | |
320 | |
321 TYPE may be any symbol \(but nil stands for `PRIMARY'). However, | |
322 only a few symbols are commonly used. They conventionally have | |
323 all upper-case names. The most often used ones, in addition to | |
324 `PRIMARY', are `SECONDARY' and `CLIPBOARD'. | |
325 | |
326 DATA-TYPE is usually `STRING', but can also be one of the symbols | |
327 in `selection-converter-alist', which see." | |
103947
37177e1f2fcb
* w32-fns.el (x-selection-owner-p): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
328 (get 'x-selections (or type 'PRIMARY))) |
37177e1f2fcb
* w32-fns.el (x-selection-owner-p): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
329 |
37177e1f2fcb
* w32-fns.el (x-selection-owner-p): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
330 ;; x-selection-owner-p is used in simple.el |
37177e1f2fcb
* w32-fns.el (x-selection-owner-p): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
331 (defun x-selection-owner-p (&optional type) |
37177e1f2fcb
* w32-fns.el (x-selection-owner-p): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
332 (and (memq type '(nil PRIMARY SECONDARY)) |
37177e1f2fcb
* w32-fns.el (x-selection-owner-p): New function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100908
diff
changeset
|
333 (get 'x-selections (or type 'PRIMARY)))) |
15350
a8bd6f986389
(x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents:
15338
diff
changeset
|
334 |
24498
756058742361
(set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24441
diff
changeset
|
335 (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
|
336 "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
|
337 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
|
338 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
|
339 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
|
340 |
65bad70edb17
(w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents:
40458
diff
changeset
|
341 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
|
342 `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
|
343 (interactive |
41325
65bad70edb17
(w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents:
40458
diff
changeset
|
344 (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
|
345 (read-coding-system |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
65298
diff
changeset
|
346 (format "Coding system for system calls (default %s): " |
24498
756058742361
(set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24441
diff
changeset
|
347 default) |
756058742361
(set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24441
diff
changeset
|
348 default)))) |
756058742361
(set-w32-system-coding-system) New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24441
diff
changeset
|
349 (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
|
350 (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
|
351 |
65bad70edb17
(w32-system-coding-system): Change to an alias for
Jason Rumney <jasonr@gnu.org>
parents:
40458
diff
changeset
|
352 ;; 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
|
353 ;; 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
|
354 (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
|
355 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
356 ;; Set to a system sound if you want a fancy bell. |
11399 | 357 (set-message-beep nil) |
358 | |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
359 ;; The "Windows" keys on newer keyboards bring up the Start menu |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
360 ;; whether you want it or not - make Emacs ignore these keystrokes |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
361 ;; rather than beep. |
19692
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
362 (global-set-key [lwindow] 'ignore) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
363 (global-set-key [rwindow] 'ignore) |
4b8ff0021dcb
Don't unset C-mouse-down bindings.
Geoff Voelker <voelker@cs.washington.edu>
parents:
17549
diff
changeset
|
364 |
33385
262bed8a9ecf
(w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33212
diff
changeset
|
365 (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
|
366 "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
|
367 Creates entries in `w32-charset-info-alist'. |
262bed8a9ecf
(w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33212
diff
changeset
|
368 XLFD-CHARSET is a string which will appear in the XLFD font name to |
98778
0f8ccfd21a74
* w32-fns.el (w32-check-shell-configuration): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
97221
diff
changeset
|
369 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
|
370 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
|
371 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
|
372 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
|
373 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
|
374 bit output with no translation." |
262bed8a9ecf
(w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33212
diff
changeset
|
375 (add-to-list 'w32-charset-info-alist |
98778
0f8ccfd21a74
* w32-fns.el (w32-check-shell-configuration): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
97221
diff
changeset
|
376 (cons xlfd-charset (cons windows-charset codepage)))) |
33385
262bed8a9ecf
(w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33212
diff
changeset
|
377 |
45814
8e79905a56dd
(w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents:
43756
diff
changeset
|
378 ;; 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
|
379 ;; 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
|
380 (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
|
381 (w32-add-charset-info "iso8859-15" 'w32-charset-ansi 28605) |
89596
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
382 ;; The following two are included for pattern matching. |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
383 (w32-add-charset-info "jisx0201" 'w32-charset-shiftjis 932) |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
384 (w32-add-charset-info "jisx0208" 'w32-charset-shiftjis 932) |
33385
262bed8a9ecf
(w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33212
diff
changeset
|
385 (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
|
386 (w32-add-charset-info "jisx0201-katakana" 'w32-charset-shiftjis 932) |
79980
399b25047283
Partially revert 2007-11-10 change.
Jason Rumney <jasonr@gnu.org>
parents:
79721
diff
changeset
|
387 (w32-add-charset-info "ksc5601.1989" 'w32-charset-hangeul 949) |
399b25047283
Partially revert 2007-11-10 change.
Jason Rumney <jasonr@gnu.org>
parents:
79721
diff
changeset
|
388 (w32-add-charset-info "big5" 'w32-charset-chinesebig5 950) |
399b25047283
Partially revert 2007-11-10 change.
Jason Rumney <jasonr@gnu.org>
parents:
79721
diff
changeset
|
389 (w32-add-charset-info "gb2312.1980" 'w32-charset-gb2312 936) |
33385
262bed8a9ecf
(w32-add-charset-info): New function.
Jason Rumney <jasonr@gnu.org>
parents:
33212
diff
changeset
|
390 (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
|
391 (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
|
392 (w32-add-charset-info "ms-oemlatin" 'w32-charset-oem 850) |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
393 (w32-add-charset-info "iso8859-2" 'w32-charset-easteurope 28592) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
394 (w32-add-charset-info "iso8859-3" 'w32-charset-turkish 28593) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
395 (w32-add-charset-info "iso8859-4" 'w32-charset-baltic 28594) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
396 (w32-add-charset-info "iso8859-6" 'w32-charset-arabic 28596) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
397 (w32-add-charset-info "iso8859-7" 'w32-charset-greek 28597) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
398 (w32-add-charset-info "iso8859-8" 'w32-charset-hebrew 1255) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
399 (w32-add-charset-info "iso8859-9" 'w32-charset-turkish 1254) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
400 (w32-add-charset-info "iso8859-13" 'w32-charset-baltic 1257) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
401 (w32-add-charset-info "koi8-r" 'w32-charset-russian 20866) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
402 (w32-add-charset-info "iso8859-5" 'w32-charset-russian 28595) |
97221
b4be5834c484
(tis620-2533): Use as preferred registry for thai fonts.
Jason Rumney <jasonr@gnu.org>
parents:
96386
diff
changeset
|
403 (w32-add-charset-info "tis620-2533" 'w32-charset-thai 874) |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
404 (w32-add-charset-info "windows-1258" 'w32-charset-vietnamese 1258) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
405 (w32-add-charset-info "ksc5601.1992" 'w32-charset-johab 1361) |
96386 | 406 (w32-add-charset-info "mac-roman" 'w32-charset-mac 10000) |
407 (w32-add-charset-info "iso10646-1" 'w32-charset-default t) | |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
95841
diff
changeset
|
408 |
89596
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
409 ;; ;; If unicode windows charset is not defined, use ansi fonts. |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
410 ;; (w32-add-charset-info "iso10646-1" 'w32-charset-ansi t)) |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
411 |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
412 ;; Prefered names |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
413 (w32-add-charset-info "big5-0" 'w32-charset-chinesebig5 950) |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
414 (w32-add-charset-info "gb2312.1980-0" 'w32-charset-gb2312 936) |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
415 (w32-add-charset-info "jisx0208-sjis" 'w32-charset-shiftjis 932) |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
416 (w32-add-charset-info "ksc5601.1987-0" 'w32-charset-hangeul 949) |
967bca3bf3dd
(w32-charset-info-alist): Accept more charset aliases.
Jason Rumney <jasonr@gnu.org>
parents:
88123
diff
changeset
|
417 (w32-add-charset-info "tis620-0" 'w32-charset-thai 874) |
45814
8e79905a56dd
(w32-charset-info-alist): Reorder.
Jason Rumney <jasonr@gnu.org>
parents:
43756
diff
changeset
|
418 (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
|
419 |
33885
fd77fd05cecb
add version to obsolete variables.
Jason Rumney <jasonr@gnu.org>
parents:
33385
diff
changeset
|
420 (make-obsolete-variable 'w32-enable-italics |
fd77fd05cecb
add version to obsolete variables.
Jason Rumney <jasonr@gnu.org>
parents:
33385
diff
changeset
|
421 '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
|
422 (make-obsolete-variable 'w32-charset-to-codepage-alist |
33885
fd77fd05cecb
add version to obsolete variables.
Jason Rumney <jasonr@gnu.org>
parents:
33385
diff
changeset
|
423 '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
|
424 |
34369
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
425 |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
426 ;;;; 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
|
427 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
428 ;; We keep track of the last text selected here, so we can check the |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
429 ;; current selection against it, and avoid passing back our own text |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
430 ;; from x-cut-buffer-or-selection-value. |
34369
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
431 (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
|
432 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
433 ;; It is said that overlarge strings are slow to put into the cut buffer. |
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
434 ;; Note this value is overridden below. |
34369
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
435 (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
|
436 "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
|
437 |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
438 (defun x-select-text (text &optional push) |
104066 | 439 "Select TEXT, a string, according to the window system. |
440 | |
441 On X, put TEXT in the primary X selection. For backward | |
442 compatibility with older X applications, set the value of X cut | |
443 buffer 0 as well, and if the optional argument PUSH is non-nil, | |
444 rotate the cut buffers. If `x-select-enable-clipboard' is | |
445 non-nil, copy the text to the X clipboard as well. | |
446 | |
447 On Windows, make TEXT the current selection. If | |
448 `x-select-enable-clipboard' is non-nil, copy the text to the | |
449 clipboard as well. The argument PUSH is ignored. | |
450 | |
451 On Nextstep, put TEXT in the pasteboard; PUSH is ignored." | |
34369
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
452 (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
|
453 (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
|
454 (setq x-last-selected-text text)) |
40458
de4e98791121
(convert-standard-filename): Handle cygwin-specific pathnames.
Sam Steingold <sds@gnu.org>
parents:
40345
diff
changeset
|
455 |
34369
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
456 (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
|
457 "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
|
458 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
|
459 they were unset." |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
460 (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
|
461 (let (text) |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
462 ;; 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
|
463 (condition-case c |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
464 (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
|
465 (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
|
466 (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
|
467 (cond |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
468 ((not text) nil) |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
469 ((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
|
470 ((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
|
471 ;; 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
|
472 (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
|
473 nil) |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
474 (t |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
475 (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
|
476 |
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
477 (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
|
478 |
104706
76a2a2b0cf04
Fixup commenting conventions.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
104135
diff
changeset
|
479 ;; Arrange for the kill and yank functions to set and check the clipboard. |
34369
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
480 (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
|
481 (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
|
482 |
67794
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
483 |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
484 ;;;; Support for build process |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
485 (defun w32-batch-update-autoloads () |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
486 "Like `batch-update-autoloads', but takes the name of the autoloads file |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
487 from the command line. |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
488 |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
489 This is required because some Windows build environments, such as MSYS, |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
490 munge command-line arguments that include file names to a horrible mess |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
491 that Emacs is unable to cope with." |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
492 (let ((generated-autoload-file |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
493 (expand-file-name (pop command-line-args-left)))) |
09f3c0ac0073
(w32-batch-update-autoloads): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
65680
diff
changeset
|
494 (batch-update-autoloads))) |
34369
b5cb05f23e04
Add clipboard support from term/w32-win.el, so it is
Andrew Innes <andrewi@gnu.org>
parents:
33885
diff
changeset
|
495 |
74511
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
496 (defun w32-append-code-lines (orig extra) |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
497 "Append non-empty non-comment lines in the file EXTRA to the file ORIG. |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
498 |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
499 This function saves all buffers and kills the Emacs session, without asking |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
500 for any permissions. |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
501 |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
502 This is required because the Windows build environment is not required |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
503 to include Sed, which is used by leim/Makefile.in to do the job." |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
504 (find-file orig) |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
505 (goto-char (point-max)) |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
506 (insert-file-contents extra) |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
507 (delete-matching-lines "^$\\|^;") |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
508 (save-buffers-kill-emacs t)) |
de08a74adc2a
(w32-append-code-lines): New function.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
509 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93085
diff
changeset
|
510 ;; 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
|
511 ;;; w32-fns.el ends here |