home *** CD-ROM | disk | FTP | other *** search
- MS-DOS-SPECIFIC FEATURES OF WIN-EMACS
-
-
- A. FILE TYPE (TEXT OR BINARY)
-
- The standard format for text files in MS-DOS is to signal the end of a
- line with two characters, CR (ASCII 13) and LF (ASCII 10), and to mark
- the end of the file with a ^Z character. It is desirable to be able
- to edit files that follow these conventions; however, in order to edit
- binary files (such as .EXE files), it is important to be able to
- specify exactly which bytes are written out to the file. To this end,
- Win-Emacs provides two modes for editing files, TEXT TRANSLATION MODE
- and BINARY TRANSLATION MODE.
-
- When reading in a file in text translation mode, Win-Emacs treats each
- CR followed by a LF, and each LF character alone, as marking the end
- of a line, and stops reading the file when a ^Z character is
- encountered. When writing a file in text translation mode, Win-Emacs
- writes a CR followed by a LF at the end of each line, and writes a ^Z
- character at the end of the file.
-
- When reading in a file in binary translation mode, Win-Emacs simply
- treats each LF as marking the end of a line and continues reading
- until the physical end-of-file is encountered. When writing out a
- file in binary translation mode, Win-Emacs writes a LF at the end of
- each line and does not write a ^Z at the end of a file. If you read
- in a text file in binary translation mode, you will likely see a ^M
- (CR) character at the end of each line.
-
- Every buffer has its own translation-mode setting (also known as the
- "file type"). This value is indicated in the modeline: for example,
-
- --**-Emacs: demacs.tex (T:Texinfo)--42%---------------
- ^
- indicates that the file "demacs.tex" is being edited in Texinfo mode and
- text translation mode (notice the "T" before the colon; this would be "B"
- for binary translation mode).
-
- Win-Emacs determines the translation mode for a file according to the
- file's name, and sets the file type of a buffer accordingly when a file
- is visited and a new buffer is created for this file, or when a file is
- read into an existing buffer. The buffer's file type can also be set
- manually using "set-file-type". The file type for a buffer can be
- determined by reading the buffer-local variable "file-type".
-
- Win-Emacs maintains an association list of filename patterns and associated
- file types. Each filename pattern is a regular expression. At startup
- time, the file type association list is specified as follows:
-
- (defvar file-name-file-type-alist
- '(
- ("\\.elc$" . 1)
- ("\\.obj$" . 1)
- ("\\.exe$" . 1)
- ("\\.com$" . 1)
- ("\\.lib$" . 1)
- ("[:/].*config.sys" . 0)
- ("\\.sys$" . 1)
- ("\\.chk$" . 1)
- ("\\.dll$" . 1)
- ("\\.bmp$" . 1)
- ("\\.ico$" . 1)
- ("\\.res$" . 1)
- ("\\.pif$" . 1)
- ("\\.sym$" . 1)
- ("\\.scr$" . 1)
- ("\\.fon$" . 1)
- ("\\.fot$" . 1)
- ("\\.ttf$" . 1)
- ))
-
- where "1" means binary and "0" means text. This specifies common
- binary-file extensions as referring to binary files, with an exception
- made for CONFIG.SYS. When multiple entries in the association list
- match, Win-Emacs takes the first matching one. If no entries match,
- Win-Emacs uses the value in the variable "default-file-type". You can
- add an entry to the end of the association list using
- "define-file-name-file-type".
-
- The function "find-file-type-from-file-name" determines the file type
- for a particular file, according to the procedure outlined above. This
- function is called inside of primitive function "insert-file-contents"
- (when reading an existing file) or from the function
- "find-file-not-found-set-file-type" (when visiting a non-existent file);
- this latter function is appended to the "find-file-not-found-hooks"
- variable (a list of functions to be called when visiting a non-existent
- file) by the startup code.
-
-
- ## Buffer-local variable: file-type
- Specifies the file type of the buffer.
- `0'
- Text mode translation.
- `1'
- Binary mode translation.
-
- ## Command: set-file-type TYPE &optional BUFFER
- This function sets buffer-local `file-type' variable of BUFFER to
- TYPE. The argument BUFFER defaults to the current buffer. The value
- of TYPE is one of following.
- `0' or `'text' or `"text"'
- Specify the buffer's file type as text mode.
- `1' or `'binary' or `"binary"'
- Specify the buffer's file type as binary mode.
-
- ## Global variable: default-file-type
- The value of this global variable is the default value of
- buffer-local `file-type' variable.
-
- ## Command: set-default-file-type TYPE
- This function sets the value of `default-file-type' variable to
- TYPE. The value of TYPE is one of following.
- `0' or `'text' or `"text"'
- Specify the buffer's file type as text mode, by default.
- `1' or `'binary' or `"binary"'
- Specify the buffer's file type as binary mode, by default.
-
- ## Function: define-file-name-file-type FILENAME TYPE
- This function defines the file type associated with a file name.
- FILENAME is a regular expression or `nil'. `nil' matches any file
- name. TYPE is the file type.
-
- ## Function: find-file-type-from-file-name FILENAME
- This function returns the file type which is associated with FILENAME
- by the `define-file-name-file-type' function. If no file type
- is defined, this returns the value of `default-file-type'.
-
-
-
-
- B. GENERATING 8086 SOFTWARE INTERRUPTS
-
- You can generate an 8086 software interrupt using "int86". Use this
- carefully.
-
- One of the arguments to this function is an instance of a special "register"
- type, holding the values of all registers upon entry and exit. Functions
- are provided to manipulate register types.
-
- For example, the following C function, which gets the current disk number:
-
- int
- GetDisk ()
- {
- union REGS regs;
- regs.h.ah = 0x19; /* 25 */
- int86 (0x21 /* 33 */, ®s, ®s);
- return regs.h.al;
- }
-
- may be written in Win-Emacs as follows:
-
- (defun get-disk ()
- (let ((regs (make-register)))
- (set-register-value regs 'ah 25) ; 0x19
- (int86 33 regs) ; 0x21
- (register-value regs 'al)))
-
-
- ## Function: make-register
- Generate an instance of register type. This is a set of register values
- and is passed to the `int86' function to specify the registers upon
- invocation of the interrupt.
-
- ## Function: register-value REGISTER NAME
- Get the value of REGISTER's NAME. NAME is one of the following.
-
- `'ax'
- `ax' register
- `'bx'
- `bx' register
- `'cx'
- `cx' register
- `'dx'
- `dx' register
- `'si'
- `si' register
- `'di'
- `di' register
- `'cflag'
- carry flag
- `'flags'
- flag register
-
- or
-
- `'al'
- lower byte of `ax' register
- `'ah'
- upper byte of `ax' register
- `'bl'
- lower byte of `bx' register
- `'bh'
- upper byte of `bx' register
- `'cl'
- lower byte of `cx' register
- `'ch'
- upper byte of `cx' register
- `'dl'
- lower byte of `dx' register
- `'dh'
- upper byte of `dx' register
-
- ## Function: set-register-value REGISTER NAME VALUE
- Set REGISTER's NAME to VALUE. VALUE is an unsigned integer.
-
- ## Function: int86 INTNO REGISTER
- Generate 8086 software interrupt of number INTNO with REGISTER (an
- instance of register type) specifying the registers upon invocation
- of the interrupt. An instance of register type is returned, specifying
- the register values upon return from the interrupt.
-
-
-
- C. MS-DOS FILENAMES
-
- In MS-DOS, filenames are separated into two parts, called the "base" and the
- "extension" and separated by a period. The base is limited to 8 characters
- and the extension to 3. Filenames are not case-sensitive. Win-Emacs
- automatically converts all filenames to lowercase and truncates their names
- to follow MS-DOS constraints.
-
-
- C.1 Backup files
-
- Backup files, named in Unix by appending a ~, are named in Win-Emacs as
- follows:
-
- 1) If the extension is fewer than 3 characters, a ~ is added to the extension.
- 2) If the extension if 3 characters long, the last character is replaced by
- a ~.
-
- Numeric backups are not allowed in Win-Emacs due to the tightness of
- MS-DOS filename constraints.
-
-
- C.2 Auto-save files
-
- Auto-save files, named in Unix by appending and prepending a #, are named
- in Win-Emacs as follows:
-
- 1) A # is added to the beginning of the base. If the base is already 8
- characters, the last character is truncated.
- 2) If the extension is fewer than 3 characters, a # is added to it; otherwise
- the last character is replaced by a #.
-
-
- C.3 Special filename completion feature
-
- Normally, pressing TAB when typing in a partial filename will complete the
- filename. As a shortcut to specifying a new filename on a different drive,
- you can simply type the drive letter and partial filename after the existing
- partial filename and then press TAB. For example, you type C-x C-f to
- visit a file, and are prompted as follows:
-
- Find file: c:/tools/emacs/
-
- At this point, if you type "d:/confi" and press TAB, the display becomes:
-
- a:/tools/emacs/d:confi[TAB] -> d:/config.sys [sole complete]
-
- (assuming the file "config.sys" exists in d:/ and no other files
- beginning with "confi" exist in the same directory.)
-
-
-
- D. LIMITATIONS
-
-
- D.1 Interrupting running Lisp code
-
- C-g cannot currently interrupt running Lisp code. Thus, a form like this:
-
- (while t ())
-
- cannot be interrupted. Instead, you should write:
-
- (while (not (input-pending-p)) ())
-
-
- D.2 Subprocesses
-
- Subprocess support is not currently implemented. Support for synchronous
- subprocesses will likely be added in a near release. Support for
- asynchronous processes is difficult, if not impossible, under Windows.
-