emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r105536: * lisp/pcomplete.el (pcomple


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105536: * lisp/pcomplete.el (pcomplete-parse-comint-arguments): Fix inf-loop.
Date: Tue, 23 Aug 2011 01:21:09 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105536
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9160
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2011-08-23 01:21:09 -0400
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/pcomplete.el
  lisp/shell.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-08-22 22:10:21 +0000
+++ b/lisp/ChangeLog    2011-08-23 05:21:09 +0000
@@ -1,3 +1,10 @@
+2011-08-23  Stefan Monnier  <address@hidden>
+
+       * 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  <address@hidden>
 
        * 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  <address@hidden>
 

=== modified file 'lisp/pcomplete.el'
--- a/lisp/pcomplete.el 2011-06-17 18:52:46 +0000
+++ b/lisp/pcomplete.el 2011-08-23 05:21:09 +0000
@@ -811,15 +811,19 @@
       (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."

=== modified file 'lisp/shell.el'
--- a/lisp/shell.el     2011-06-17 18:52:46 +0000
+++ b/lisp/shell.el     2011-08-23 05:21:09 +0000
@@ -383,6 +383,21 @@
   :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 @@
   (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]