Mercurial > emacs
annotate lisp/dos-fns.el @ 7985:f6c309d5d314
(Fmove_overlay): Call redisplay_region even when
changing to a different buffer.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 20 Jun 1994 23:10:07 +0000 |
parents | 06c366308319 |
children | b36d5e88cccc |
rev | line source |
---|---|
5443 | 1 ;;; dos-fns.el --- MS-Dos specific functions. |
2 | |
5469 | 3 ;; Copyright (C) 1991, 1993 Free Software Foundation, Inc. |
5443 | 4 |
5 ;; Maintainer: Morten Welinder (terra@diku.dk) | |
6 ;; Keywords: internal | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
24 ;;; Commentary: | |
25 | |
26 ;; Part of this code is taken from (or derived from) demacs. | |
27 | |
28 ;;; Code: | |
29 | |
30 (setq-default mode-line-format | |
31 (list (purecopy "") | |
32 'mode-line-modified | |
33 'mode-line-buffer-identification | |
34 (purecopy " ") | |
35 'global-mode-string | |
36 (purecopy " %[(") | |
37 (purecopy "%t:") | |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
38 'mode-name 'mode-line-process 'minor-mode-alist |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
39 (purecopy "%n") |
5443 | 40 (purecopy ")%]--") |
41 (purecopy '(line-number-mode "L%l--")) | |
42 (purecopy '(-3 . "%p")) | |
43 (purecopy "-%-"))) | |
44 | |
45 (defvar file-name-buffer-file-type-alist | |
46 '( | |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
47 ("[:/].*config.sys$" . nil) ; config.sys text |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
48 ("\\.elc$" . t) ; emacs stuff |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
49 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t) |
5443 | 50 ; MS-Dos stuff |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
51 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t) |
5443 | 52 ; Packers |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
53 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t) |
5443 | 54 ; Unix stuff |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
55 ("\\.tp[ulpw]$" . t) |
5443 | 56 ; Borland Pascal stuff |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
57 ("[:/]tags$" . t) |
5443 | 58 ; Emacs TAGS file |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
59 ) |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
60 "*Alist for distinguishing text files from binary files. |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
61 Each element has the form (REGEXP . TYPE), where REGEXP is matched |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
62 against the file name, and TYPE is nil for text, t for binary.") |
5443 | 63 |
64 (defun find-buffer-file-type (filename) | |
65 (let ((alist file-name-buffer-file-type-alist) | |
66 (found nil) | |
67 (code nil)) | |
68 (let ((case-fold-search t)) | |
69 (setq filename (file-name-sans-versions filename)) | |
70 (while (and (not found) alist) | |
71 (if (string-match (car (car alist)) filename) | |
72 (setq code (cdr (car alist)) | |
73 found t)) | |
74 (setq alist (cdr alist)))) | |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
75 (if found |
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
76 (cond((memq code '(nil t)) code) |
5443 | 77 ((and (symbolp code) (fboundp code)) |
78 (funcall code filename))) | |
79 default-buffer-file-type))) | |
80 | |
81 (defun find-file-binary (filename) | |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
82 "Visit file FILENAME and treat it as binary." |
5443 | 83 (interactive "FFind file binary: ") |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
84 (let ((file-name-buffer-file-type-alist '(("" . t)))) |
5443 | 85 (find-file filename))) |
86 | |
87 (defun find-file-text (filename) | |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
88 "Visit file FILENAME and treat it as a text file." |
5443 | 89 (interactive "FFind file text: ") |
7087
57553b30baed
(mode-line-format): Put `mode-line-process' earlier.
Richard M. Stallman <rms@gnu.org>
parents:
5469
diff
changeset
|
90 (let ((file-name-buffer-file-type-alist '(("" . nil)))) |
5443 | 91 (find-file filename))) |
92 | |
93 (defun find-file-not-found-set-buffer-file-type () | |
94 (save-excursion | |
95 (set-buffer (current-buffer)) | |
96 (setq buffer-file-type (find-buffer-file-type (buffer-file-name)))) | |
97 nil) | |
98 | |
99 ;;; To set the default file type on new files. | |
100 (add-hook 'find-file-not-found-hooks 'find-file-not-found-set-buffer-file-type) | |
101 | |
102 (defvar msdos-shells '("command.com" "4dos.com" "ndos.com") | |
103 "*List of shells that use `/c' instead of `-c' and a backslashed command.") | |
104 | |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
105 (defconst register-name-alist |
5443 | 106 '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5) |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
107 (cflag . 6) (flags . 7) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
108 (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0)) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
109 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1)))) |
5443 | 110 |
111 (defun make-register () | |
112 (make-vector 8 0)) | |
113 | |
114 (defun register-value (regs name) | |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
115 (let ((where (cdr (assoc name register-name-alist)))) |
5443 | 116 (cond ((consp where) |
117 (let ((tem (aref regs (car where)))) | |
118 (if (zerop (cdr where)) | |
119 (% tem 256) | |
120 (/ tem 256)))) | |
121 ((numberp where) | |
122 (aref regs where)) | |
123 (t nil)))) | |
124 | |
125 (defun set-register-value (regs name value) | |
126 (and (numberp value) | |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
127 (>= value 0) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
128 (let ((where (cdr (assoc name register-name-alist)))) |
5443 | 129 (cond ((consp where) |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
130 (let ((tem (aref regs (car where))) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
131 (value (logand value 255))) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
132 (aset regs |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
133 (car where) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
134 (if (zerop (cdr where)) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
135 (logior (logand tem 65280) value) |
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
136 (logior (logand tem 255) (lsh value 8)))))) |
5443 | 137 ((numberp where) |
7256
0f06f87f3c3b
(set-register-value): Setting the high byte of a
Richard M. Stallman <rms@gnu.org>
parents:
7087
diff
changeset
|
138 (aset regs where (logand value 65535)))))) |
5443 | 139 regs) |
140 | |
141 (defsubst intdos (regs) | |
142 (int86 33 regs)) | |
143 | |
144 ;;; Fix interface to (X-specific) mouse.el | |
145 (defalias 'window-frame 'ignore) | |
146 (defalias 'x-set-selection 'ignore) | |
147 (fset 'x-get-selection '(lambda (&rest rest) "")) | |
148 (fmakunbound 'font-menu-add-default) | |
149 (global-unset-key [C-down-mouse-1]) | |
150 (global-unset-key [C-down-mouse-2]) | |
151 (global-unset-key [C-down-mouse-3]) |