Commit b3fd59bd authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* 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
parent 8b76d6f8
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>
......
......@@ -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."
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment