aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/shell.el
diff options
context:
space:
mode:
authorJoakim Verona2011-08-30 09:50:25 +0200
committerJoakim Verona2011-08-30 09:50:25 +0200
commitb72c6fe2ac5f148b00ceed70a910c7c9ee6a669e (patch)
tree7c64545ae0d8f0d99b82134e04e43b0759d776bc /lisp/shell.el
parent9fb7b0cab34a48a4c7b66abb6b8edc4ee20467b4 (diff)
parent393aa9d403dda96b2fa061311cc76bbad40489cf (diff)
downloademacs-b72c6fe2ac5f148b00ceed70a910c7c9ee6a669e.tar.gz
emacs-b72c6fe2ac5f148b00ceed70a910c7c9ee6a669e.zip
upstream
Diffstat (limited to 'lisp/shell.el')
-rw-r--r--lisp/shell.el26
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 ()