*** files.el.~1.896.2.38.~ 2008-02-24 16:51:32.796875000 +0000 --- files.el 2008-02-25 23:54:34.618303900 +0000 *************** *** 4561,4575 **** (let ((buffer-name (buffer-name)) (limit 0) file-name) ! ;; Eliminate all slashes and backslashes by ! ;; replacing them with sequences that start with %. ;; Quote % also, to keep distinct names distinct. ! (while (string-match "[/\\%]" buffer-name limit) (let* ((character (aref buffer-name (match-beginning 0))) (replacement (cond ((eq character ?%) "%%") ((eq character ?/) "%+") ! ((eq character ?\\) "%-")))) (setq buffer-name (replace-match replacement t t buffer-name)) (setq limit (1+ (match-end 0))))) ;; Generate the file name. --- 4561,4593 ---- (let ((buffer-name (buffer-name)) (limit 0) file-name) ! ;; Eliminate all slashes, backslashes, wildcards and other ! ;; characters that are not valid in VFAT/NTFS filesystems. ;; Quote % also, to keep distinct names distinct. ! ;; We do this on all platforms, because even if we are not ! ;; running on DOS/Windows, the current directory may be on a ! ;; mounted VFAT filesystem, such as a USB memory stick. ! (while (string-match "[/\\%?*:<>|\"\000-\037]" buffer-name limit) (let* ((character (aref buffer-name (match-beginning 0))) (replacement (cond ((eq character ?%) "%%") ((eq character ?/) "%+") ! ((eq character ?\\) "%-") ! ((eq character ??) "%!") ! ((eq character ?*) "%#") ! ((eq character ?\") "%'") ! ((eq character ?<) "%(") ! ((eq character ?>) "%)") ! ((eq character ?|) "%_") ! ((eq character ?:) "%;") ! ;; Control characters. ^@ to ^Z match their standard ! ;; mappings (ie ^A is represented as %A) ! ((< character 27) (concat "%" (+ character ?@))) ! ;; The last few are a bit arbitrary, since the standard ! ;; notation uses invalid characters and characters we ! ;; have already used above. ! ((< character 32) ! (concat "%" (+ (- character 27) ?0)))))) (setq buffer-name (replace-match replacement t t buffer-name)) (setq limit (1+ (match-end 0))))) ;; Generate the file name.