Mercurial > emacs
comparison lisp/dos-w32.el @ 24658:7de5cc79a8b4
(file-name-buffer-file-type-alist): Remove various
file extension regexps which aren't necessarily binary files.
author | Andrew Innes <andrewi@gnu.org> |
---|---|
date | Sun, 02 May 1999 09:36:07 +0000 |
parents | ef4a540c34ff |
children | 76764b2157af |
comparison
equal
deleted
inserted
replaced
24657:5b211965b2b9 | 24658:7de5cc79a8b4 |
---|---|
44 | 44 |
45 ;; For distinguishing file types based upon suffixes. | 45 ;; For distinguishing file types based upon suffixes. |
46 (defvar file-name-buffer-file-type-alist | 46 (defvar file-name-buffer-file-type-alist |
47 '( | 47 '( |
48 ("[:/].*config.sys$" . nil) ; config.sys text | 48 ("[:/].*config.sys$" . nil) ; config.sys text |
49 ("\\.elc$" . t) ; emacs stuff | 49 ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|bin\\|ico\\|pif\\|class\\)$" . t) |
50 ("\\.\\(obj\\|exe\\|com\\|lib\\|sym\\|sys\\|chk\\|out\\|bin\\|ico\\|pif\\|class\\)$" . t) | |
51 ; MS-Dos stuff | 50 ; MS-Dos stuff |
52 ("\\.\\(dll\\|drv\\|cpl\\|scr\\vbx\\|386\\|vxd\\|fon\\|fnt\\|fot\\|ttf\\|grp\\)$" . t) | 51 ("\\.\\(dll\\|drv\\|386\\|vxd\\|fon\\|fnt\\|fot\\|ttf\\|grp\\)$" . t) |
53 ; Windows stuff | 52 ; Windows stuff |
54 ("\\.\\(hlp\\|bmp\\|wav\\|avi\\|mpg\\|jpg\\|tif\\|mov\\|au\\)" . t) | 53 ("\\.\\(bmp\\|wav\\|avi\\|mpg\\|jpg\\|tif\\|mov\\|au\\)" . t) |
55 ; known binary data files | 54 ; known binary data files |
56 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t) | 55 ("\\.\\(arc\\|zip\\|pak\\|lzh\\|zoo\\)$" . t) |
57 ; Packers | 56 ; Packers |
58 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\|jar\\)$" . t) | 57 ("\\.\\(a\\|o\\|tar\\|z\\|gz\\|taz\\|jar\\)$" . t) |
59 ; Unix stuff | 58 ; Unix stuff |
248 (delete (untranslated-canonical-name filesystem) | 247 (delete (untranslated-canonical-name filesystem) |
249 untranslated-filesystem-list))) | 248 untranslated-filesystem-list))) |
250 | 249 |
251 ;;; Support for printing under DOS/Windows, see lpr.el and ps-print.el. | 250 ;;; Support for printing under DOS/Windows, see lpr.el and ps-print.el. |
252 | 251 |
252 (defvar direct-print-region-use-command-dot-com t | |
253 "*Control whether command.com is used to print on Windows 9x.") | |
254 | |
253 ;; Function to actually send data to the printer port. | 255 ;; Function to actually send data to the printer port. |
254 ;; Supports writing directly, and using various programs. | 256 ;; Supports writing directly, and using various programs. |
255 (defun direct-print-region-helper (printer | 257 (defun direct-print-region-helper (printer |
256 start end | 258 start end |
257 lpr-prog | 259 lpr-prog |
258 delete-text buf display | 260 delete-text buf display |
259 rest) | 261 rest) |
260 (let* ((directory-sep-char ?\\) ; expand file names in DOS format | 262 (let* (;; Ignore case when matching known external program names. |
261 ;; Ignore case when matching known external program names. | |
262 (case-fold-search t) | 263 (case-fold-search t) |
263 ;; Convert / to \ in printer name, for sake of external programs. | 264 ;; Convert / to \ in printer name, for sake of external programs. |
264 (printer | 265 (printer |
265 (if (stringp printer) | 266 (if (stringp printer) |
266 (subst-char-in-string ?/ ?\\ printer) | 267 (subst-char-in-string ?/ ?\\ printer) |
270 (let ((safe-dirs (list "c:/" (getenv "windir") (getenv "TMPDIR")))) | 271 (let ((safe-dirs (list "c:/" (getenv "windir") (getenv "TMPDIR")))) |
271 (while (not (file-attributes (car safe-dirs))) | 272 (while (not (file-attributes (car safe-dirs))) |
272 (setq safe-dirs (cdr safe-dirs))) | 273 (setq safe-dirs (cdr safe-dirs))) |
273 (car safe-dirs))) | 274 (car safe-dirs))) |
274 (tempfile | 275 (tempfile |
275 (make-temp-name | 276 (subst-char-in-string |
276 (expand-file-name "EP" (getenv "TMPDIR")))) | 277 ?/ ?\\ |
278 (make-temp-name | |
279 (expand-file-name "EP" (getenv "TMPDIR"))))) | |
277 ;; capture output for diagnosis | 280 ;; capture output for diagnosis |
278 (errbuf (list (get-buffer-create " *print-region-helper*") t))) | 281 (errbuf (list (get-buffer-create " *print-region-helper*") t))) |
279 ;; It seems that we must be careful about the directory name that | 282 ;; It seems that we must be careful about the directory name that |
280 ;; gets added to the printer port name by write-region when using | 283 ;; gets added to the printer port name by write-region when using |
281 ;; the standard "PRN" or "LPTx" ports, because the write can fail if | 284 ;; the standard "PRN" or "LPTx" ports, because the write can fail if |
282 ;; the directory is on a network drive. The same is true when | 285 ;; the directory is on a network drive. The same is true when |
283 ;; asking command.com to copy the file. | 286 ;; asking command.com to copy the file. |
284 ;; No action is needed for UNC printer names, which is just as well | 287 ;; No action is needed for UNC printer names, which is just as well |
285 ;; because `expand-file-name' doesn't support UNC names on MS-DOS. | 288 ;; because `expand-file-name' doesn't support UNC names on MS-DOS. |
286 (if (and (stringp printer) (not (string-match "^\\\\" printer))) | 289 (if (and (stringp printer) (not (string-match "^\\\\" printer))) |
287 (setq printer (expand-file-name printer safe-dir))) | 290 (setq printer |
291 (subst-char-in-string ?/ ?\\ (expand-file-name printer safe-dir)))) | |
288 ;; Handle known programs specially where necessary. | 292 ;; Handle known programs specially where necessary. |
289 (unwind-protect | 293 (unwind-protect |
290 (cond | 294 (cond |
291 ;; nprint.exe is the standard print command on Netware | 295 ;; nprint.exe is the standard print command on Netware |
292 ((string-match "^nprint\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) | 296 ((string-match "^nprint\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) |
321 ;; we are supposed to append to an existing (non-empty) file, | 325 ;; we are supposed to append to an existing (non-empty) file, |
322 ;; to work around a bug in Windows 9x that prevents Win32 | 326 ;; to work around a bug in Windows 9x that prevents Win32 |
323 ;; programs from accessing LPT ports reliably. | 327 ;; programs from accessing LPT ports reliably. |
324 ((and (eq system-type 'windows-nt) | 328 ((and (eq system-type 'windows-nt) |
325 (getenv "winbootdir") | 329 (getenv "winbootdir") |
330 ;; Allow cop-out so command.com isn't invoked | |
331 direct-print-region-use-command-dot-com | |
326 ;; file-attributes fails on LPT ports on Windows 9x but | 332 ;; file-attributes fails on LPT ports on Windows 9x but |
327 ;; not on NT, so handle both cases for safety. | 333 ;; not on NT, so handle both cases for safety. |
328 (eq (or (nth 7 (file-attributes printer)) 0) 0)) | 334 (eq (or (nth 7 (file-attributes printer)) 0) 0)) |
329 (write-region start end tempfile nil 0) | 335 (write-region start end tempfile nil 0) |
330 (let ((w32-quote-process-args nil)) | 336 (let ((w32-quote-process-args nil)) |