author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sun, 13 May 2018 00:30:35 +0300 | |
changeset 1562 | df57aca81e75 |
parent 1561 | 0876ef9be273 |
child 1563 | bc9da63949f1 |
permissions | -rw-r--r-- |
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
1 |
;;; ag.el --- Ag frontend |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
2 |
|
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
3 |
;;; Commentary: |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
4 |
;; |
1492 | 5 |
|
1526
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
6 |
(defgroup my-ag nil |
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
7 |
"My own ag search front-end." |
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
8 |
:prefix "my-ag" |
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
9 |
:group 'tools |
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
10 |
:group 'processes) |
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
11 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
12 |
(defun my-ag-goto () |
1492 | 13 |
(interactive) |
14 |
(save-excursion |
|
15 |
(let ( lineno end ) |
|
16 |
(forward-line 1) |
|
17 |
(backward-char 1) |
|
18 |
(setq end (point)) |
|
19 |
(forward-line 0) |
|
20 |
(if (not (search-forward-regexp "^\\([1-9][0-9]*\\):" end t)) |
|
21 |
(message "Not at line number...") |
|
1521
df20553d4bd2
Fix: Warning: "string-to-int" is an obsolete function (as of 22.1); use
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1515
diff
changeset
|
22 |
(setq lineno (string-to-number (match-string 1))) |
1492 | 23 |
(if (search-backward-regexp "^$" nil t) |
24 |
(forward-char) |
|
25 |
(goto-char (point-min))) |
|
26 |
(search-forward-regexp "^.*") |
|
27 |
(find-file-other-window (match-string 0)) |
|
1522
bbc10891c9a0
Fix: Warning: 'goto-line' is for interactive use only; use 'forward-line'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1521
diff
changeset
|
28 |
(goto-char (point-min)) |
bbc10891c9a0
Fix: Warning: 'goto-line' is for interactive use only; use 'forward-line'
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1521
diff
changeset
|
29 |
(forward-line (1- lineno)))))) |
1492 | 30 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
31 |
(defun my-ag-kill-process () |
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
32 |
(interactive) |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
33 |
(let ( (proc (get-buffer-process (current-buffer))) ) |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
34 |
(if proc |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
35 |
(interrupt-process proc) |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
36 |
(error "The %s process is not running" (downcase mode-name))))) |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
37 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
38 |
(defvar my-ag-mode-map (make-sparse-keymap)) |
1492 | 39 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
40 |
(define-key my-ag-mode-map (kbd "RET") 'my-ag-goto) |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
41 |
(define-key my-ag-mode-map (kbd "C-c C-k") 'my-ag-kill-process) |
1492 | 42 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
43 |
(defface my-ag/lineno-face |
1492 | 44 |
'((t :inherit warning)) |
1526
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
45 |
"Face for line number." |
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
46 |
:group 'my-ag) |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
47 |
(defface my-ag/path-face |
1492 | 48 |
'((t :inherit success)) |
1526
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
49 |
"Face for line number." |
5eb1feacdcb7
Fix: Warning: defface for my-ag/lineno-face fails to specify containing group
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1523
diff
changeset
|
50 |
:group 'my-ag) |
1492 | 51 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
52 |
(defvar my-ag/keywords |
1561
0876ef9be273
Proper highlight context (from -A/-B/-C options).
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1526
diff
changeset
|
53 |
'(("^[1-9][0-9]\\{0,5\\}[-:]" . (0 'my-ag/lineno-face)) |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
54 |
("^[^:]\\{6\\}.*" . (0 'my-ag/path-face)))) |
1492 | 55 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
56 |
(define-derived-mode my-ag-mode fundamental-mode "Ag" |
1492 | 57 |
"Major mode for Ag parsing." |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
58 |
(setq font-lock-defaults '(my-ag/keywords t nil nil)) ; (font-lock-multiline . t) |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
59 |
(use-local-map my-ag-mode-map)) |
1492 | 60 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
61 |
(defvar my-ag/buffer-name "*ag*") |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
62 |
(defvar my-ag/buffer nil) |
1492 | 63 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
64 |
(defun my-ag/filter (proc str) |
1492 | 65 |
(when (buffer-live-p (process-buffer proc)) |
66 |
(with-current-buffer (process-buffer proc) |
|
67 |
(save-excursion |
|
68 |
(goto-char (process-mark proc)) |
|
69 |
(insert str) |
|
70 |
(set-marker (process-mark proc) (point))) |
|
71 |
))) |
|
72 |
||
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
73 |
(defvar my-ag/regex-history nil) |
1492 | 74 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
75 |
(defun my-ag/setup-buffer (dir) |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
76 |
(setq my-ag/buffer (get-buffer-create my-ag/buffer-name)) |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
77 |
(with-current-buffer my-ag/buffer |
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
78 |
(setq default-directory dir) |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
79 |
(erase-buffer) |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
80 |
(my-ag-mode)) |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
81 |
(display-buffer my-ag/buffer)) |
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
82 |
|
1562
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
83 |
(defun my-ag/run (regex &optional args) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
84 |
(let ((default-directory (buffer-local-value 'default-directory my-ag/buffer)) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
85 |
(cmd (list "ag" "--group" "--nocolor"))) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
86 |
(when args |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
87 |
(nconc cmd (split-string args))) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
88 |
(nconc cmd (list "--" regex)) |
1496
4b336f352950
(vc-root-dir) selectively work depending on buffer mode. I need root based on
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
89 |
(make-process |
4b336f352950
(vc-root-dir) selectively work depending on buffer mode. I need root based on
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
90 |
:name "ag" |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
91 |
:buffer my-ag/buffer |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
92 |
:filter 'my-ag/filter |
1562
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
93 |
:command cmd))) |
1496
4b336f352950
(vc-root-dir) selectively work depending on buffer mode. I need root based on
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
94 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
95 |
(defun my-ag/project-root () |
1501
636e49ed6d27
Prevent error if there is no repository. Fix highlighting of line numbers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
96 |
(condition-case err |
636e49ed6d27
Prevent error if there is no repository. Fix highlighting of line numbers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
97 |
(let ( backend ) |
636e49ed6d27
Prevent error if there is no repository. Fix highlighting of line numbers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
98 |
(setq backend (vc-responsible-backend default-directory)) |
636e49ed6d27
Prevent error if there is no repository. Fix highlighting of line numbers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
99 |
(if backend |
1496
4b336f352950
(vc-root-dir) selectively work depending on buffer mode. I need root based on
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1493
diff
changeset
|
100 |
(vc-call-backend backend 'root default-directory) |
1501
636e49ed6d27
Prevent error if there is no repository. Fix highlighting of line numbers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
101 |
default-directory)) |
636e49ed6d27
Prevent error if there is no repository. Fix highlighting of line numbers.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1498
diff
changeset
|
102 |
(error default-directory))) |
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
103 |
|
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
104 |
(defun my-ag/read-regex () |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
105 |
(let* ( (def (when my-ag/regex-history (car my-ag/regex-history))) |
1502
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
106 |
(part (when def (if (< (length def) 20) |
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
107 |
def |
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
108 |
(concat (substring def 0 20) "...")))) ) |
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
109 |
(read-string |
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
110 |
(if part (format "Regex [%s]: " part) "Regex: ") |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
111 |
"" 'my-ag/regex-history def t))) |
1502
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
112 |
|
1562
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
113 |
(defvar my-ag/extra-history nil) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
114 |
|
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
115 |
(defun my-ag/read-extra () |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
116 |
(let* ( (def (when my-ag/extra-history (car my-ag/extra-history))) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
117 |
(part (when def (if (< (length def) 20) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
118 |
def |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
119 |
(concat (substring def 0 20) "...")))) ) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
120 |
(read-string |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
121 |
(if part (format "Extra args [%s]: " part) "Extra args: ") |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
122 |
"" 'my-ag/extra-history def t))) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
123 |
|
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
124 |
;;;###autoload |
1562
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
125 |
(defun my-ag (regex &optional args) |
1502
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
126 |
"Search in 'ag' recursively from VCS root directory and fall to |
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
127 |
current directory if VCS root is not defined." |
1562
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
128 |
(interactive (if (equal current-prefix-arg '(16)) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
129 |
(list (my-ag/read-regex) (my-ag/read-extra)) |
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
130 |
(list (my-ag/read-regex)))) |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
131 |
(my-ag/setup-buffer (if current-prefix-arg default-directory (my-ag/project-root))) |
1562
df57aca81e75
Prompt for extra ag options on C-u C-u.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1561
diff
changeset
|
132 |
(my-ag/run regex args)) |
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
133 |
|
1502
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
134 |
;;;###autoload |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
135 |
(defun my-ag-default-directory (regex) |
1502
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
136 |
"Search in 'ag' recursively from current directory." |
1515
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
137 |
(interactive (list (my-ag/read-regex))) |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
138 |
(my-ag/setup-buffer default-directory) |
a28c181c1412
Rename public function so that they wouldn't have '/' symbol in name.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1502
diff
changeset
|
139 |
(my-ag/run regex)) |
1502
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
140 |
|
72c63cea35d3
It much easy to call ag for current directory via modifier then prefix argument.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1501
diff
changeset
|
141 |
|
1493
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
142 |
(provide 'ag) |
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
143 |
|
d242edfd1321
Function for killing process. Simplify code. Limit search for current
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
1492
diff
changeset
|
144 |
;;; ag.el ends here |