Use regex search instead of literal for ag.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Mon, 20 Feb 2017 20:26:21 +0200
changeset 1488 8da1fc103e49
parent 1487 d22fade5ae5c
child 1489 c0c3d88cd779
Use regex search instead of literal for ag.
.emacs-my
--- a/.emacs-my	Mon Feb 20 16:04:49 2017 +0200
+++ b/.emacs-my	Mon Feb 20 20:26:21 2017 +0200
@@ -817,13 +817,13 @@
     (cl-flet ( (grep-compute-defaults () nil) )
       (call-interactively #'rgrep))))
 
-(defun my/ag (&optional str)
+(defun my/ag (regex)
   "Search with ag from project roor without prefix and from
 `default-directory' with prefix."
-  (interactive (when current-prefix-arg (list (ag/read-from-minibuffer "Search string"))))
-  (if str
-      (let ((current-prefix-arg nil)) (ag str default-directory))
-    (call-interactively #'ag-project)))
+  (interactive (list (ag/read-from-minibuffer "Search regex")))
+  (if current-prefix-arg
+      (let ((current-prefix-arg nil)) (ag-regexp regex default-directory))
+    (ag-project-regexp regex)))
 
 (ignore-errors (require 'ag))