summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-02-09 14:52:01 +0200
committerEli Zaretskii <eliz@gnu.org>2013-02-09 14:52:01 +0200
commit8549f9e89bd9288c4c709d183a5bf8f07dbeed3d (patch)
treed1c618cc8dd547322911fc5dab74b7a3235f6448 /lisp
parent2cdd55fc764336b5dee1e69842b9cc2d28976041 (diff)
downloademacs-8549f9e89bd9288c4c709d183a5bf8f07dbeed3d.tar.gz
emacs-8549f9e89bd9288c4c709d183a5bf8f07dbeed3d.tar.bz2
emacs-8549f9e89bd9288c4c709d183a5bf8f07dbeed3d.zip
Remove all references to buffer-file-type and related features.
src/xdisp.c (decode_mode_spec): Remove handling of %t. lisp/net/ange-ftp.el (ange-ftp-insert-file-contents): Don't reference buffer-file-type. lisp/mail/feedmail.el (feedmail-force-binary-write): Doc fix. (feedmail-run-the-queue, feedmail-dump-message-to-queue) (feedmail-send-it-immediately): Don't bind buffer-file-type, bind coding-system-for-write instead. lisp/jka-compr.el (jka-compr-write-region): Don't bind buffer-file-type. lisp/emacs-lisp/bytecomp.el (byte-compile-file): Don't bind buffer-file-type. lisp/files.el (file-name-buffer-file-type-alist): Remove defvar. (insert-file-contents-literally): Remove reference to file-name-buffer-file-type-alist. lisp/dos-w32.el (file-name-buffer-file-type-alist): Deprecate and make-obsolete. (find-buffer-file-type-match, find-buffer-file-type): Remove. (find-buffer-file-type-coding-system): Remove references to find-buffer-file-type-match, find-buffer-file-type, and buffer-file-type. Don't put find-buffer-file-type-coding-system into file-coding-system-alist. (find-file-binary, find-file-text): Bind coding-system-for-read instead of file-name-buffer-file-type-alist. lisp/erc/erc-dcc.el (erc-dcc-get-file): Don't reference buffer-file-type. doc/emacs/msdog.texi (Text and Binary): Delete the description of file-name-buffer-file-type-alist. doc/lispref/modes.texi (%-Constructs): Remove the description of %t. doc/lispref/nonascii.texi (MS-DOS File Types): Delete node. Fixes: debbugs:12989
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog31
-rw-r--r--lisp/arc-mode.el5
-rw-r--r--lisp/dos-w32.el90
-rw-r--r--lisp/emacs-lisp/bytecomp.el2
-rw-r--r--lisp/erc/ChangeLog4
-rw-r--r--lisp/erc/erc-dcc.el1
-rw-r--r--lisp/files.el3
-rw-r--r--lisp/jka-compr.el2
-rw-r--r--lisp/mail/feedmail.el23
-rw-r--r--lisp/net/ange-ftp.el6
10 files changed, 76 insertions, 91 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f5b6daf16d8..0712f9a1fc8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,34 @@
+2013-02-09 Eli Zaretskii <eliz@gnu.org>
+
+ * net/ange-ftp.el (ange-ftp-insert-file-contents): Don't reference
+ buffer-file-type.
+
+ * mail/feedmail.el (feedmail-force-binary-write): Doc fix.
+ (feedmail-run-the-queue, feedmail-dump-message-to-queue)
+ (feedmail-send-it-immediately): Don't bind buffer-file-type, bind
+ coding-system-for-write instead.
+
+ * jka-compr.el (jka-compr-write-region): Don't bind
+ buffer-file-type.
+
+ * emacs-lisp/bytecomp.el (byte-compile-file): Don't bind
+ buffer-file-type.
+
+ * files.el (file-name-buffer-file-type-alist): Remove defvar.
+ (insert-file-contents-literally): Remove reference to
+ file-name-buffer-file-type-alist.
+
+ * dos-w32.el (file-name-buffer-file-type-alist): Deprecate and
+ make-obsolete.
+ (find-buffer-file-type-match, find-buffer-file-type): Remove.
+ (find-buffer-file-type-coding-system): Remove references to
+ find-buffer-file-type-match, find-buffer-file-type, and
+ buffer-file-type.
+ Don't put find-buffer-file-type-coding-system into
+ file-coding-system-alist.
+ (find-file-binary, find-file-text): Bind coding-system-for-read
+ instead of file-name-buffer-file-type-alist.
+
2013-02-09 Tassilo Horn <tsdh@gnu.org>
* doc-view.el: Use (and prefer) soffice as default ODF->PDF
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 8849fb85244..4fc04b706b5 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -975,11 +975,6 @@ using `make-temp-file', and the generated name is returned."
(save-excursion
(funcall set-auto-coding-function
filename (- (point-max) (point-min)))))
- ;; dos-w32.el defines the function
- ;; find-buffer-file-type-coding-system for DOS/Windows
- ;; systems which preserves the coding-system of existing files.
- ;; (That function is called via file-coding-system-alist.)
- ;; Here, we want it to act as if the extracted file existed.
;; The following let-binding of file-name-handler-alist forces
;; find-file-not-found-set-buffer-file-coding-system to ignore
;; the file's name (see dos-w32.el).
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el
index 5866edfc3d6..d6788ffe028 100644
--- a/lisp/dos-w32.el
+++ b/lisp/dos-w32.el
@@ -37,7 +37,7 @@
;; Set the null device (for compile.el).
(setq null-device "NUL")
-;; For distinguishing file types based upon suffixes.
+;; For distinguishing file types based upon suffixes. DEPRECATED, DO NOT USE!
(defcustom file-name-buffer-file-type-alist
'(("[:/].*config.sys$" . nil) ; config.sys text
("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|bin\\|ico\\|pif\\|class\\)$" . t)
@@ -54,36 +54,18 @@
("\\.tp[ulpw]$" . t) ; borland Pascal stuff
("[:/]tags$" . nil) ; emacs TAGS file
)
- "Alist for distinguishing text files from binary files.
+ "Alist used in the past for distinguishing text files from binary files.
Each element has the form (REGEXP . TYPE), where REGEXP is matched
-against the file name, and TYPE is nil for text, t for binary."
+against the file name, and TYPE is nil for text, t for binary.
+
+This variable is deprecated, not used anywhere, and will soon be deleted."
:type '(repeat (cons regexp boolean))
:group 'dos-fns
:group 'w32)
-;; Return the pair matching filename on file-name-buffer-file-type-alist,
-;; or nil otherwise.
-(defun find-buffer-file-type-match (filename)
- (let ((alist file-name-buffer-file-type-alist)
- (found nil))
- (let ((case-fold-search t))
- (setq filename (file-name-sans-versions filename))
- (while (and (not found) alist)
- (if (string-match (car (car alist)) filename)
- (setq found (car alist)))
- (setq alist (cdr alist)))
- found)))
-
-;; Don't check for untranslated file systems here.
-(defun find-buffer-file-type (filename)
- (let ((match (find-buffer-file-type-match filename))
- (code))
- (if (not match)
- (default-value 'buffer-file-type)
- (setq code (cdr match))
- (cond ((memq code '(nil t)) code)
- ((and (symbolp code) (fboundp code))
- (funcall code filename))))))
+(make-obsolete-variable 'file-name-buffer-file-type-alist
+ 'file-coding-system-alist
+ "24.4")
(setq-default buffer-file-coding-system 'undecided-dos)
@@ -99,9 +81,6 @@ and whether the file exists:
If it matches in `untranslated-filesystem-list':
If the file exists: `undecided'
If the file does not exist: `undecided-unix'
- If it matches in `file-name-buffer-file-type-alist':
- If the match is t (for binary): `no-conversion'
- If the match is nil (for dos-text): `undecided-dos'
Otherwise:
If the file exists: `undecided'
If the file does not exist default value of `buffer-file-coding-system'
@@ -110,25 +89,23 @@ Note that the CAR of arguments to `insert-file-contents' operation could
be a cons cell of the form \(FILENAME . BUFFER\), where BUFFER is a buffer
into which the file's contents were already read, but not yet decoded.
-If operation is `write-region', the coding system is chosen based upon
-the value of `buffer-file-coding-system' and `buffer-file-type'. If
-`buffer-file-coding-system' is non-nil, its value is used. If it is
-nil and `buffer-file-type' is t, the coding system is `no-conversion'.
+If operation is `write-region', the coding system is chosen based
+upon the value of `buffer-file-coding-system'. If
+`buffer-file-coding-system' is non-nil, its value is used.
Otherwise, it is `undecided-dos'.
-The two most common situations are when DOS and Unix files are read
-and written, and their names do not match in
-`untranslated-filesystem-list' and `file-name-buffer-file-type-alist'.
-In these cases, the coding system initially will be `undecided'. As
-the file is read in the DOS case, the coding system will be changed to
-`undecided-dos' as CR/LFs are detected. As the file is read in the
-Unix case, the coding system will be changed to `undecided-unix' as
-LFs are detected. In both cases, `buffer-file-coding-system' will be
-set to the appropriate coding system, and the value of
-`buffer-file-coding-system' will be used when writing the file."
+The most common situation is when DOS and Unix files are read and
+written, and their names do not match in `untranslated-filesystem-list'.
+In these cases, the coding system initially will be `undecided'.
+As the file is read in the DOS case, the coding system will be
+changed to `undecided-dos' as CR/LFs are detected. As the file
+is read in the Unix case, the coding system will be changed to
+`undecided-unix' as LFs are detected. In both cases,
+`buffer-file-coding-system' will be set to the appropriate coding
+system, and the value of `buffer-file-coding-system' will be used
+when writing the file."
(let ((op (nth 0 command))
- (binary nil) (text nil)
(undecided nil) (undecided-unix nil)
target target-buf)
(cond ((eq op 'insert-file-contents)
@@ -144,15 +121,8 @@ set to the appropriate coding system, and the value of
(and (bufferp (cdr target))
(buffer-name (cdr target))))
(setq target (car target)))
- ;; First check for a file name that indicates
- ;; it is truly binary.
- (setq binary (find-buffer-file-type target))
- (cond (binary)
- ;; Next check for files that MUST use DOS eol conversion.
- ((find-buffer-file-type-match target)
- (setq text t))
- ;; For any other existing file, decide based on contents.
- ((or
+ (cond ((or
+ ;; For any existing file, decide based on contents.
(file-exists-p target)
;; If TARGET does not exist as a file, replace its
;; base name with TARGET-BUF and try again. This
@@ -167,9 +137,7 @@ set to the appropriate coding system, and the value of
;; Next check for a non-DOS file system.
((untranslated-file-p target)
(setq undecided-unix t)))
- (cond (binary '(no-conversion . no-conversion))
- (text '(undecided-dos . undecided-dos))
- (undecided-unix '(undecided-unix . undecided-unix))
+ (cond (undecided-unix '(undecided-unix . undecided-unix))
(undecided '(undecided . undecided))
(t (cons (default-value 'buffer-file-coding-system)
(default-value 'buffer-file-coding-system)))))
@@ -180,22 +148,18 @@ set to the appropriate coding system, and the value of
;; Normally this is used only in a non-file-visiting
;; buffer, because normally buffer-file-coding-system is non-nil
;; in a file-visiting buffer.
- (if buffer-file-type
- '(no-conversion . no-conversion)
- '(undecided-dos . undecided-dos)))))))
-
-(modify-coding-system-alist 'file "" 'find-buffer-file-type-coding-system)
+ '(undecided-dos . undecided-dos))))))
(defun find-file-binary (filename)
"Visit file FILENAME and treat it as binary."
(interactive "FFind file binary: ")
- (let ((file-name-buffer-file-type-alist '(("" . t))))
+ (let ((coding-system-for-read 'no-conversion))
(find-file filename)))
(defun find-file-text (filename)
"Visit file FILENAME and treat it as a text file."
(interactive "FFind file text: ")
- (let ((file-name-buffer-file-type-alist '(("" . nil))))
+ (let ((coding-system-for-read 'undecided-dos))
(find-file filename)))
(defun find-file-not-found-set-buffer-file-coding-system ()
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 4e002cfc8cb..280a1bbc2dd 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1795,8 +1795,6 @@ The value is non-nil if there were no errors, nil if errors."
(kill-emacs-hook
(cons (lambda () (ignore-errors (delete-file tempfile)))
kill-emacs-hook)))
- (if (memq system-type '(ms-dos 'windows-nt))
- (setq buffer-file-type t))
(write-region (point-min) (point-max) tempfile nil 1)
;; This has the intentional side effect that any
;; hard-links to target-file continue to
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index bbe551c735d..cc7624dee03 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,7 @@
+2013-02-09 Eli Zaretskii <eliz@gnu.org>
+
+ * erc-dcc.el (erc-dcc-get-file): Don't reference buffer-file-type.
+
2013-01-11 Dmitry Antipov <dmantipov@yandex.ru>
* erc-dcc.el (erc-dcc-send-file): Use point-min-marker.
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index c27bb629f9d..acb8febea80 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -942,7 +942,6 @@ filter and a process sentinel, and making the connection."
(set-buffer-multibyte nil))
(setq mode-line-process '(":%s")
- buffer-file-type t
buffer-read-only t)
(setq erc-dcc-file-name file)
diff --git a/lisp/files.el b/lisp/files.el
index 3bc3059c68f..9fca70d36f7 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1983,8 +1983,6 @@ Do you want to revisit the file normally now? ")
(after-find-file error (not nowarn)))
(current-buffer))))
-(defvar file-name-buffer-file-type-alist) ;From dos-w32.el.
-
(defun insert-file-contents-literally (filename &optional visit beg end replace)
"Like `insert-file-contents', but only reads in the file literally.
A buffer may be modified in several ways after reading into the buffer,
@@ -1996,7 +1994,6 @@ This function ensures that none of these modifications will take place."
(after-insert-file-functions nil)
(coding-system-for-read 'no-conversion)
(coding-system-for-write 'no-conversion)
- (file-name-buffer-file-type-alist '(("" . t)))
(inhibit-file-name-handlers
;; FIXME: Yuck!! We should turn insert-file-contents-literally
;; into a file operation instead!
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index ac81cf0d52d..5664a890cb1 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -332,8 +332,6 @@ There should be no more than seven characters after the final `/'."
(with-current-buffer temp-buffer
(let ((coding-system-for-write 'no-conversion))
- (if (memq system-type '(ms-dos windows-nt))
- (setq buffer-file-type t) )
(jka-compr-run-real-handler 'write-region
(list (point-min) (point-max)
filename
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 4305094611a..0502e7f9487 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -590,7 +590,7 @@ header is fiddled after the From: header is fiddled."
(defcustom feedmail-force-binary-write t
"If non-nil, force writing file as binary (this applies to queues and Fcc:).
On systems where there is a difference between binary and text files,
-feedmail will temporarily manipulate the value of `buffer-file-type'
+feedmail will temporarily manipulate the value of `coding-system-for-write'
to make the writing as binary. If nil, writing will be in text mode.
On systems where there is no distinction or where it is controlled by other
variables or other means, this option has no effect."
@@ -2016,7 +2016,6 @@ backup file names and the like)."
(setq buffer-offer-save nil)
(buffer-disable-undo blobby-buffer)
(insert-file-contents-literally maybe-file)
- (setq buffer-file-type t) ; binary
(goto-char (point-min))
;; if at least two line-endings with CRLF, translate the file
(if (looking-at ".*\r\n.*\r\n")
@@ -2334,7 +2333,10 @@ mapped to mostly alphanumerics for safety."
(setq filename buffer-file-name)
(setq filename (feedmail-create-queue-filename queue-directory)))
;; make binary file on DOS/Windows 95/Windows NT, etc
- (let ((buffer-file-type feedmail-force-binary-write))
+ (let ((coding-system-for-write
+ (if feedmail-force-binary-write
+ 'no-conversion
+ coding-system-for-write)))
(write-file filename))
;; convenient for moving from draft to q, for example
(if (and previous-buffer-file-name (or (not is-fqm) (not is-in-this-dir))
@@ -2571,26 +2573,27 @@ mapped to mostly alphanumerics for safety."
;; Re-insert and handle any Fcc fields (and, optionally,
;; any Bcc).
(when fcc
- (let ((old (default-value 'buffer-file-type)))
+ (let ((coding-system-for-write
+ (if (and (memq system-type '(ms-dos windows-nt))
+ feedmail-force-binary-write)
+ 'no-conversion
+ coding-system-for-write)))
(unwind-protect
(progn
- (setq-default buffer-file-type
- feedmail-force-binary-write)
(insert fcc)
(unless feedmail-nuke-bcc-in-fcc
(if bcc-holder (insert bcc-holder))
(if resent-bcc-holder
(insert resent-bcc-holder)))
-
+
(run-hooks 'feedmail-before-fcc-hook)
-
+
(when feedmail-nuke-body-in-fcc
(goto-char eoh-marker)
(if (natnump feedmail-nuke-body-in-fcc)
(forward-line feedmail-nuke-body-in-fcc))
(delete-region (point) (point-max)))
- (mail-do-fcc eoh-marker))
- (setq-default buffer-file-type old)))))
+ (mail-do-fcc eoh-marker))))))
;; User bailed out of one-last-look.
(if feedmail-queue-runner-is-active
(throw 'skip-me-q 'skip-me-q)
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 4f7d8092891..ea318ec3250 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -3297,7 +3297,6 @@ system TYPE.")
(name (ange-ftp-quote-string (nth 2 parsed)))
(temp (ange-ftp-make-tmp-name host))
(binary (ange-ftp-binary-file filename))
- (buffer-file-type buffer-file-type)
(abbr (ange-ftp-abbreviate-filename filename))
(coding-system-used last-coding-system-used)
size)
@@ -3322,10 +3321,7 @@ system TYPE.")
size
(nth 1 (ange-ftp-real-insert-file-contents
temp visit beg end replace))
- coding-system-used last-coding-system-used
- ;; override autodetection of buffer file type
- ;; to ensure buffer is saved in DOS format
- buffer-file-type binary)
+ coding-system-used last-coding-system-used)
(signal 'ftp-error
(list
"Opening input file:"