Function: time-stamp-filtered-buffer-file-name
time-stamp-filtered-buffer-file-name is a byte-compiled function
defined in time-stamp.el.gz.
Signature
(time-stamp-filtered-buffer-file-name TYPE)
Documentation
Return a printable string representing the buffer file name.
Non-graphic characters are replaced by ?. TYPE is :absolute for the full name or :nondirectory for base name only.
Source Code
;; Defined in /usr/src/emacs/lisp/time-stamp.el.gz
(defun time-stamp-filtered-buffer-file-name (type)
"Return a printable string representing the buffer file name.
Non-graphic characters are replaced by ?. TYPE is :absolute
for the full name or :nondirectory for base name only."
(declare (ftype (function ((member :absolute :nondirectory)) string)))
(let ((file-name buffer-file-name)
(safe-character-filter
(lambda (chr)
(let ((category (get-char-code-property chr 'general-category)))
(if (or
;; Letter, Mark, Number, Punctuation, or Symbol
(memq (aref (symbol-name category) 0) '(?L ?M ?N ?P ?S))
;; spaces of various widths, but not ctrl chars like CR or LF
(eq category 'Zs))
chr
;; substitute "?" for format or control character
??)))))
(when (eq type :nondirectory)
(setq file-name (file-name-nondirectory file-name)))
(apply #'string (mapcar safe-character-filter file-name))))