annotate lisp/w32-fns.el @ 11999:f074fb9f8e83

(hppa*-hp-hpux10*, m68k-hp-hpux10*): New configurations.
author Karl Heuer <kwzh@gnu.org>
date Mon, 29 May 1995 20:02:00 +0000
parents 824f238e0c64
children cf9fbf172b0d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;; winnt.el --- Lisp routines for Windows NT.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;; Copyright (C) 1994 Free Software Foundation, Inc.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;; Author: Geoff Voelker (voelker@cs.washington.edu)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; This file is part of GNU Emacs.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; 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
10 ;; the Free Software Foundation; either version 2, or (at your option)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; any later version.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; GNU Emacs is distributed in the hope that it will be useful,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU General Public License for more details.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; You should have received a copy of the GNU General Public License
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; along with GNU Emacs; see the file COPYING. If not, write to
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;;; Commentary:
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 ;; (August 12, 1993)
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
25 ;; Created.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
27 ;; (November 21, 1994)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
28 ;; [C-M-backspace] defined.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
29 ;; mode-line-format defined to show buffer file type.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
30 ;; audio bell initialized.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;;; Code:
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 ;; Map delete and backspace
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 (define-key function-key-map [backspace] "\177")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 (define-key function-key-map [delete] "\C-d")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 (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
38 (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
39
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
40 ;; Show file type (text or binary) on modeline
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
41 (setq-default mode-line-format
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
42 (list (purecopy "")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
43 'mode-line-modified
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
44 'mode-line-buffer-identification
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
45 (purecopy " ")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
46 'global-mode-string
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
47 (purecopy " %[(")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
48 (purecopy "%t:")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
49 'mode-name 'mode-line-process 'minor-mode-alist
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
50 (purecopy "%n")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
51 (purecopy ")%]--")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
52 (purecopy '(line-number-mode "L%l--"))
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
53 (purecopy '(-3 . "%p"))
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
54 (purecopy "-%-")))
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; Ignore case on file-name completion
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 (setq completion-ignore-case t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; The cmd.exe shell uses the "/c" switch instead of the "-c" switch
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; for executing its command line argument (from simple.el).
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (setq shell-command-switch "/c")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62
11743
824f238e0c64 (path-separator): Set to ";".
Richard M. Stallman <rms@gnu.org>
parents: 11399
diff changeset
63 ;; Use ";" instead of ":" as a path separator (from files.el).
824f238e0c64 (path-separator): Set to ";".
Richard M. Stallman <rms@gnu.org>
parents: 11399
diff changeset
64 (setq path-separator ";")
824f238e0c64 (path-separator): Set to ";".
Richard M. Stallman <rms@gnu.org>
parents: 11399
diff changeset
65
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; Taken from dos-fn.el ... don't want all that's in the file, maybe
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; separate it out someday.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (defvar file-name-buffer-file-type-alist
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 '(
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ("[:/].*config.sys$" . nil) ; config.sys text
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ("\\.elc$" . t) ; emacs stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ; MS-Dos stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ; Packers
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ; Unix stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ("\\.tp[ulpw]$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ; Borland Pascal stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ("[:/]tags$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ; Emacs TAGS file
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 )
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 "*Alist for distinguishing text files from binary files.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 Each element has the form (REGEXP . TYPE), where REGEXP is matched
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 against the file name, and TYPE is nil for text, t for binary.")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (defun find-buffer-file-type (filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (let ((alist file-name-buffer-file-type-alist)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (found nil)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (code nil))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (let ((case-fold-search t))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (setq filename (file-name-sans-versions filename))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (while (and (not found) alist)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (if (string-match (car (car alist)) filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (setq code (cdr (car alist))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 found t))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (setq alist (cdr alist))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (if found
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (cond((memq code '(nil t)) code)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ((and (symbolp code) (fboundp code))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (funcall code filename)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 default-buffer-file-type)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (defun find-file-binary (filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 "Visit file FILENAME and treat it as binary."
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (interactive "FFind file binary: ")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (let ((file-name-buffer-file-type-alist '(("" . t))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (find-file filename)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (defun find-file-text (filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 "Visit file FILENAME and treat it as a text file."
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (interactive "FFind file text: ")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (let ((file-name-buffer-file-type-alist '(("" . nil))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (find-file filename)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (defun find-file-not-found-set-buffer-file-type ()
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (save-excursion
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 (set-buffer (current-buffer))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (setq buffer-file-type (find-buffer-file-type (buffer-file-name))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 nil)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 ;;; To set the default file type on new files.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 (add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;;; Fix interface to (X-specific) mouse.el
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (defalias 'window-frame 'ignore)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (defalias 'x-set-selection 'ignore)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (fset 'x-get-selection '(lambda (&rest rest) ""))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (fmakunbound 'font-menu-add-default)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (global-unset-key [C-down-mouse-1])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 (global-unset-key [C-down-mouse-2])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 (global-unset-key [C-down-mouse-3])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
135 ;;; 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
136 (set-message-beep nil)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
137
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 ;;; winnt.el ends here