diff options
author | Leo Liu <sdl.web@gmail.com> | 2013-11-22 00:30:14 +0800 |
---|---|---|
committer | Leo Liu <sdl.web@gmail.com> | 2013-11-22 00:30:14 +0800 |
commit | 2021a20053592053dfe78ff5190afa1104010344 (patch) | |
tree | 2c16df85cc9e05a06e0dceea75504c656e9bf44e /lisp/pcmpl-x.el | |
parent | b6ffa04a65caa59f4f41234fc7b2edc0d0e68a82 (diff) | |
download | emacs-2021a20053592053dfe78ff5190afa1104010344.tar.gz emacs-2021a20053592053dfe78ff5190afa1104010344.tar.bz2 emacs-2021a20053592053dfe78ff5190afa1104010344.zip |
* pcmpl-x.el (pcmpl-x-ag-options): Handle `[no]' in long options.
Diffstat (limited to 'lisp/pcmpl-x.el')
-rw-r--r-- | lisp/pcmpl-x.el | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lisp/pcmpl-x.el b/lisp/pcmpl-x.el index b52a692a291..8e09c660301 100644 --- a/lisp/pcmpl-x.el +++ b/lisp/pcmpl-x.el @@ -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 () |