Mercurial > emacs
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 |
rev | line source |
---|---|
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) | |
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) | |
11399 | 25 ;; Created. |
9803 | 26 |
11399 | 27 ;; (November 21, 1994) |
28 ;; [C-M-backspace] defined. | |
29 ;; mode-line-format defined to show buffer file type. | |
30 ;; audio bell initialized. | |
9803 | 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]) | |
11399 | 38 (define-key function-key-map [C-M-backspace] [\C-\M-delete]) |
39 | |
40 ;; Show file type (text or binary) on modeline | |
41 (setq-default mode-line-format | |
42 (list (purecopy "") | |
43 'mode-line-modified | |
44 'mode-line-buffer-identification | |
45 (purecopy " ") | |
46 'global-mode-string | |
47 (purecopy " %[(") | |
48 (purecopy "%t:") | |
49 'mode-name 'mode-line-process 'minor-mode-alist | |
50 (purecopy "%n") | |
51 (purecopy ")%]--") | |
52 (purecopy '(line-number-mode "L%l--")) | |
53 (purecopy '(-3 . "%p")) | |
54 (purecopy "-%-"))) | |
9803 | 55 |
56 ;; Ignore case on file-name completion | |
57 (setq completion-ignore-case t) | |
58 | |
59 ;; The cmd.exe shell uses the "/c" switch instead of the "-c" switch | |
60 ;; for executing its command line argument (from simple.el). | |
61 (setq shell-command-switch "/c") | |
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 | 66 ;; Taken from dos-fn.el ... don't want all that's in the file, maybe |
67 ;; separate it out someday. | |
68 | |
69 (defvar file-name-buffer-file-type-alist | |
70 '( | |
71 ("[:/].*config.sys$" . nil) ; config.sys text | |
72 ("\\.elc$" . t) ; emacs stuff | |
73 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t) | |
74 ; MS-Dos stuff | |
75 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t) | |
76 ; Packers | |
77 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t) | |
78 ; Unix stuff | |
79 ("\\.tp[ulpw]$" . t) | |
80 ; Borland Pascal stuff | |
81 ("[:/]tags$" . t) | |
82 ; Emacs TAGS file | |
83 ) | |
84 "*Alist for distinguishing text files from binary files. | |
85 Each element has the form (REGEXP . TYPE), where REGEXP is matched | |
86 against the file name, and TYPE is nil for text, t for binary.") | |
87 | |
88 (defun find-buffer-file-type (filename) | |
89 (let ((alist file-name-buffer-file-type-alist) | |
90 (found nil) | |
91 (code nil)) | |
92 (let ((case-fold-search t)) | |
93 (setq filename (file-name-sans-versions filename)) | |
94 (while (and (not found) alist) | |
95 (if (string-match (car (car alist)) filename) | |
96 (setq code (cdr (car alist)) | |
97 found t)) | |
98 (setq alist (cdr alist)))) | |
99 (if found | |
100 (cond((memq code '(nil t)) code) | |
101 ((and (symbolp code) (fboundp code)) | |
102 (funcall code filename))) | |
103 default-buffer-file-type))) | |
104 | |
105 (defun find-file-binary (filename) | |
106 "Visit file FILENAME and treat it as binary." | |
107 (interactive "FFind file binary: ") | |
108 (let ((file-name-buffer-file-type-alist '(("" . t)))) | |
109 (find-file filename))) | |
110 | |
111 (defun find-file-text (filename) | |
112 "Visit file FILENAME and treat it as a text file." | |
113 (interactive "FFind file text: ") | |
114 (let ((file-name-buffer-file-type-alist '(("" . nil)))) | |
115 (find-file filename))) | |
116 | |
117 (defun find-file-not-found-set-buffer-file-type () | |
118 (save-excursion | |
119 (set-buffer (current-buffer)) | |
120 (setq buffer-file-type (find-buffer-file-type (buffer-file-name)))) | |
121 nil) | |
122 | |
123 ;;; To set the default file type on new files. | |
124 (add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type) | |
125 | |
126 ;;; Fix interface to (X-specific) mouse.el | |
127 (defalias 'window-frame 'ignore) | |
128 (defalias 'x-set-selection 'ignore) | |
129 (fset 'x-get-selection '(lambda (&rest rest) "")) | |
130 (fmakunbound 'font-menu-add-default) | |
131 (global-unset-key [C-down-mouse-1]) | |
132 (global-unset-key [C-down-mouse-2]) | |
133 (global-unset-key [C-down-mouse-3]) | |
134 | |
11399 | 135 ;;; Set to a system sound if you want a fancy bell. |
136 (set-message-beep nil) | |
137 | |
9803 | 138 ;;; winnt.el ends here |