comparison lisp/arc-mode.el @ 16290:583e730756ef

(archive-mode, archive-extract, archive-check-dos) (archive-write-file-member): Set buffer-file-type only if default-buffer-file-type is bound. (buffer-file-type): Don't make this buffer-local or permanent. Just don't mess with it.
author Richard M. Stallman <rms@gnu.org>
date Sun, 22 Sep 1996 22:54:58 +0000
parents 83f275dcd93a
children d62ef382bb03
comparison
equal deleted inserted replaced
16289:38aee5b6ac73 16290:583e730756ef
234 234
235 (defvar archive-subfile-mode nil "*Non-nil in archive member buffers.") 235 (defvar archive-subfile-mode nil "*Non-nil in archive member buffers.")
236 (make-variable-buffer-local 'archive-subfile-mode) 236 (make-variable-buffer-local 'archive-subfile-mode)
237 (put 'archive-subfile-mode 'permanent-local t) 237 (put 'archive-subfile-mode 'permanent-local t)
238 238
239 ;; buffer-file-type is a per-buffer variable in the msdog configuration
240 (if (boundp 'buffer-file-type) nil
241 (defvar buffer-file-type nil
242 "*Nil for dos-style text file, non-nil otherwise.")
243 (make-variable-buffer-local 'buffer-file-type)
244 (put 'buffer-file-type 'permanent-local t)
245 (setq-default buffer-file-type nil))
246
247 (defvar archive-subfile-dos nil 239 (defvar archive-subfile-dos nil
248 "Negation of `buffer-file-type' which see.") 240 "Negation of `buffer-file-type', which see.")
249 (make-variable-buffer-local 'archive-subfile-dos) 241 (make-variable-buffer-local 'archive-subfile-dos)
250 (put 'archive-subfile-dos 'permanent-local t) 242 (put 'archive-subfile-dos 'permanent-local t)
251 243
252 (defvar archive-files nil "Vector of file descriptors. Each descriptor is 244 (defvar archive-files nil "Vector of file descriptors. Each descriptor is
253 a vector of [ext-file-name int-file-name case-fiddled mode ...]") 245 a vector of [ext-file-name int-file-name case-fiddled mode ...]")
434 ;; Real file contents is binary 426 ;; Real file contents is binary
435 (make-local-variable 'require-final-newline) 427 (make-local-variable 'require-final-newline)
436 (setq require-final-newline nil) 428 (setq require-final-newline nil)
437 (make-local-variable 'enable-local-variables) 429 (make-local-variable 'enable-local-variables)
438 (setq enable-local-variables nil) 430 (setq enable-local-variables nil)
439 (setq buffer-file-type t) 431 (if (boundp 'default-buffer-file-type)
432 (setq buffer-file-type t))
440 433
441 (make-local-variable 'archive-read-only) 434 (make-local-variable 'archive-read-only)
442 (setq archive-read-only (not (file-writable-p (buffer-file-name)))) 435 (setq archive-read-only (not (file-writable-p (buffer-file-name))))
443 436
444 ;; Should we use a local copy when accessing from outside Emacs? 437 ;; Should we use a local copy when accessing from outside Emacs?
735 (make-local-variable 'archive-superior-buffer) 728 (make-local-variable 'archive-superior-buffer)
736 (setq archive-superior-buffer archive-buffer) 729 (setq archive-superior-buffer archive-buffer)
737 (make-local-variable 'local-write-file-hooks) 730 (make-local-variable 'local-write-file-hooks)
738 (add-hook 'local-write-file-hooks 'archive-write-file-member) 731 (add-hook 'local-write-file-hooks 'archive-write-file-member)
739 (setq archive-subfile-mode descr) 732 (setq archive-subfile-mode descr)
740 (setq archive-subfile-dos nil 733 (setq archive-subfile-dos nil)
741 buffer-file-type t) 734 (if (boundp 'default-buffer-file-type)
735 (setq buffer-file-type t))
742 (if (fboundp extractor) 736 (if (fboundp extractor)
743 (funcall extractor archive ename) 737 (funcall extractor archive ename)
744 (archive-*-extract archive ename (symbol-value extractor))) 738 (archive-*-extract archive ename (symbol-value extractor)))
745 (if archive-dos-members (archive-check-dos)) 739 (if archive-dos-members (archive-check-dos))
746 (goto-char (point-min)) 740 (goto-char (point-min))
850 (widen) 844 (widen)
851 (save-excursion 845 (save-excursion
852 (goto-char (point-min)) 846 (goto-char (point-min))
853 (setq archive-subfile-dos 847 (setq archive-subfile-dos
854 (or force (not (search-forward-regexp "[^\r]\n" nil t)))) 848 (or force (not (search-forward-regexp "[^\r]\n" nil t))))
855 (setq buffer-file-type (not archive-subfile-dos)) 849 (if (boundp 'default-buffer-file-type)
850 (setq buffer-file-type (not archive-subfile-dos)))
856 (if archive-subfile-dos 851 (if archive-subfile-dos
857 (let ((modified (buffer-modified-p))) 852 (let ((modified (buffer-modified-p)))
858 (buffer-disable-undo (current-buffer)) 853 (buffer-disable-undo (current-buffer))
859 (goto-char (point-min)) 854 (goto-char (point-min))
860 (while (search-forward "\r\n" nil t) 855 (while (search-forward "\r\n" nil t)
874 (progn 869 (progn
875 (setq buffer-undo-list t) 870 (setq buffer-undo-list t)
876 (while (search-forward "\n" nil t) 871 (while (search-forward "\n" nil t)
877 (replace-match "\r\n")) 872 (replace-match "\r\n"))
878 (setq archive-subfile-dos nil) 873 (setq archive-subfile-dos nil)
879 (setq buffer-file-type t) 874 (if (boundp 'default-buffer-file-type)
875 (setq buffer-file-type t))
880 ;; OK, we're now have explicit ^M^Js -- save and re-unixfy 876 ;; OK, we're now have explicit ^M^Js -- save and re-unixfy
881 (archive-write-file-member)) 877 (archive-write-file-member))
882 (progn 878 (progn
883 (archive-check-dos t) 879 (archive-check-dos t)
884 (setq buffer-undo-list undo-list)))) 880 (setq buffer-undo-list undo-list))))