diff options
Diffstat (limited to 'lisp/shell.el')
| -rw-r--r-- | lisp/shell.el | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index 01d1a688f0e..909ebb48afc 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -393,10 +393,28 @@ to `dirtrack-mode'." | |||
| 393 | (while (< (point) end) | 393 | (while (< (point) end) |
| 394 | (skip-chars-forward " \t\n") | 394 | (skip-chars-forward " \t\n") |
| 395 | (push (point) begins) | 395 | (push (point) begins) |
| 396 | (looking-at "\\(?:[^\s\t\n\\]\\|'[^']*'\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\|\\\\.\\)*\\(?:\\\\\\|'[^']*\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\\)?") | 396 | (let ((arg ())) |
| 397 | (goto-char (match-end 0)) | 397 | (while (looking-at |
| 398 | (push (buffer-substring-no-properties (car begins) (point)) | 398 | (eval-when-compile |
| 399 | args)) | 399 | (concat |
| 400 | "\\(?:[^\s\t\n\\\"']+" | ||
| 401 | "\\|'\\([^']*\\)'?" | ||
| 402 | "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?" | ||
| 403 | "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)"))) | ||
| 404 | (goto-char (match-end 0)) | ||
| 405 | (cond | ||
| 406 | ((match-beginning 3) ;Backslash escape. | ||
| 407 | (push (if (= (match-beginning 3) (match-end 3)) | ||
| 408 | "\\" (match-string 3)) | ||
| 409 | arg)) | ||
| 410 | ((match-beginning 2) ;Double quote. | ||
| 411 | (push (replace-regexp-in-string | ||
| 412 | "\\\\\\(.\\)" "\\1" (match-string 2)) | ||
| 413 | arg)) | ||
| 414 | ((match-beginning 1) ;Single quote. | ||
| 415 | (push (match-string 1) arg)) | ||
| 416 | (t (push (match-string 0) arg)))) | ||
| 417 | (push (mapconcat #'identity (nreverse arg) "") args))) | ||
| 400 | (cons (nreverse args) (nreverse begins))))) | 418 | (cons (nreverse args) (nreverse begins))))) |
| 401 | 419 | ||
| 402 | (defun shell-completion-vars () | 420 | (defun shell-completion-vars () |