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