[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115170: Add completion for command `ag'.
From: |
Leo Liu |
Subject: |
[Emacs-diffs] trunk r115170: Add completion for command `ag'. |
Date: |
Thu, 21 Nov 2013 14:21:11 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115170
revision-id: address@hidden
parent: address@hidden
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Thu 2013-11-21 22:15:44 +0800
message:
Add completion for command `ag'.
* pcmpl-x.el (pcomplete/ag, pcmpl-x-ag-options): New functions.
(pcmpl-x-ag-options): New variable.
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 02:46:00 +0000
+++ b/lisp/ChangeLog 2013-11-21 14:15:44 +0000
@@ -1,3 +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.
+
2013-11-21 Stefan Monnier <address@hidden>
* emacs-lisp/byte-run.el (eval-when-compile): Fix edebug spec
=== modified file 'lisp/pcmpl-x.el'
--- a/lisp/pcmpl-x.el 2013-04-10 01:22:15 +0000
+++ b/lisp/pcmpl-x.el 2013-11-21 14:15:44 +0000
@@ -247,5 +247,35 @@
;;;###autoload
(defalias 'pcomplete/ack-grep 'pcomplete/ack)
+
+;;;; the_silver_search - https://github.com/ggreer/the_silver_searcher
+
+(defvar pcmpl-x-ag-options nil)
+
+(defun pcmpl-x-ag-options ()
+ (or pcmpl-x-ag-options
+ (setq pcmpl-x-ag-options
+ (with-temp-buffer
+ (when (zerop (call-process "ag" nil t nil "--help"))
+ (let (so lo)
+ (goto-char (point-min))
+ (while (re-search-forward "^ +\\(-[a-zA-Z]\\) " nil t)
+ (push (match-string 1) so))
+ (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)))))))))
+
+;;;###autoload
+(defun pcomplete/ag ()
+ "Completion for the `ag' command."
+ (while t
+ (if (pcomplete-match "^-" 0)
+ (pcomplete-here* (cdr (assq (if (pcomplete-match "^--" 0) 'long 'short)
+ (pcmpl-x-ag-options))))
+ (pcomplete-here* (pcomplete-dirs-or-entries)))))
+
(provide 'pcmpl-x)
;;; pcmpl-x.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115170: Add completion for command `ag'.,
Leo Liu <=