Function: nnheader-translate-file-chars

nnheader-translate-file-chars is a byte-compiled function defined in nnheader.el.gz.

Signature

(nnheader-translate-file-chars FILE &optional FULL)

Documentation

Translate FILE into something that can be a file name.

If FULL, translate everything.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnheader.el.gz
(defun nnheader-translate-file-chars (file &optional full)
  "Translate FILE into something that can be a file name.
If FULL, translate everything."
  (if (null nnheader-file-name-translation-alist)
      ;; No translation is necessary.
      file
    (let* ((i 0)
	   trans leaf path len)
      (if full
	  ;; Do complete translation.
	  (setq leaf (copy-sequence file)
		path ""
		i (if (and (< 1 (length leaf)) (eq ?: (aref leaf 1)))
		      2 0))
	;; We translate -- but only the file name.  We leave the directory
	;; alone.
	(setq leaf (file-name-nondirectory file)
	      path (file-name-directory file)))
      (setq len (length leaf))
      (while (< i len)
	(when (setq trans (cdr (assq (aref leaf i)
				     nnheader-file-name-translation-alist)))
	  (aset leaf i trans))
	(cl-incf i))
      (concat path leaf))))