From: Kai Gro?j. <ka...@us...> - 2002-01-05 12:28:00
|
Update of /cvsroot/tramp/tramp/lisp In directory usw-pr-cvs1:/tmp/cvs-serv9989/tramp/lisp Modified Files: ChangeLog tramp.el Log Message: (tramp-split-string): New compat function. (tramp-handle-file-truename): Use it. Index: ChangeLog =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/ChangeLog,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** ChangeLog 2002/01/04 17:55:12 2.63 --- ChangeLog 2002/01/05 12:27:57 2.64 *************** *** 1,2 **** --- 1,7 ---- + 2002-01-05 Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> + + * tramp.el (tramp-split-string): New compat function. + (tramp-handle-file-truename): Use it. + 2002-01-04 Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> Index: tramp.el =================================================================== RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -d -r2.66 -r2.67 *** tramp.el 2002/01/04 17:55:24 2.66 --- tramp.el 2002/01/05 12:27:57 2.67 *************** *** 1370,1374 **** (host (tramp-file-name-host v)) (path (tramp-file-name-path v)) ! (steps (split-string path "/")) (thisstep nil) (numchase 0) --- 1370,1374 ---- (host (tramp-file-name-host v)) (path (tramp-file-name-path v)) ! (steps (tramp-split-string path "/")) (thisstep nil) (numchase 0) *************** *** 1403,1408 **** (setq steps (if (file-name-absolute-p symlink-target) ! (split-string symlink-target "/") ! (append (split-string symlink-target "/") steps)))) (t ;; It's a file. --- 1403,1408 ---- (setq steps (if (file-name-absolute-p symlink-target) ! (tramp-split-string symlink-target "/") ! (append (tramp-split-string symlink-target "/") steps)))) (t ;; It's a file. *************** *** 4671,4674 **** --- 4671,4685 ---- "`dos', `unix', or `mac'")))))) (t (error "Can't change EOL conversion -- is MULE missing?")))) + + (defun tramp-split-string (string pattern) + "Like `split-string' but omit empty strings. + In Emacs, (split-string \"/foo/bar\" \"/\") returns (\"foo\" \"bar\"). + This is, the first, empty, element is omitted. In XEmacs, the first + element is not omitted. + + Note: this function has been written for `tramp-handle-file-truename'. + If you want to use it for something else, you'll have to check whether + it does the right thing." + (delete "" (split-string string pattern))) ;; ------------------------------------------------------------ |