Function: eshell-concat-groups

eshell-concat-groups is a byte-compiled function defined in esh-arg.el.gz.

Signature

(eshell-concat-groups QUOTED &rest ARGS)

Documentation

Concatenate groups of arguments in ARGS and return the result.

QUOTED is passed to eshell-concat (which see) and, if non-nil, allows values to be converted to numbers where appropriate.

ARGS should be a list of lists of arguments, such as that produced by eshell-prepare-splice. "Adjacent" values of consecutive arguments will be passed to eshell-concat. For example, if ARGS is

  ((list a) (list b) (list c d e) (list f g)),

then the result will be:

  ((eshell-concat QUOTED a b c)
   d
   (eshell-concat QUOTED e f)
   g).

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-arg.el.gz
(defun eshell-concat-groups (quoted &rest args)
  "Concatenate groups of arguments in ARGS and return the result.
QUOTED is passed to `eshell-concat' (which see) and, if non-nil,
allows values to be converted to numbers where appropriate.

ARGS should be a list of lists of arguments, such as that
produced by `eshell-prepare-splice'.  \"Adjacent\" values of
consecutive arguments will be passed to `eshell-concat'.  For
example, if ARGS is

  ((list a) (list b) (list c d e) (list f g)),

then the result will be:

  ((eshell-concat QUOTED a b c)
   d
   (eshell-concat QUOTED e f)
   g)."
  (let (result current-arg)
    (dolist (arg args)
      (when arg
        (push (car arg) current-arg)
        (when (length> arg 1)
          (push (apply #'eshell-concat quoted (nreverse current-arg))
                result)
          (dolist (inner (butlast (cdr arg)))
            (push inner result))
          (setq current-arg (list (car (last arg)))))))
    (when current-arg
      (push (apply #'eshell-concat quoted (nreverse current-arg))
            result))
    (nreverse result)))