Function: tramp-find-file-name-coding-system-alist

tramp-find-file-name-coding-system-alist is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-find-file-name-coding-system-alist FILENAME TMPNAME)

Documentation

Like find-operation-coding-system for Tramp filenames.

Tramp's insert-file-contents and write-region work over temporary file names. If file-coding-system-alist contains an expression, which matches more than the file name suffix, the coding system might not be determined. This function repairs it.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-find-file-name-coding-system-alist (filename tmpname)
  "Like `find-operation-coding-system' for Tramp filenames.
Tramp's `insert-file-contents' and `write-region' work over
temporary file names.  If `file-coding-system-alist' contains an
expression, which matches more than the file name suffix, the
coding system might not be determined.  This function repairs it."
  (let (result)
    (dolist (elt file-coding-system-alist (nreverse result))
      (when (and (consp elt) (string-match-p (car elt) filename))
	;; We found a matching entry in `file-coding-system-alist'.
	;; So we add a similar entry, but with the temporary file name
	;; as regexp.
	(push (cons (rx (literal tmpname)) (cdr elt)) result)))))