[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master be54382 4/4: Merge ack master from github.com:leoliu/ack-e
From: |
Leo Liu |
Subject: |
[elpa] master be54382 4/4: Merge ack master from github.com:leoliu/ack-el |
Date: |
Sat, 12 Sep 2015 12:40:53 +0000 |
branch: master
commit be54382cca73c2a64f3bd2720a2332649541bbd5
Merge: b8a46cb 2fcbd1b
Author: Leo Liu <address@hidden>
Commit: Leo Liu <address@hidden>
Merge ack master from github.com:leoliu/ack-el
---
packages/ack/ack.el | 19 +++++++++++++++----
packages/ack/pcmpl-ack.el | 39 +++++++++++++++++++++++++++++++++++++--
2 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/packages/ack/ack.el b/packages/ack/ack.el
index c1f5328..11c1f93 100644
--- a/packages/ack/ack.el
+++ b/packages/ack/ack.el
@@ -1,9 +1,9 @@
-;;; ack.el --- Interface to ack-like source code search tools -*-
lexical-binding: t; -*-
+;;; ack.el --- interface to ack-like tools -*- lexical-binding: t;
-*-
-;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015 Free Software Foundation, Inc.
;; Author: Leo Liu <address@hidden>
-;; Version: 1.3
+;; Version: 1.5
;; Keywords: tools, processes, convenience
;; Created: 2012-03-24
;; URL: https://github.com/leoliu/ack-el
@@ -50,6 +50,13 @@
;; the minibuffer
;; + `TAB' completes ack options
+;;; Supported tools:
+
+;; + ack
+;; + grep
+;; + the_silver_search
+;; + git/hg/bzr grep
+
;;; Bugs: https://github.com/leoliu/ack-el/issues
;;; Code:
@@ -140,6 +147,9 @@ Used by `ack-guess-project-root'."
(defvar ack-error "ack match"
"Stem of message to print when no matches are found.")
+(defvar ack-finish-functions nil
+ "Value to use for `compilation-finish-functions' in ack buffers.")
+
(defun ack-filter ()
"Handle match highlighting escape sequences inserted by the ack process.
This function is called from `compilation-filter-hook'."
@@ -378,7 +388,8 @@ minibuffer:
;; make use of `compilation-arguments'.
(with-current-buffer (compilation-start command-args 'ack-mode)
(when ack-buffer-name-function
- (rename-buffer (funcall ack-buffer-name-function "ack"))))))
+ (rename-buffer (funcall ack-buffer-name-function "ack")))
+ (current-buffer))))
(provide 'ack)
;;; ack.el ends here
diff --git a/packages/ack/pcmpl-ack.el b/packages/ack/pcmpl-ack.el
index 3029367..315eb04 100644
--- a/packages/ack/pcmpl-ack.el
+++ b/packages/ack/pcmpl-ack.el
@@ -1,6 +1,6 @@
-;;; pcmpl-ack.el --- completion for ack -*- lexical-binding: t; -*-
+;;; pcmpl-ack.el --- completion for ack and ag -*- lexical-binding: t;
-*-
-;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2015 Free Software Foundation, Inc.
;; Author: Leo Liu <address@hidden>
;; Keywords: tools, processes, convenience
@@ -27,6 +27,7 @@
;;
;; Install:
;; (autoload 'pcomplete/ack "pcmpl-ack")
+;; (autoload 'pcomplete/ag "pcmpl-ack")
;;
;; Usage:
;; - To complete short options type '-' first
@@ -137,5 +138,39 @@ long options."
;;;###autoload
(defalias 'pcomplete/ack-grep 'pcomplete/ack)
+(defvar pcmpl-ack-ag-options nil)
+
+(defun pcmpl-ack-ag-options ()
+ (or pcmpl-ack-ag-options
+ (setq pcmpl-ack-ag-options
+ (with-temp-buffer
+ (when (zerop (call-process "ag" nil t nil "--help"))
+ (let (short long)
+ (goto-char (point-min))
+ (while (re-search-forward "^ +\\(-[a-zA-Z]\\) " nil t)
+ (push (match-string 1) short))
+ (goto-char (point-min))
+ (while (re-search-forward
+ "^ +\\(?:-[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 ()
+ "Completion for the `ag' command."
+ (while t
+ (if (pcomplete-match "^-" 0)
+ (pcomplete-here* (cdr (assq (if (pcomplete-match "^--" 0) 'long 'short)
+ (pcmpl-ack-ag-options))))
+ (pcomplete-here* (pcomplete-dirs-or-entries)))))
+
(provide 'pcmpl-ack)
;;; pcmpl-ack.el ends here