                 (append '("ag") arguments (list (ag/shell-quote string))))
      'ag-mode)))
 
+(defun ag/dwim-at-point ()
+  "If there's an active selection, return that. Otherwise, get
+the symbol at point."
+  (if (use-region-p)
+      (buffer-substring-no-properties (region-beginning) (region-end))
+    (if (symbol-at-point)
+        (symbol-name (symbol-at-point)))))
+
 (autoload 'vc-git-root "vc-git")
 (autoload 'vc-svn-root "vc-svn")
 

(require 'compile)

(defvar ag-match-face 'match
  "Face name to use for grep matches.")


(define-compilation-mode ag-mode "Ag"

;;; ag.el --- A front-end for ag, the C ack replacement.

;; Copyright (C) 2013 Wilfred Hughes <me@wilfred.me.uk>
;;
;; Author: Wilfred Hughes <me@wilfred.me.uk>
;; Created: 11 January 2013
;; Version: 0.11

;;; Commentary

