comparison lisp/subr.el @ 98942:24d03d4e9afe

(split-string-and-unquote): Simplify regexp.
author Andreas Schwab <schwab@suse.de>
date Mon, 20 Oct 2008 17:29:29 +0000
parents 8d3f352dfa8d
children ec4e32b94c9f
comparison
equal deleted inserted replaced
98941:3f36bcd67163 98942:24d03d4e9afe
2920 "Split the STRING into a list of strings. 2920 "Split the STRING into a list of strings.
2921 It understands Emacs Lisp quoting within STRING, such that 2921 It understands Emacs Lisp quoting within STRING, such that
2922 (split-string-and-unquote (combine-and-quote-strings strs)) == strs 2922 (split-string-and-unquote (combine-and-quote-strings strs)) == strs
2923 The SEPARATOR regexp defaults to \"\\s-+\"." 2923 The SEPARATOR regexp defaults to \"\\s-+\"."
2924 (let ((sep (or separator "\\s-+")) 2924 (let ((sep (or separator "\\s-+"))
2925 (i (string-match "[\"]" string))) 2925 (i (string-match "\"" string)))
2926 (if (null i) 2926 (if (null i)
2927 (split-string string sep t) ; no quoting: easy 2927 (split-string string sep t) ; no quoting: easy
2928 (append (unless (eq i 0) (split-string (substring string 0 i) sep t)) 2928 (append (unless (eq i 0) (split-string (substring string 0 i) sep t))
2929 (let ((rfs (read-from-string string i))) 2929 (let ((rfs (read-from-string string i)))
2930 (cons (car rfs) 2930 (cons (car rfs)