Created
May 31, 2013 02:18
-
-
Save timvisher/5682600 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun timvisher/ack-from-root (arg regexp) | |
(interactive "P") | |
(let ((current-prefix-arg (cond ((not arg) 4) | |
((= 4 (car arg)) 16) | |
((<= 16 (car arg)) nil)))) | |
(call-interactively 'ack))) | |
(defun timvisher/isearch-ack-from-root (arg regexp) | |
(interactive | |
(list current-prefix-arg | |
(cond | |
((functionp isearch-word) | |
(funcall isearch-word isearch-string)) | |
(isearch-word (word-search-regexp isearch-string)) | |
(isearch-regexp isearch-string) | |
(t (regexp-quote isearch-string))))) | |
(let ((ack-command (concat "ag " regexp)) | |
(current-prefix-arg 4)) | |
(isearch-done nil) | |
(isearch-clean-overlays) | |
(call-interactively 'ack))) | |
(define-key isearch-mode-map (kbd "C-c r g") 'timvisher/isearch-ack-from-root) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment