annotate lisp/w32-fns.el @ 19540:06552ba973ce libc-970827 libc-970828 libc-970829 libc-970830 libc-970831 libc-970901 libc-970902 libc-970903 libc-970904 libc-970905

(*:Linux:*:*): Recognize alpha-linux-gnulibc1.
author Richard Kenner <kenner@gnu.org>
date Tue, 26 Aug 1997 09:21:29 +0000
parents f57de209f01b
children 4b8ff0021dcb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16592
a5e9fa379097 Use new file name w32-fns.el
Geoff Voelker <voelker@cs.washington.edu>
parents: 16028
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
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1994 Free Software Foundation, Inc.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Geoff Voelker (voelker@cs.washington.edu)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
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 ;; GNU Emacs is free software; you can redistribute it and/or modify
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; 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
11 ;; the Free Software Foundation; either version 2, or (at your option)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; any later version.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; GNU General Public License for more details.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; 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
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14121
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14121
diff changeset
22 ;; Boston, MA 02111-1307, USA.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;;; Commentary:
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 ;; (August 12, 1993)
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
27 ;; Created.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
29 ;; (November 21, 1994)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
30 ;; [C-M-backspace] defined.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
31 ;; mode-line-format defined to show buffer file type.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
32 ;; audio bell initialized.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;;; Code:
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 ;; Map delete and backspace
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 (define-key function-key-map [backspace] "\177")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (define-key function-key-map [delete] "\C-d")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 (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
40 (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
41
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; Ignore case on file-name completion
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 (setq completion-ignore-case t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44
17549
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
45 (defvar w32-system-shells '("cmd" "cmd.exe" "command" "command.com")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
46 "List of strings recognized as Windows NT/95 system shells.")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
47
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
48 (defun w32-using-nt ()
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
49 "Return t if running on Windows NT (as oppposed to, e.g., Windows 95)."
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
50 (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
51
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
52 (defun w32-shell-name ()
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
53 "Return the name of the shell being used on Windows NT/95."
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
54 (or (and (boundp 'explicit-shell-file-name) explicit-shell-file-name)
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
55 (getenv "ESHELL")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
56 (getenv "SHELL")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
57 (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
58 "command.com"))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
59
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
60 (defun w32-using-system-shell-p ()
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
61 "Return t if using a Windows NT/95 system shell (cmd.exe or command.com)."
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
62 (member (downcase (file-name-nondirectory (w32-shell-name)))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
63 w32-system-shells))
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64
17549
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
65 (defun w32-startup ()
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
66 "Configure Emacs during startup for running on Windows NT/95.
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
67 This function is invoked after loading the init files and processing
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
68 the command line, and is intended to initialize anything important
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
69 not initialized by the user or site."
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
70 ;; Configure shell mode if using a system shell.
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
71 (cond ((w32-using-system-shell-p)
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
72 (let ((shell (file-name-nondirectory (w32-shell-name))))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
73 ;; "/c" is used for executing command line arguments.
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
74 (setq shell-command-switch "/c")
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
75 ;; Complete directories using a backslash.
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
76 (setq comint-completion-addsuffix '("\\" . " "))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
77 ;; Initialize the explicit-"shell"-args variable.
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
78 (cond ((member (downcase shell) '("cmd" "cmd.exe"))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
79 (let* ((args-sym-name (format "explicit-%s-args" shell))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
80 (args-sym (intern-soft args-sym-name)))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
81 (cond ((not args-sym)
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
82 (setq args-sym (intern args-sym-name))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
83 ;; The "/q" prevents cmd.exe from echoing commands.
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
84 (set args-sym '("/q")))))))))))
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
85
f57de209f01b (w32-using-nt, w32-shell-name, w32-using-system-shell-p,
Geoff Voelker <voelker@cs.washington.edu>
parents: 16859
diff changeset
86 (add-hook 'emacs-startup-hook 'w32-startup)
15338
b0d95c32f026 (shell-mode-hook): Set comint-completion-addsuffix
Richard M. Stallman <rms@gnu.org>
parents: 15257
diff changeset
87
16859
2a3cc82fa1ea (make-auto-save-file-name): Replace occurrences of
Geoff Voelker <voelker@cs.washington.edu>
parents: 16592
diff changeset
88 ;; Avoid creating auto-save file names containing invalid characters.
15135
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
89 (fset 'original-make-auto-save-file-name
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
90 (symbol-function 'make-auto-save-file-name))
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
91
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
92 (defun make-auto-save-file-name ()
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
93 "Return file name to use for auto-saves of current buffer.
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
94 Does not consider `auto-save-visited-file-name' as that variable is checked
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
95 before calling this function. You can redefine this for customization.
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
96 See also `auto-save-file-name-p'."
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
97 (let ((name (original-make-auto-save-file-name))
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
98 (start 0))
16859
2a3cc82fa1ea (make-auto-save-file-name): Replace occurrences of
Geoff Voelker <voelker@cs.washington.edu>
parents: 16592
diff changeset
99 ;; Skip drive letter if present.
2a3cc82fa1ea (make-auto-save-file-name): Replace occurrences of
Geoff Voelker <voelker@cs.washington.edu>
parents: 16592
diff changeset
100 (if (string-match "^[\/]?[a-zA-`]:" name)
2a3cc82fa1ea (make-auto-save-file-name): Replace occurrences of
Geoff Voelker <voelker@cs.washington.edu>
parents: 16592
diff changeset
101 (setq start (- (match-end 0) (match-beginning 0))))
2a3cc82fa1ea (make-auto-save-file-name): Replace occurrences of
Geoff Voelker <voelker@cs.washington.edu>
parents: 16592
diff changeset
102 ;; Destructively replace occurrences of *?"<>|: with $
2a3cc82fa1ea (make-auto-save-file-name): Replace occurrences of
Geoff Voelker <voelker@cs.washington.edu>
parents: 16592
diff changeset
103 (while (string-match "[?*\"<>|:]" name start)
15135
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
104 (aset name (match-beginning 0) ?$)
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
105 (setq start (1+ (match-end 0))))
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
106 name))
72a1f82a6748 (original-make-auto-save-file-name): New symbol bound
Geoff Voelker <voelker@cs.washington.edu>
parents: 15003
diff changeset
107
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;;; 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
109 (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
110 (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
111 (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
112
a8bd6f986389 (x-set-selection, x-get-selection): Define them to really use TYPE.
Richard M. Stallman <rms@gnu.org>
parents: 15338
diff changeset
113 (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
114 (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
115 (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
116
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (fmakunbound 'font-menu-add-default)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (global-unset-key [C-down-mouse-1])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (global-unset-key [C-down-mouse-2])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (global-unset-key [C-down-mouse-3])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
122 ;;; 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
123 (set-message-beep nil)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
124
16592
a5e9fa379097 Use new file name w32-fns.el
Geoff Voelker <voelker@cs.washington.edu>
parents: 16028
diff changeset
125 ;;; w32-fns.el ends here