From 83f0d60e498c9cab59e098af6d9c403631ad645c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 19 Aug 2017 17:15:52 -0700 Subject: Don’t adjust CRLF in file names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/misc/gnus.texi (Non-ASCII Group Names): * etc/NEWS: * test/lisp/net/tramp-tests.el (tramp--test-utf8): Use utf-8-unix, not utf-8, for default-file-name-coding-system, so that CRLF in file names is left alone. * lisp/international/mule-cmds.el (set-default-coding-systems): Do not alter CRLF in file name coding systems. (prefer-coding-system): Ignore differences in CRLF processing when checking whether we used the user-specified file name coding system. * test/src/fileio-tests.el: New file. --- lisp/international/mule-cmds.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lisp') diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index ee31dea69ec..338ca6a6e3c 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el @@ -354,11 +354,12 @@ This also sets the following values: (if (eq system-type 'darwin) ;; The file-name coding system on Darwin systems is always utf-8. - (setq default-file-name-coding-system 'utf-8) + (setq default-file-name-coding-system 'utf-8-unix) (if (and (default-value 'enable-multibyte-characters) (or (not coding-system) (coding-system-get coding-system 'ascii-compatible-p))) - (setq default-file-name-coding-system coding-system))) + (setq default-file-name-coding-system + (coding-system-change-eol-conversion coding-system 'unix)))) (setq default-terminal-coding-system coding-system) ;; Prevent default-terminal-coding-system from converting ^M to ^J. (setq default-keyboard-coding-system @@ -414,7 +415,7 @@ To prefer, for instance, utf-8, say the following: (coding-system-change-eol-conversion base eol-type))) (set-default-coding-systems base) (if (called-interactively-p 'interactive) - (or (eq base default-file-name-coding-system) + (or (eq base (coding-system-type default-file-name-coding-system)) (message "The default value of `file-name-coding-system' was not changed because the specified coding system is not suitable for file names."))))) (defvar sort-coding-systems-predicate nil @@ -1797,9 +1798,9 @@ The default status is as follows: (set-default-coding-systems nil) (setq default-sendmail-coding-system 'iso-latin-1) - ;; On Darwin systems, this should be utf-8, but when this file is loaded - ;; utf-8 is not yet defined, so we set it in set-locale-environment instead. - (setq default-file-name-coding-system 'iso-latin-1) + ;; On Darwin systems, this should be utf-8-unix, but when this file is loaded + ;; that is not yet defined, so we set it in set-locale-environment instead. + (setq default-file-name-coding-system 'iso-latin-1-unix) ;; Preserve eol-type from existing default-process-coding-systems. ;; On non-unix-like systems in particular, these may have been set ;; carefully by the user, or by the startup code, to deal with the @@ -2722,7 +2723,7 @@ See also `locale-charset-language-names', `locale-language-names', (when (eq system-type 'darwin) ;; On Darwin, file names are always encoded in utf-8, no matter ;; the locale. - (setq default-file-name-coding-system 'utf-8) + (setq default-file-name-coding-system 'utf-8-unix) ;; macOS's Terminal.app by default uses utf-8 regardless of ;; the locale. (when (and (null window-system) -- cgit v1.2.3