emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115171: * pcmpl-x.el (pcmpl-x-ag-options): Handle `


From: Leo Liu
Subject: [Emacs-diffs] trunk r115171: * pcmpl-x.el (pcmpl-x-ag-options): Handle `[no]' in long options.
Date: Thu, 21 Nov 2013 16:31:06 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115171
revision-id: address@hidden
parent: address@hidden
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Fri 2013-11-22 00:30:14 +0800
message:
  * pcmpl-x.el (pcmpl-x-ag-options): Handle `[no]' in long options.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/pcmpl-x.el                pcmplx.el-20130407071226-4la30myd0pef85ok-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-11-21 14:15:44 +0000
+++ b/lisp/ChangeLog    2013-11-21 16:30:14 +0000
@@ -1,8 +1,9 @@
 2013-11-21  Leo Liu  <address@hidden>
 
        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  <address@hidden>
 

=== modified file 'lisp/pcmpl-x.el'
--- a/lisp/pcmpl-x.el   2013-11-21 14:15:44 +0000
+++ b/lisp/pcmpl-x.el   2013-11-21 16:30:14 +0000
@@ -257,16 +257,23 @@
       (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 ()


reply via email to

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