   "Wrap in single quotes, and quote existing single quotes to make shell safe."
   (concat "'" (ack-and-a-half-string-replace "'" "'\\''" string) "'"))
 
+(defun ag/s-join (separator strings)
+  "Join all the strings in STRINGS with SEPARATOR in between."
+  (mapconcat 'identity strings separator))
+
 (defun ag (string directory)
   "Run ag searching for the literal STRING given in DIRECTORY."
   (interactive "sSearch string: \nDDirectory: ")
-  (compilation-start (s-join " "
-                             (-concat '("ag") ag-arguments (list (ag/shell-quote string))))
+  (compilation-start (ag/s-join " "
+                             (append '("ag") ag-arguments (list (ag/shell-quote string))))
                      'ag-mode))

;;
;; Author: Wilfred Hughes <me@wilfred.me.uk>
;; Created: 11 January 2012
;; Version: 0.1

;;; Commentary

;; This file is heavily based on the excellent ack-and-a-half.el.
;; You will need dash.el[1] and s.el[2] to use ag.el
;;
;; [1]: https://github.com/magnars/dash.el
;; [2]: https://github.com/magnars/s.el

;;; Todo

;; 1. Remove external dependencies.
;; 2. Add ag-project
;; 3. Add ag-project-at-point
;; 4. Add ag-regexp
;; 5. Add highlighting to *Ag* buffer

;;; License:


;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

(defcustom ag-arguments
  (list "--nocolor" "--literal" "--smart-case" "--nogroup" "--column")
  "Default arguments passed to ag."
