1 ;;; dos-fns.el --- MS-Dos specific functions.
3 ;; Copyright (C) 1991, 1993 Free Software Foundation, Inc.
5 ;; Maintainer: Morten Welinder (terra@diku.dk)
8 ;; This file is part of GNU Emacs.
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)
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.
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.
26 ;; Part of this code is taken from (or derived from) demacs.
30 (setq-default mode-line-format
33 'mode-line-buffer-identification
38 'mode-name 'mode-line-process 'minor-mode-alist
41 (purecopy '(line-number-mode "L%l--"))
42 (purecopy '(-3 . "%p"))
45 (defvar file-name-buffer-file-type-alist
47 ("[:/].*config.sys$" . nil) ; config.sys text
48 ("\\.elc$" . t) ; emacs stuff
49 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\)$" . t)
51 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t)
53 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\)$" . t)
56 ; Borland Pascal stuff
60 "*Alist for distinguishing text files from binary files.
61 Each element has the form (REGEXP . TYPE), where REGEXP is matched
62 against the file name, and TYPE is nil for text, t for binary.")
64 (defun find-buffer-file-type (filename)
65 (let ((alist file-name-buffer-file-type-alist)
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))
74 (setq alist (cdr alist))))
76 (cond((memq code '(nil t)) code)
77 ((and (symbolp code) (fboundp code))
78 (funcall code filename)))
79 default-buffer-file-type)))
81 (defun find-file-binary (filename)
82 "Visit file FILENAME and treat it as binary."
83 (interactive "FFind file binary: ")
84 (let ((file-name-buffer-file-type-alist '(("" . t))))
85 (find-file filename)))
87 (defun find-file-text (filename)
88 "Visit file FILENAME and treat it as a text file."
89 (interactive "FFind file text: ")
90 (let ((file-name-buffer-file-type-alist '(("" . nil))))
91 (find-file filename)))
93 (defun find-file-not-found-set-buffer-file-type ()
95 (set-buffer (current-buffer))
96 (setq buffer-file-type (find-buffer-file-type (buffer-file-name))))
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)
102 ;;; We use the Emacs directory, not /usr/local
103 (setq Info-default-directory-list (list "c:/emacs/info"))
105 (defvar msdos-shells '("command.com" "4dos.com" "ndos.com")
106 "*List of shells that use `/c' instead of `-c' and a backslashed command.")
108 (defconst register-name-alist
109 '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5)
110 (cflag . 6) (flags . 7)
111 (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0))
112 (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1))))
114 (defun make-register ()
117 (defun register-value (regs name)
118 (let ((where (cdr (assoc name register-name-alist))))
120 (let ((tem (aref regs (car where))))
121 (if (zerop (cdr where))
128 (defun set-register-value (regs name value)
131 (let ((where (cdr (assoc name register-name-alist))))
133 (let ((tem (aref regs (car where)))
134 (value (logand value 255)))
137 (if (zerop (cdr where))
138 (logior (logand tem 65280) value)
139 (logior (logand tem 255) (lsh value 8))))))
141 (aset regs where (logand value 65535))))))
144 (defsubst intdos (regs)
147 ;;; Fix interface to (X-specific) mouse.el
148 (defalias 'window-frame 'ignore)
149 (defalias 'x-set-selection 'ignore)
150 (fset 'x-get-selection '(lambda (&rest rest) ""))
151 (fset 'frame-parameters 'ignore)
152 (fmakunbound 'font-menu-add-default)
153 (global-unset-key [C-down-mouse-1])
154 (global-unset-key [C-down-mouse-2])
155 (global-unset-key [C-down-mouse-3])