diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-08-23 01:21:09 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-08-23 01:21:09 -0400 |
commit | b3fd59bd988b168ab996bb6368af8bda2bec29b5 (patch) | |
tree | 7e7e34231bf98d6590093ed121881fb3b2783568 /lisp | |
parent | 8b76d6f8eab68baebd7cc7da85e93bf09e4d34da (diff) | |
download | emacs-b3fd59bd988b168ab996bb6368af8bda2bec29b5.tar.gz |
* 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')
-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 @@ +2011-08-23 Stefan Monnier <monnier@iro.umontreal.ca> + + * pcomplete.el (pcomplete-parse-comint-arguments): Fix inf-loop. + Mark obsolete. + * shell.el (shell-parse-pcomplete-arguments): New function. + (shell-completion-vars): Use it instead (bug#9160). + 2011-08-22 Stefan Monnier <monnier@iro.umontreal.ca> * progmodes/sh-script.el (sh-maybe-here-document): Disable magic in @@ -54,8 +61,8 @@ (font-lock-default-fontify-region) (font-lock-default-unfontify-region): Add docstrings (Bug#8624). - * progmodes/compile.el (compilation-error-properties): Fix - confusion between file struct and message struct (Bug#9319). + * progmodes/compile.el (compilation-error-properties): + Fix confusion between file struct and message struct (Bug#9319). (compilation-error-regexp-alist-alist): Fix 2011-05-09 change to `ant' regexp. @@ -149,8 +156,8 @@ binding variables (bug#9298). Also clean up some unused autoloads. - * net/network-stream.el (network-stream-open-starttls): Support - using starttls.el without using gnutls-cli. + * net/network-stream.el (network-stream-open-starttls): + Support using starttls.el without using gnutls-cli. 2011-08-17 Juri Linkov <juri@jurta.org> 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'." (while (< (point) end) (skip-chars-forward " \t\n") (push (point) begins) - (let ((skip t)) - (while skip - (skip-chars-forward "^ \t\n") - (if (eq (char-before) ?\\) - (skip-chars-forward " \t\n") - (setq skip nil)))) + (while + (progn + (skip-chars-forward "^ \t\n\\") + (when (eq (char-after) ?\\) + (forward-char 1) + (unless (eolp) + (forward-char 1) + t)))) (push (buffer-substring-no-properties (car begins) (point)) args)) (cons (nreverse args) (nreverse begins))))) +(make-obsolete 'pcomplete-parse-comint-arguments + 'comint-parse-pcomplete-arguments "24.1") (defun pcomplete-parse-arguments (&optional expand-p) "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'." :group 'shell :type '(choice (const nil) regexp)) +(defun shell-parse-pcomplete-arguments () + "Parse whitespace separated arguments in the current region." + (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) + (looking-at "\\(?:[^\s\t\n\\]\\|'[^']*'\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\"\\|\\\\.\\)*\\(?:\\\\\\|'[^']*\\|\"\\(?:[^\"\\]\\|\\\\.\\)*\\)?") + (goto-char (match-end 0)) + (push (buffer-substring-no-properties (car begins) (point)) + args)) + (cons (nreverse args) (nreverse begins))))) (defun shell-completion-vars () "Setup completion vars for `shell-mode' and `read-shell-command'." @@ -396,8 +411,7 @@ to `dirtrack-mode'." (set (make-local-variable 'comint-dynamic-complete-functions) shell-dynamic-complete-functions) (set (make-local-variable 'pcomplete-parse-arguments-function) - ;; FIXME: This function should be moved to shell.el. - #'pcomplete-parse-comint-arguments) + #'shell-parse-pcomplete-arguments) (set (make-local-variable 'pcomplete-termination-string) (cond ((not comint-completion-addsuffix) "") ((stringp comint-completion-addsuffix) |