Function: shell--parse-pcomplete-arguments
shell--parse-pcomplete-arguments is a byte-compiled function defined
in shell.el.gz.
Signature
(shell--parse-pcomplete-arguments)
Documentation
Parse whitespace separated arguments in the current region.
Source Code
;; Defined in /usr/src/emacs/lisp/shell.el.gz
(defun shell--parse-pcomplete-arguments ()
"Parse whitespace separated arguments in the current region."
;; FIXME: share code with shell--unquote&requote-argument.
(let ((begin (save-excursion (shell-backward-command 1) (point)))
(end (point))
begins args)
(save-excursion
(goto-char begin)
(while (< (point) end)
(skip-chars-forward " \t\n;")
(push (point) begins)
(let ((arg ()))
(while (looking-at
(eval-when-compile
(concat
"\\(?:[^\s\t\n\\\"';]+"
"\\|'\\([^']*\\)'?"
"\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?"
"\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")))
(goto-char (match-end 0))
(cond
((match-beginning 3) ;Backslash escape.
(push (cond
((null comint-file-name-quote-list)
(goto-char (match-beginning 3)) "\\")
((= (match-beginning 3) (match-end 3)) "\\")
(t (match-string 3)))
arg))
((match-beginning 2) ;Double quote.
(push (if (null comint-file-name-quote-list) (match-string 2)
(replace-regexp-in-string
"\\\\\\(.\\)" "\\1" (match-string 2)))
arg))
((match-beginning 1) ;Single quote.
(push (match-string 1) arg))
(t (push (match-string 0) arg))))
(push (mapconcat #'identity (nreverse arg) "") args)))
(cons (nreverse args) (nreverse begins)))))