]> code.delx.au - gnu-emacs/blobdiff - lisp/pcmpl-x.el
Calc: Update mode line after change mode
[gnu-emacs] / lisp / pcmpl-x.el
index b52a692a291fd61973b26e124ffcbc763983c401..edbbe54a032a91cbb0c62e9b31136810b2fbee70 100644 (file)
@@ -1,6 +1,6 @@
 ;;; pcmpl-x.el --- completion for miscellaneous tools  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2016 Free Software Foundation, Inc.
 
 ;; Author: Leo Liu <sdl.web@gmail.com>
 ;; Keywords: processes, tools, convenience
@@ -31,6 +31,7 @@
 
 (defcustom pcmpl-x-tlmgr-program "tlmgr"
   "Name of the tlmgr program."
+  :version "24.4"
   :type 'file
   :group 'pcomplete)
 
                               (executable-find "ack")
                               "ack"))
   "Name of the ack program."
+  :version "24.4"
   :type 'file
   :group 'pcomplete)
 
 ;;;###autoload
 (defun pcomplete/ack ()
   "Completion for the `ack' command.
-Start an argument with '-' to complete short options and '--' for
+Start an argument with `-' to complete short options and `--' for
 long options."
   ;; No space after =
   (while t
@@ -257,16 +259,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 ()