annotate lisp/w32-fns.el @ 11622:eba5c25341ff

(PUSH_FAILURE_INT, POP_FAILURE_INT): Use WIDE_INT. (WIDE_INT): Defined (two alternate definitions). (C_ALLOCA): Undef it, if __GNUC__. (REGEX_ALLOCATE_STACK, REGEX_REALLOCATE_STACK) (REGEX_FREE_STACK): New macros. (INIT_FAIL_STACK, DOUBLE_FAIL_STACK, FREE_VARIABLES): Use them. (re_max_failures) [REL_ALLOC]: Alternative larger initial value. (re_compile_fastmap): Use REGEX_FREE_STACK. (re_match_2_internal): Always call FREE_VARIABLES before returning. Always init regstart, old_regstart, etc. whenever MATCH_MAY_ALLOCATE is defined. (FREE_VARIABLES) [REL_ALLOC]: Define non-trivially.
author Richard M. Stallman <rms@gnu.org>
date Sat, 29 Apr 1995 20:21:41 +0000
parents f322675d5c53
children 824f238e0c64
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)
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
5 ;; Version: 1
9803
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
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;;; Commentary:
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; (August 12, 1993)
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
26 ;; Created.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
28 ;; (November 21, 1994)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
29 ;; [C-M-backspace] defined.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
30 ;; mode-line-format defined to show buffer file type.
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
31 ;; audio bell initialized.
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;;; Code:
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; Map delete and backspace
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 (define-key function-key-map [backspace] "\177")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 (define-key function-key-map [delete] "\C-d")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (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
39 (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
40
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
41 ;; Show file type (text or binary) on modeline
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
42 (setq-default mode-line-format
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
43 (list (purecopy "")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
44 'mode-line-modified
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
45 'mode-line-buffer-identification
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
46 (purecopy " ")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
47 'global-mode-string
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
48 (purecopy " %[(")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
49 (purecopy "%t:")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
50 'mode-name 'mode-line-process 'minor-mode-alist
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
51 (purecopy "%n")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
52 (purecopy ")%]--")
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
53 (purecopy '(line-number-mode "L%l--"))
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
54 (purecopy '(-3 . "%p"))
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
55 (purecopy "-%-")))
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; Ignore case on file-name completion
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 (setq completion-ignore-case t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; 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
61 ;; for executing its command line argument (from simple.el).
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (setq shell-command-switch "/c")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; 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
65 ;; separate it out someday.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (defvar file-name-buffer-file-type-alist
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 ("[:/].*config.sys$" . nil) ; config.sys text
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ("\\.elc$" . t) ; emacs stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ; MS-Dos stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ; Packers
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ; Unix stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ("\\.tp[ulpw]$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ; Borland Pascal stuff
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ("[:/]tags$" . t)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ; Emacs TAGS file
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 )
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 "*Alist for distinguishing text files from binary files.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 Each element has the form (REGEXP . TYPE), where REGEXP is matched
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 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
85
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (defun find-buffer-file-type (filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (let ((alist file-name-buffer-file-type-alist)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (found nil)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (code nil))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (let ((case-fold-search t))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (setq filename (file-name-sans-versions filename))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (while (and (not found) alist)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (if (string-match (car (car alist)) filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (setq code (cdr (car alist))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 found t))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (setq alist (cdr alist))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 (if found
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (cond((memq code '(nil t)) code)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 ((and (symbolp code) (fboundp code))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (funcall code filename)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 default-buffer-file-type)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (defun find-file-binary (filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 "Visit file FILENAME and treat it as binary."
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 (interactive "FFind file binary: ")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (let ((file-name-buffer-file-type-alist '(("" . t))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 (find-file filename)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (defun find-file-text (filename)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 "Visit file FILENAME and treat it as a text file."
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (interactive "FFind file text: ")
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (let ((file-name-buffer-file-type-alist '(("" . nil))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (find-file filename)))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (defun find-file-not-found-set-buffer-file-type ()
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (save-excursion
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (set-buffer (current-buffer))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (setq buffer-file-type (find-buffer-file-type (buffer-file-name))))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 nil)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;;; To set the default file type on new files.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 (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
123
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;;; Fix interface to (X-specific) mouse.el
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 (defalias 'window-frame 'ignore)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defalias 'x-set-selection 'ignore)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 (fset 'x-get-selection '(lambda (&rest rest) ""))
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 (fmakunbound 'font-menu-add-default)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 (global-unset-key [C-down-mouse-1])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (global-unset-key [C-down-mouse-2])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 (global-unset-key [C-down-mouse-3])
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132
11399
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
133 ;;; 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
134 (set-message-beep nil)
f322675d5c53 Key [C-M-backspace] defined.
Karl Heuer <kwzh@gnu.org>
parents: 9803
diff changeset
135
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 ;;; winnt.el ends here