diff options
| author | Stefan Monnier | 2011-08-23 01:21:09 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-08-23 01:21:09 -0400 |
| commit | b3fd59bd988b168ab996bb6368af8bda2bec29b5 (patch) | |
| tree | 7e7e34231bf98d6590093ed121881fb3b2783568 /lisp/shell.el | |
| parent | 8b76d6f8eab68baebd7cc7da85e93bf09e4d34da (diff) | |
| download | emacs-b3fd59bd988b168ab996bb6368af8bda2bec29b5.tar.gz emacs-b3fd59bd988b168ab996bb6368af8bda2bec29b5.zip | |
* lisp/pcomplete.el (pcomplete-parse-comint-arguments): Fix inf-loop.
Mark obsolete.
* lisp/shell.el (shell-parse-pcomplete-arguments): New function.
(shell-completion-vars): Use it instead.
Fixes: debbugs:9160
Diffstat (limited to 'lisp/shell.el')
| -rw-r--r-- | lisp/shell.el | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/shell.el b/lisp/shell.el index de811543ba0..53472d9ef0a 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -383,6 +383,21 @@ to `dirtrack-mode'." | |||
| 383 | :group 'shell | 383 | :group 'shell |
| 384 | :type '(choice (const nil) regexp)) | 384 | :type '(choice (const nil) regexp)) |
| 385 | 385 | ||
| 386 | (defun shell-parse-pcomplete-arguments () | ||
| 387 | "Parse whitespace separated arguments in the current region." | ||
| 388 | (let ((begin (save-excursion (shell-backward-command 1) (point))) | ||
| 389 | (end (point)) | ||
| 390 | begins args) | ||
| 391 | (save-excursion | ||
| 392 | (goto-char begin) | ||
| 393 | (while (< (point) end) | ||
| 394 | (skip-chars-forward " \t\n") | ||
| 395 | (push (point) begins) | ||
| 396 | (looking-at "\\(?:[^\s\t\n\\]\\|'[^']*'\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\|\\\\.\\)*\\(?:\\\\\\|'[^']*\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\\)?") | ||
| 397 | (goto-char (match-end 0)) | ||
| 398 | (push (buffer-substring-no-properties (car begins) (point)) | ||
| 399 | args)) | ||
| 400 | (cons (nreverse args) (nreverse begins))))) | ||
| 386 | 401 | ||
| 387 | (defun shell-completion-vars () | 402 | (defun shell-completion-vars () |
| 388 | "Setup completion vars for `shell-mode' and `read-shell-command'." | 403 | "Setup completion vars for `shell-mode' and `read-shell-command'." |
| @@ -396,8 +411,7 @@ to `dirtrack-mode'." | |||
| 396 | (set (make-local-variable 'comint-dynamic-complete-functions) | 411 | (set (make-local-variable 'comint-dynamic-complete-functions) |
| 397 | shell-dynamic-complete-functions) | 412 | shell-dynamic-complete-functions) |
| 398 | (set (make-local-variable 'pcomplete-parse-arguments-function) | 413 | (set (make-local-variable 'pcomplete-parse-arguments-function) |
| 399 | ;; FIXME: This function should be moved to shell.el. | 414 | #'shell-parse-pcomplete-arguments) |
| 400 | #'pcomplete-parse-comint-arguments) | ||
| 401 | (set (make-local-variable 'pcomplete-termination-string) | 415 | (set (make-local-variable 'pcomplete-termination-string) |
| 402 | (cond ((not comint-completion-addsuffix) "") | 416 | (cond ((not comint-completion-addsuffix) "") |
| 403 | ((stringp comint-completion-addsuffix) | 417 | ((stringp comint-completion-addsuffix) |