Mark obsolete.
* lisp/shell.el (shell-parse-pcomplete-arguments): New function.
(shell-completion-vars): Use it instead.
Fixes: debbugs:9160
+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
(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.
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>
(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."
: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'."
(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)