.emacs-obsolete
changeset 1494 874f705f7be4
parent 1445 b1f7af188fa2
child 1495 d76487c37e61
--- a/.emacs-obsolete	Thu Feb 23 00:40:50 2017 +0200
+++ b/.emacs-obsolete	Thu Feb 23 00:42:06 2017 +0200
@@ -354,3 +354,19 @@
   (smex-initialize)
   (global-set-key (kbd "M-X") 'smex))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(message "ag)
+
+(ignore-errors (require 'ag))
+
+(defun my/ag (regex)
+  "Search with ag from project roor without prefix and from
+`default-directory' with prefix."
+  (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)))
+
+(setq ag-highlight-search t)
+(when (featurep 'ag)
+  (global-set-key [f7] 'my/ag))