From 34dac9b4c3436999e6245d663adb0d71e717600d Mon Sep 17 00:00:00 2001 From: yamaoka Date: Wed, 1 Sep 1999 23:53:18 +0000 Subject: [PATCH] (convert-standard-filename): New function. --- poe.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/poe.el b/poe.el index 2a1b19c..746b346 100644 --- a/poe.el +++ b/poe.el @@ -368,6 +368,29 @@ Value is nil if OBJECT is not a buffer or if it has been killed. (cons 'progn body) (list 'select-window 'save-selected-window-window)))) +(autoload (function filename-maybe-truncate-by-size) "filename") + +(defun-maybe-cond convert-standard-filename (filename) + "Convert a standard file's name to something suitable for the current OS. +This function's standard definition is trivial; it just returns the argument. +However, on some systems, the function is redefined +with a definition that really does change some file names. +Under `windows-nt' or `ms-dos', it refers `filename-replacement-alist' and +`filename-limit-length' for the basic filename and each parent directory name. +\[Emacs 19.31 emulating function]" + ((memq system-type '(windows-nt ms-dos)) + (let* ((names (split-string filename "/")) + (drive-name (car names)) + (filter (function (lambda (string) + (filename-maybe-truncate-by-size + (filename-special-filter string)))))) + (concat (if (and (string-match "^[^/]:$" drive-name) + (>= (length names) 2)) + drive-name + (funcall filter drive-name)) + "/" + (mapconcat filter (cdr names) "/")))) + (t filename)) ;;; @ Emacs 20.1 emulation ;;; -- 1.7.10.4