Mark Triggs <[EMAIL PROTECTED]> writes:

> Very cool!  I hit one small problem when I restarted emacs (perhaps this
> is my problem ;o)--it seemed to run recursively even where I didn't
> have any subtrees, and it was causing some strange behaviour.  I've taken
> a (very) quick look at it, and replacing:
>
>         (let ((subtrees (split-string
>                          (with-current-buffer
>                              output (buffer-string)) "
> ")))
>
> with:
>
>         (let ((subtrees (split-string
>                          (with-current-buffer
>                              output (buffer-string)) "
> " t)))
>
> Works For Me.  It was just that SPLIT-STRING was returning ("").  Does
> this sound right?

There exist different versions for split-string on emacs:

,---- CVS-emacs:
| split-string is a compiled Lisp function in `subr'.
| (split-string STRING &optional SEPARATORS OMIT-NULLS)
| 
| Splits STRING into substrings bounded by matches for SEPARATORS.
| 
| The beginning and end of STRING, and each match for SEPARATORS, are
| splitting points.  The substrings matching SEPARATORS are removed, and
| the substrings between the splitting points are collected as a list,
| which is returned.
| 
| If SEPARATORS is non-nil, it should be a regular expression matching text
| which separates, but is not part of, the substrings.  If nil it defaults to
| `split-string-default-separators', normally "[ \f\t\n\r\v]+", and
| OMIT-NULLS is forced to t.
| 
| If OMIT-NULLs is t, zero-length substrings are omitted from the list (so
| that for the default value of SEPARATORS leading and trailing whitespace
| are effectively trimmed).  If nil, all zero-length substrings are retained,
| which correctly parses CSV format, for example.
| 
| Note that the effect of `(split-string STRING)' is the same as
| `(split-string STRING split-string-default-separators t)').  In the rare
| case that you wish to retain zero-length substrings when splitting on
| whitespace, use `(split-string STRING split-string-default-separators)'.
| 
| Modifies the match data; use `save-match-data' if necessary.
`----

,---- emacs21.3.1:
| split-string is a compiled Lisp function in `subr'.
| (split-string STRING &optional SEPARATORS)
| 
| Splits STRING into substrings where there are matches for SEPARATORS.
| Each match for SEPARATORS is a splitting point.
| The substrings between the splitting points are made into a list
| which is returned.
| If SEPARATORS is absent, it defaults to "[ \f\t\n\r\v]+".
| 
| If there is match for SEPARATORS at the beginning of STRING, we do not
| include a null substring for that.  Likewise, if there is a match
| at the end of STRING, we don't include a null substring for that.
| 
| Modifies the match data; use `save-match-data' if necessary.
`----

And there is probably a different version on xemacs also?

* I see the following possibilities:
  - Create a tla--split-string function that emulates the CVS
    behaviour, if that is not available
  - Use split-string in a way that works on all platforms (not sure,
    if this is possible)
  - Do not use split-string

-- 
Stefan.

Reply via email to