Mercurial > emacs
comparison lisp/w32-fns.el @ 9803:fa698fd10c05
Initial revision
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 01 Nov 1994 10:27:02 +0000 |
parents | |
children | f322675d5c53 |
comparison
equal
deleted
inserted
replaced
9802:77c448147423 | 9803:fa698fd10c05 |
---|---|
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) | |
5 | |
6 ;; This file is part of GNU Emacs. | |
7 | |
8 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
9 ;; it under the terms of the GNU General Public License as published by | |
10 ;; the Free Software Foundation; either version 2, or (at your option) | |
11 ;; any later version. | |
12 | |
13 ;; GNU Emacs is distributed in the hope that it will be useful, | |
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 ;; GNU General Public License for more details. | |
17 | |
18 ;; You should have received a copy of the GNU General Public License | |
19 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | |
22 ;;; Commentary: | |
23 | |
24 ;; (August 12, 1993) | |
25 ;; NT switches placed in: | |
26 ;; | |
27 ;; compile.el, dired-new.el, dired.el, loadup.el, startup.el, subr.el | |
28 | |
29 ;; (November 21, 1993) | |
30 ;; General stuffing for supporting Windows NT. | |
31 | |
32 ;;; Code: | |
33 | |
34 ;; Map delete and backspace | |
35 (define-key function-key-map [backspace] "\177") | |
36 (define-key function-key-map [delete] "\C-d") | |
37 (define-key function-key-map [M-backspace] [?\M-\177]) | |
38 | |
39 ;; Ignore case on file-name completion | |
40 (setq completion-ignore-case t) | |
41 | |
42 ;; The cmd.exe shell uses the "/c" switch instead of the "-c" switch | |
43 ;; for executing its command line argument (from simple.el). | |
44 (setq shell-command-switch "/c") | |
45 | |
46 ;; Taken from dos-fn.el ... don't want all that's in the file, maybe | |
47 ;; separate it out someday. | |
48 | |
49 (defvar file-name-buffer-file-type-alist | |
50 '( | |
51 ("[:/].*config.sys$" . nil) ; config.sys text | |
52 ("\\.elc$" . t) ; emacs stuff | |
53 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t) | |
54 ; MS-Dos stuff | |
55 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t) | |
56 ; Packers | |
57 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t) | |
58 ; Unix stuff | |
59 ("\\.tp[ulpw]$" . t) | |
60 ; Borland Pascal stuff | |
61 ("[:/]tags$" . t) | |
62 ; Emacs TAGS file | |
63 ) | |
64 "*Alist for distinguishing text files from binary files. | |
65 Each element has the form (REGEXP . TYPE), where REGEXP is matched | |
66 against the file name, and TYPE is nil for text, t for binary.") | |
67 | |
68 (defun find-buffer-file-type (filename) | |
69 (let ((alist file-name-buffer-file-type-alist) | |
70 (found nil) | |
71 (code nil)) | |
72 (let ((case-fold-search t)) | |
73 (setq filename (file-name-sans-versions filename)) | |
74 (while (and (not found) alist) | |
75 (if (string-match (car (car alist)) filename) | |
76 (setq code (cdr (car alist)) | |
77 found t)) | |
78 (setq alist (cdr alist)))) | |
79 (if found | |
80 (cond((memq code '(nil t)) code) | |
81 ((and (symbolp code) (fboundp code)) | |
82 (funcall code filename))) | |
83 default-buffer-file-type))) | |
84 | |
85 (defun find-file-binary (filename) | |
86 "Visit file FILENAME and treat it as binary." | |
87 (interactive "FFind file binary: ") | |
88 (let ((file-name-buffer-file-type-alist '(("" . t)))) | |
89 (find-file filename))) | |
90 | |
91 (defun find-file-text (filename) | |
92 "Visit file FILENAME and treat it as a text file." | |
93 (interactive "FFind file text: ") | |
94 (let ((file-name-buffer-file-type-alist '(("" . nil)))) | |
95 (find-file filename))) | |
96 | |
97 (defun find-file-not-found-set-buffer-file-type () | |
98 (save-excursion | |
99 (set-buffer (current-buffer)) | |
100 (setq buffer-file-type (find-buffer-file-type (buffer-file-name)))) | |
101 nil) | |
102 | |
103 ;;; To set the default file type on new files. | |
104 (add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type) | |
105 | |
106 ;;; Fix interface to (X-specific) mouse.el | |
107 (defalias 'window-frame 'ignore) | |
108 (defalias 'x-set-selection 'ignore) | |
109 (fset 'x-get-selection '(lambda (&rest rest) "")) | |
110 (fmakunbound 'font-menu-add-default) | |
111 (global-unset-key [C-down-mouse-1]) | |
112 (global-unset-key [C-down-mouse-2]) | |
113 (global-unset-key [C-down-mouse-3]) | |
114 | |
115 ;;; winnt.el ends here |