Function: mh-pick-args-list

mh-pick-args-list is a byte-compiled function defined in mh-limit.el.gz.

Signature

(mh-pick-args-list S)

Documentation

Form list by grouping elements in string S suitable for pick arguments.

For example, the string "-subject a b c -from Joe User
<user@domain.com>" is converted to ("-subject" "a b c"
"-from" "Joe User <user@domain.com>"

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-limit.el.gz
(defun mh-pick-args-list (s)
  "Form list by grouping elements in string S suitable for pick arguments.
For example, the string \"-subject a b c -from Joe User
<user@domain.com>\" is converted to (\"-subject\" \"a b c\"
\"-from\" \"Joe User <user@domain.com>\""
  (let ((full-list (split-string s))
        current-arg collection arg-list)
    (while full-list
      (setq current-arg (car full-list))
      (if (null (string-match "^-" current-arg))
          (setq collection
                (if (null collection)
                    current-arg
                  (format "%s %s" collection current-arg)))
        (when collection
          (setq arg-list (append arg-list (list collection)))
          (setq collection nil))
        (setq arg-list (append arg-list (list current-arg))))
      (setq full-list (cdr full-list)))
    (when collection
      (setq arg-list (append arg-list (list collection))))
    arg-list))