]> code.delx.au - gnu-emacs/commitdiff
* pcmpl-x.el (pcmpl-x-ag-options): Handle `[no]' in long options.
authorLeo Liu <sdl.web@gmail.com>
Thu, 21 Nov 2013 16:30:14 +0000 (00:30 +0800)
committerLeo Liu <sdl.web@gmail.com>
Thu, 21 Nov 2013 16:30:14 +0000 (00:30 +0800)
lisp/ChangeLog
lisp/pcmpl-x.el

index cc928f5c57f0aa144fa4eb1569f3fb2068275cc6..0865d0c81cf799b3a8102535265e2b4069822611 100644 (file)
@@ -1,8 +1,9 @@
 2013-11-21  Leo Liu  <sdl.web@gmail.com>
 
        Add completion for command `ag'.
-       * pcmpl-x.el (pcomplete/ag, pcmpl-x-ag-options): New functions.
-       (pcmpl-x-ag-options): New variable.
+       * pcmpl-x.el (pcmpl-x-ag-options): New variable.
+       (pcomplete/ag): New function.
+       (pcmpl-x-ag-options): New function. Handle `[no]' in long options.
 
 2013-11-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
index b52a692a291fd61973b26e124ffcbc763983c401..8e09c66030168822db034341e520a39e36be2a05 100644 (file)
@@ -257,16 +257,23 @@ long options."
       (setq pcmpl-x-ag-options
             (with-temp-buffer
               (when (zerop (call-process "ag" nil t nil "--help"))
-                (let (so lo)
+                (let (short long)
                   (goto-char (point-min))
                   (while (re-search-forward "^ +\\(-[a-zA-Z]\\) " nil t)
-                    (push (match-string 1) so))
+                    (push (match-string 1) short))
                   (goto-char (point-min))
                   (while (re-search-forward
-                          "^ +\\(?:-[a-zA-Z] \\)?\\(--[^ \t\n]+\\) " nil t)
-                    (push (match-string 1) lo))
-                  (list (cons 'short (nreverse so))
-                        (cons 'long  (nreverse lo)))))))))
+                          "^ +\\(?:-[a-zA-Z] \\)?\\(--\\(\\[no\\]\\)?[^ \t\n]+\\) "
+                          nil t)
+                    (if (match-string 2)
+                        (progn
+                          (replace-match "" nil nil nil 2)
+                          (push (match-string 1) long)
+                          (replace-match "no" nil nil nil 2)
+                          (push (match-string 1) long))
+                      (push (match-string 1) long)))
+                  (list (cons 'short (nreverse short))
+                        (cons 'long  (nreverse long)))))))))
 
 ;;;###autoload
 (defun pcomplete/ag ()