Function: mh-xargs
mh-xargs is a byte-compiled function defined in mh-e.el.gz.
Signature
(mh-xargs CMD &rest ARGS)
Documentation
Partial imitation of xargs.
The current buffer contains a list of strings, one on each line.
The function will execute CMD with ARGS and pass the first
mh-index-max-cmdline-args strings to it. This is repeated till
all the strings have been used.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-e.el.gz
(defun mh-xargs (cmd &rest args)
"Partial imitation of xargs.
The current buffer contains a list of strings, one on each line.
The function will execute CMD with ARGS and pass the first
`mh-index-max-cmdline-args' strings to it. This is repeated till
all the strings have been used."
(goto-char (point-min))
(let ((current-buffer (current-buffer)))
(with-temp-buffer
(let ((out (current-buffer)))
(set-buffer current-buffer)
(while (not (eobp))
(let ((arg-list (reverse args))
(count 0))
(while (and (not (eobp)) (< count mh-index-max-cmdline-args))
(push (buffer-substring-no-properties (point)
(line-end-position))
arg-list)
(incf count)
(forward-line))
(apply #'call-process cmd nil (list out nil) nil
(nreverse arg-list))))
(erase-buffer)
(insert-buffer-substring out)))))