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 | |
| 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
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/pcomplete.el | 16 | ||||
| -rw-r--r-- | lisp/shell.el | 18 |
3 files changed, 37 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 82d67fe476d..e0322ae4595 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-08-23 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * pcomplete.el (pcomplete-parse-comint-arguments): Fix inf-loop. | ||
| 4 | Mark obsolete. | ||
| 5 | * shell.el (shell-parse-pcomplete-arguments): New function. | ||
| 6 | (shell-completion-vars): Use it instead (bug#9160). | ||
| 7 | |||
| 1 | 2011-08-22 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2011-08-22 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * progmodes/sh-script.el (sh-maybe-here-document): Disable magic in | 10 | * progmodes/sh-script.el (sh-maybe-here-document): Disable magic in |
| @@ -54,8 +61,8 @@ | |||
| 54 | (font-lock-default-fontify-region) | 61 | (font-lock-default-fontify-region) |
| 55 | (font-lock-default-unfontify-region): Add docstrings (Bug#8624). | 62 | (font-lock-default-unfontify-region): Add docstrings (Bug#8624). |
| 56 | 63 | ||
| 57 | * progmodes/compile.el (compilation-error-properties): Fix | 64 | * progmodes/compile.el (compilation-error-properties): |
| 58 | confusion between file struct and message struct (Bug#9319). | 65 | Fix confusion between file struct and message struct (Bug#9319). |
| 59 | (compilation-error-regexp-alist-alist): Fix 2011-05-09 change to | 66 | (compilation-error-regexp-alist-alist): Fix 2011-05-09 change to |
| 60 | `ant' regexp. | 67 | `ant' regexp. |
| 61 | 68 | ||
| @@ -149,8 +156,8 @@ | |||
| 149 | binding variables (bug#9298). Also clean up some unused | 156 | binding variables (bug#9298). Also clean up some unused |
| 150 | autoloads. | 157 | autoloads. |
| 151 | 158 | ||
| 152 | * net/network-stream.el (network-stream-open-starttls): Support | 159 | * net/network-stream.el (network-stream-open-starttls): |
| 153 | using starttls.el without using gnutls-cli. | 160 | Support using starttls.el without using gnutls-cli. |
| 154 | 161 | ||
| 155 | 2011-08-17 Juri Linkov <juri@jurta.org> | 162 | 2011-08-17 Juri Linkov <juri@jurta.org> |
| 156 | 163 | ||
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el index 46a82e3720d..02f3c4ad1da 100644 --- a/lisp/pcomplete.el +++ b/lisp/pcomplete.el | |||
| @@ -811,15 +811,19 @@ this is `comint-dynamic-complete-functions'." | |||
| 811 | (while (< (point) end) | 811 | (while (< (point) end) |
| 812 | (skip-chars-forward " \t\n") | 812 | (skip-chars-forward " \t\n") |
| 813 | (push (point) begins) | 813 | (push (point) begins) |
| 814 | (let ((skip t)) | 814 | (while |
| 815 | (while skip | 815 | (progn |
| 816 | (skip-chars-forward "^ \t\n") | 816 | (skip-chars-forward "^ \t\n\\") |
| 817 | (if (eq (char-before) ?\\) | 817 | (when (eq (char-after) ?\\) |
| 818 | (skip-chars-forward " \t\n") | 818 | (forward-char 1) |
| 819 | (setq skip nil)))) | 819 | (unless (eolp) |
| 820 | (forward-char 1) | ||
| 821 | t)))) | ||
| 820 | (push (buffer-substring-no-properties (car begins) (point)) | 822 | (push (buffer-substring-no-properties (car begins) (point)) |
| 821 | args)) | 823 | args)) |
| 822 | (cons (nreverse args) (nreverse begins))))) | 824 | (cons (nreverse args) (nreverse begins))))) |
| 825 | (make-obsolete 'pcomplete-parse-comint-arguments | ||
| 826 | 'comint-parse-pcomplete-arguments "24.1") | ||
| 823 | 827 | ||
| 824 | (defun pcomplete-parse-arguments (&optional expand-p) | 828 | (defun pcomplete-parse-arguments (&optional expand-p) |
| 825 | "Parse the command line arguments. Most completions need this info." | 829 | "Parse the command line arguments. Most completions need this info." |
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) |