aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2013-11-22 00:30:14 +0800
committerLeo Liu2013-11-22 00:30:14 +0800
commit2021a20053592053dfe78ff5190afa1104010344 (patch)
tree2c16df85cc9e05a06e0dceea75504c656e9bf44e
parentb6ffa04a65caa59f4f41234fc7b2edc0d0e68a82 (diff)
downloademacs-2021a20053592053dfe78ff5190afa1104010344.tar.gz
emacs-2021a20053592053dfe78ff5190afa1104010344.zip
* pcmpl-x.el (pcmpl-x-ag-options): Handle `[no]' in long options.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/pcmpl-x.el19
2 files changed, 16 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cc928f5c57f..0865d0c81cf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,8 +1,9 @@
12013-11-21 Leo Liu <sdl.web@gmail.com> 12013-11-21 Leo Liu <sdl.web@gmail.com>
2 2
3 Add completion for command `ag'. 3 Add completion for command `ag'.
4 * pcmpl-x.el (pcomplete/ag, pcmpl-x-ag-options): New functions. 4 * pcmpl-x.el (pcmpl-x-ag-options): New variable.
5 (pcmpl-x-ag-options): New variable. 5 (pcomplete/ag): New function.
6 (pcmpl-x-ag-options): New function. Handle `[no]' in long options.
6 7
72013-11-21 Stefan Monnier <monnier@iro.umontreal.ca> 82013-11-21 Stefan Monnier <monnier@iro.umontreal.ca>
8 9
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."
257 (setq pcmpl-x-ag-options 257 (setq pcmpl-x-ag-options
258 (with-temp-buffer 258 (with-temp-buffer
259 (when (zerop (call-process "ag" nil t nil "--help")) 259 (when (zerop (call-process "ag" nil t nil "--help"))
260 (let (so lo) 260 (let (short long)
261 (goto-char (point-min)) 261 (goto-char (point-min))
262 (while (re-search-forward "^ +\\(-[a-zA-Z]\\) " nil t) 262 (while (re-search-forward "^ +\\(-[a-zA-Z]\\) " nil t)
263 (push (match-string 1) so)) 263 (push (match-string 1) short))
264 (goto-char (point-min)) 264 (goto-char (point-min))
265 (while (re-search-forward 265 (while (re-search-forward
266 "^ +\\(?:-[a-zA-Z] \\)?\\(--[^ \t\n]+\\) " nil t) 266 "^ +\\(?:-[a-zA-Z] \\)?\\(--\\(\\[no\\]\\)?[^ \t\n]+\\) "
267 (push (match-string 1) lo)) 267 nil t)
268 (list (cons 'short (nreverse so)) 268 (if (match-string 2)
269 (cons 'long (nreverse lo))))))))) 269 (progn
270 (replace-match "" nil nil nil 2)
271 (push (match-string 1) long)
272 (replace-match "no" nil nil nil 2)
273 (push (match-string 1) long))
274 (push (match-string 1) long)))
275 (list (cons 'short (nreverse short))
276 (cons 'long (nreverse long)))))))))
270 277
271;;;###autoload 278;;;###autoload
272(defun pcomplete/ag () 279(defun pcomplete/ag ()