Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 461 lines (395 sloc) 16.729 kB
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
1 ;;; helm-regexp.el --- In buffer regexp searching and replacement for helm.
2
3 ;; Copyright (C) 2012 Thierry Volpiatto <thierry.volpiatto@gmail.com>
4
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation, either version 3 of the License, or
8 ;; (at your option) any later version.
9
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
14
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Code:
19
20 (require 'cl)
21 (require 'helm)
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
22 (require 'helm-utils)
23
24
25 (defgroup helm-regexp nil
26 "Regexp related Applications and libraries for Helm."
27 :group 'helm)
28
29 (defcustom helm-c-browse-code-regexp-lisp
30 "^ *\(def\\(un\\|subst\\|macro\\|face\\|alias\\|advice\\|struct\\|\
31 type\\|theme\\|var\\|group\\|custom\\|const\\|method\\|class\\)"
32 "Regexp used to parse lisp buffer when browsing code."
33 :type 'string
34 :group 'helm-regexp)
35
36 (defcustom helm-c-browse-code-regexp-python
37 "\\<def\\>\\|\\<class\\>"
38 "Regexp used to parse python buffer when browsing code."
39 :type 'string
40 :group 'helm-regexp)
41
42 (defcustom helm-c-browse-code-regexp-alist
43 `((lisp-interaction-mode . ,helm-c-browse-code-regexp-lisp)
44 (emacs-lisp-mode . ,helm-c-browse-code-regexp-lisp)
45 (lisp-mode . ,helm-c-browse-code-regexp-lisp)
46 (python-mode . ,helm-c-browse-code-regexp-python))
47 "Alist to store regexps for browsing code corresponding \
48 to a specific `major-mode'."
d079fc3 @thierryvolpiatto Issue #95 Fix defcustoms in various places.
thierryvolpiatto authored
49 :type '(alist :key-type symbol :value-type regexp)
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
50 :group 'helm-regexp)
c3fb0f0 @thierryvolpiatto * helm-grep.el (helm-c-goto-next-or-prec-file): always use helm-c-gre…
thierryvolpiatto authored
51
6e49004 @thierryvolpiatto * helm-regexp.el (helm-moccur-always-search-in-current): Default to nil.
thierryvolpiatto authored
52 (defcustom helm-moccur-always-search-in-current nil
c3fb0f0 @thierryvolpiatto * helm-grep.el (helm-c-goto-next-or-prec-file): always use helm-c-gre…
thierryvolpiatto authored
53 "Helm multi occur always search in current buffer when non--nil."
54 :group 'helm-regexp
55 :type 'boolean)
56
fb3195d @thierryvolpiatto * helm.el (helm-update): Allow giving an in-source value to delayed a…
thierryvolpiatto authored
57 (defcustom helm-m-occur-idle-delay 0.6
58 "Delay before updating display in `helm-c-source-moccur'.
59 It is similar to `helm-idle-delay' but local to `helm-c-source-moccur'."
60 :group 'helm-regexp
61 :type 'float)
62
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
63
64 (defface helm-moccur-buffer
65 '((t (:foreground "DarkTurquoise" :underline t)))
66 "Face used to highlight moccur buffer names."
67 :group 'helm-regexp)
ba17f09 @thierryvolpiatto Move all defcustoms and faces in their respectives groups and files.
thierryvolpiatto authored
68
69
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
70 (defvar helm-occur-map
71 (let ((map (make-sparse-keymap)))
72 (set-keymap-parent map helm-map)
73 (define-key map (kbd "C-M-%") 'helm-occur-run-query-replace-regexp)
74 map)
75 "Keymap for `helm-occur'.")
76
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
77 (defvar helm-c-moccur-map
78 (let ((map (make-sparse-keymap)))
79 (set-keymap-parent map helm-map)
80 (define-key map (kbd "M-<down>") 'helm-c-goto-next-file)
81 (define-key map (kbd "M-<up>") 'helm-c-goto-precedent-file)
82 (define-key map (kbd "C-w") 'helm-yank-text-at-point)
b3194af @thierryvolpiatto Add help for moccur.
thierryvolpiatto authored
83 (define-key map (kbd "C-c ?") 'helm-moccur-help)
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
84 (delq nil map))
85 "Keymap used in Moccur source.")
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
86
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
87 (defvar helm-build-regexp-history nil)
88 (defun helm-c-query-replace-regexp (candidate)
89 "Query replace regexp from `helm-regexp'.
90 With a prefix arg replace only matches surrounded by word boundaries,
91 i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
92 (let ((regexp (funcall (helm-attr 'regexp))))
93 (apply 'query-replace-regexp
94 (helm-c-query-replace-args regexp))))
95
96 (defun helm-c-kill-regexp-as-sexp (candidate)
97 "Kill regexp in a format usable in lisp code."
98 (helm-c-regexp-kill-new
99 (prin1-to-string (funcall (helm-attr 'regexp)))))
100
101 (defun helm-c-kill-regexp (candidate)
102 "Kill regexp as it is in `helm-pattern'."
103 (helm-c-regexp-kill-new (funcall (helm-attr 'regexp))))
104
105 (defun helm-c-query-replace-args (regexp)
106 "create arguments of `query-replace-regexp' action in `helm-regexp'."
107 (let ((region-only (helm-region-active-p)))
108 (list
109 regexp
110 (query-replace-read-to regexp
111 (format "Query replace %sregexp %s"
112 (if helm-current-prefix-arg "word " "")
113 (if region-only "in region " ""))
114 t)
115 helm-current-prefix-arg
116 (when region-only (region-beginning))
117 (when region-only (region-end)))))
118
119 (defvar helm-c-source-regexp
120 '((name . "Regexp Builder")
121 (init . (lambda ()
122 (helm-candidate-buffer helm-current-buffer)))
123 (candidates-in-buffer)
124 (get-line . helm-c-regexp-get-line)
125 (persistent-action . helm-c-regexp-persistent-action)
126 (persistent-help . "Show this line")
127 (multiline)
128 (delayed)
129 (requires-pattern . 2)
130 (mode-line . "Press TAB to select action.")
131 (regexp . (lambda () helm-input))
132 (action . (("Kill Regexp as sexp" . helm-c-kill-regexp-as-sexp)
133 ("Query Replace Regexp (C-u Not inside word.)"
134 . helm-c-query-replace-regexp)
135 ("Kill Regexp" . helm-c-kill-regexp)))))
136
137 (defun helm-c-regexp-get-line (s e)
138 (propertize
139 (apply 'concat
140 ;; Line contents
141 (format "%5d: %s" (line-number-at-pos (1- s)) (buffer-substring s e))
142 ;; subexps
143 (loop for i from 0 to (1- (/ (length (match-data)) 2))
144 collect (format "\n %s'%s'"
145 (if (zerop i) "Group 0: " (format "Group %d: " i))
146 (match-string i))))
147 ;; match beginning
148 ;; KLUDGE: point of helm-candidate-buffer is +1 than that of helm-current-buffer.
149 ;; It is implementation problem of candidates-in-buffer.
150 'helm-realvalue
151 (1- s)))
152
153 (defun helm-c-regexp-persistent-action (pt)
154 (helm-goto-char pt)
155 (helm-persistent-highlight-point))
156
157 (defun helm-c-regexp-kill-new (input)
158 (kill-new input)
159 (message "Killed: %s" input))
160
161 (defun helm-quote-whitespace (candidate)
162 "Quote whitespace, if some, in string CANDIDATE."
163 (replace-regexp-in-string " " "\\\\ " candidate))
164
165 ;;; Occur
166 ;;
167 ;;
168 (defun helm-c-occur-init ()
169 "Create the initial helm occur buffer.
170 If region is active use region as buffer contents
171 instead of whole buffer."
172 (with-current-buffer (helm-candidate-buffer 'global)
173 (erase-buffer)
174 (let ((buf-contents
175 (with-helm-current-buffer
176 (if (helm-region-active-p)
177 (buffer-substring (region-beginning) (region-end))
178 (buffer-substring (point-min) (point-max))))))
179 (insert buf-contents))))
180
181 (defun helm-c-occur-get-line (s e)
182 (format "%7d:%s" (line-number-at-pos (1- s)) (buffer-substring s e)))
183
184 (defun helm-c-occur-query-replace-regexp (candidate)
185 "Query replace regexp starting from CANDIDATE.
186 If region is active ignore CANDIDATE and replace only in region.
187 With a prefix arg replace only matches surrounded by word boundaries,
188 i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
189 (let ((regexp helm-input))
190 (unless (helm-region-active-p)
191 (helm-c-action-line-goto candidate))
192 (apply 'query-replace-regexp
193 (helm-c-query-replace-args regexp))))
194
195 (defun helm-occur-run-query-replace-regexp ()
196 "Run `query-replace-regexp' in helm occur from keymap."
197 (interactive)
198 (helm-c-quit-and-execute-action
199 'helm-c-occur-query-replace-regexp))
200
201 (defvar helm-c-source-occur
202 `((name . "Occur")
203 (init . helm-c-occur-init)
204 (candidates-in-buffer)
bec9d22 @thierryvolpiatto Revert changes for migemo, add migemo attr to multi-occur.
thierryvolpiatto authored
205 (migemo)
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
206 (get-line . helm-c-occur-get-line)
0ea6be6 @thierryvolpiatto * helm-regexp.el (helm-c-display-to-real-numbered-line): Renamed from…
thierryvolpiatto authored
207 (display-to-real . helm-c-display-to-real-numbered-line)
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
208 (action . (("Go to Line" . helm-c-action-line-goto)
209 ("Query replace regexp (C-u Not inside word.)"
210 . helm-c-occur-query-replace-regexp)))
211 (recenter)
212 (mode-line . helm-occur-mode-line)
213 (keymap . ,helm-occur-map)
5d07ff9 @thierryvolpiatto * helm-regexp.el: Add history to multi occur.
thierryvolpiatto authored
214 (history . ,'helm-c-grep-history)
fb3195d @thierryvolpiatto * helm.el (helm-update): Allow giving an in-source value to delayed a…
thierryvolpiatto authored
215 (requires-pattern . 3)
216 (delayed)))
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
217
f5d0706 @thierryvolpiatto * helm-config.el: Move browse-code to helm-regexp.el
thierryvolpiatto authored
218
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
219 ;;; Multi occur
220 ;;
221 ;;
222 (defun helm-m-occur-init (buffers)
c3fb0f0 @thierryvolpiatto * helm-grep.el (helm-c-goto-next-or-prec-file): always use helm-c-gre…
thierryvolpiatto authored
223 "Create the initial helm multi occur buffer with BUFFERS list."
224 (when helm-moccur-always-search-in-current
225 (setq buffers (cons helm-current-buffer
226 (remove helm-current-buffer buffers))))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
227 (helm-init-candidates-in-buffer
c23a0af @thierryvolpiatto * helm.el (helm-init-candidates-in-buffer): Allow a symbol for BUFFER…
thierryvolpiatto authored
228 'global
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
229 (loop for buf in buffers
230 for bufstr = (with-current-buffer buf (buffer-string))
231 do (add-text-properties
232 0 (length bufstr)
233 `(buffer-name ,(buffer-name (get-buffer buf)))
234 bufstr)
235 concat bufstr)))
236
237 (defun helm-m-occur-get-line (s e)
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
238 "Format line for `helm-c-source-moccur'."
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
239 (format "%s:%d:%s"
240 (get-text-property (point-at-bol) 'buffer-name)
241 (save-restriction
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
242 (narrow-to-region (previous-single-property-change
243 (point) 'buffer-name)
244 (next-single-property-change
245 (point) 'buffer-name))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
246 (line-number-at-pos s))
247 (buffer-substring s e)))
248
249 (defun* helm-m-occur-action (candidate
250 &optional (method (quote buffer)))
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
251 "Jump to CANDIDATE with METHOD.
252 arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
c3fb0f0 @thierryvolpiatto * helm-grep.el (helm-c-goto-next-or-prec-file): always use helm-c-gre…
thierryvolpiatto authored
253 (require 'helm-grep)
254 (let* ((split (helm-c-grep-split-line candidate))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
255 (buf (car split))
256 (lineno (string-to-number (nth 1 split))))
257 (case method
258 (buffer (switch-to-buffer buf))
259 (buffer-other-window (switch-to-buffer-other-window buf))
260 (buffer-other-frame (switch-to-buffer-other-frame buf)))
261 (helm-goto-line lineno)))
262
263 (defun helm-m-occur-goto-line (candidate)
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
264 "From multi occur, switch to buffer and go to nth 1 CANDIDATE line."
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
265 (helm-m-occur-action candidate))
266
267 (defvar helm-c-source-moccur
268 `((name . "Moccur")
269 (init . (lambda ()
2019cde @thierryvolpiatto * helm-regexp.el (helm-c-source-moccur): Require grep at init for key…
thierryvolpiatto authored
270 (require 'helm-grep)
517b729 @thierryvolpiatto * helm-regexp.el (helm-c-source-moccur): Update delayed attr when mod…
thierryvolpiatto authored
271 (helm-m-occur-init buffers)
272 (helm-attrset 'delayed helm-m-occur-idle-delay)))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
273 (candidates-in-buffer)
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
274 (filtered-candidate-transformer . helm-m-occur-transformer)
275 (nohighlight)
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
276 (get-line . helm-m-occur-get-line)
bec9d22 @thierryvolpiatto Revert changes for migemo, add migemo attr to multi-occur.
thierryvolpiatto authored
277 (migemo)
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
278 (action . (("Go to Line" . helm-m-occur-goto-line)))
34b84d3 @thierryvolpiatto * helm-regexp.el (helm-c-source-moccur): Add persistent action.
thierryvolpiatto authored
279 (persistent-action . (lambda (candidate)
280 (helm-m-occur-goto-line candidate)
281 (helm-match-line-color-current-line)))
282 (persistent-help . "Go to line")
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
283 (recenter)
284 (candidate-number-limit . 9999)
b3194af @thierryvolpiatto Add help for moccur.
thierryvolpiatto authored
285 (mode-line . helm-moccur-mode-line)
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
286 (keymap . ,helm-c-moccur-map)
5d07ff9 @thierryvolpiatto * helm-regexp.el: Add history to multi occur.
thierryvolpiatto authored
287 (history . ,'helm-c-grep-history)
fb3195d @thierryvolpiatto * helm.el (helm-update): Allow giving an in-source value to delayed a…
thierryvolpiatto authored
288 (requires-pattern . 3)
289 (delayed . ,helm-m-occur-idle-delay))
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
290 "Helm source for multi occur.")
291
292 (defun helm-m-occur-transformer (candidates source)
293 "Transformer function for `helm-c-source-moccur'."
294 (require 'helm-grep)
295 (loop for i in candidates
c3fb0f0 @thierryvolpiatto * helm-grep.el (helm-c-goto-next-or-prec-file): always use helm-c-gre…
thierryvolpiatto authored
296 for split = (helm-c-grep-split-line i)
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
297 for buf = (car split)
298 for lineno = (nth 1 split)
299 for str = (nth 2 split)
52f4fff @thierryvolpiatto * helm-regexp.el (helm-m-occur-transformer): Add an help-echo.
thierryvolpiatto authored
300 collect (cons (concat (propertize
301 buf
302 'face 'helm-moccur-buffer
303 'help-echo (buffer-file-name
304 (get-buffer buf))
305 'buffer-name buf)
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
306 ":"
307 (propertize lineno 'face 'helm-grep-lineno)
308 ":"
309 (helm-c-grep-highlight-match str))
310 i)))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
311
312 (defun helm-multi-occur-1 (buffers)
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
313 "Main function to call `helm-c-source-moccur' with BUFFERS list."
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
314 (declare (special buffers))
315 (helm :sources 'helm-c-source-moccur
5d07ff9 @thierryvolpiatto * helm-regexp.el: Add history to multi occur.
thierryvolpiatto authored
316 :buffer "*helm multi occur*"
317 :history 'helm-c-grep-history))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
318
319
f5d0706 @thierryvolpiatto * helm-config.el: Move browse-code to helm-regexp.el
thierryvolpiatto authored
320 ;;; Helm browse code.
321 (defun helm-c-browse-code-get-line (beg end)
322 "Select line if it match the regexp corresponding to current `major-mode'.
323 Line is parsed for BEG position to END position."
324 (let ((str-line (buffer-substring beg end))
325 (regexp (assoc-default major-mode
326 helm-c-browse-code-regexp-alist))
327 (num-line (if (string= helm-pattern "") beg (1- beg))))
328 (when (and regexp (string-match regexp str-line))
329 (format "%4d:%s" (line-number-at-pos num-line) str-line))))
330
331 (defvar helm-c-source-browse-code
332 '((name . "Browse code")
333 (init . (lambda ()
334 (helm-candidate-buffer helm-current-buffer)
335 (with-helm-current-buffer
336 (jit-lock-fontify-now))))
337 (candidate-number-limit . 9999)
338 (candidates-in-buffer)
339 (get-line . helm-c-browse-code-get-line)
340 (type . line)
341 (recenter)))
342
0ea6be6 @thierryvolpiatto * helm-regexp.el (helm-c-display-to-real-numbered-line): Renamed from…
thierryvolpiatto authored
343 (defun helm-c-display-to-real-numbered-line (candidate)
344 "This is used to display a line in occur style in helm sources.
345 e.g \" 12:some_text\".
346 It is used with type attribute 'line'."
347 (if (string-match "^ *\\([0-9]+\\):\\(.*\\)$" candidate)
348 (list (string-to-number (match-string 1 candidate))
349 (match-string 2 candidate))
350 (error "Line number not found")))
351
7974fc5 @thierryvolpiatto Create autoload system in helm-config.
thierryvolpiatto authored
352 ;;; Type attributes
353 ;;
354 ;;
355 (define-helm-type-attribute 'line
0ea6be6 @thierryvolpiatto * helm-regexp.el (helm-c-display-to-real-numbered-line): Renamed from…
thierryvolpiatto authored
356 '((display-to-real . helm-c-display-to-real-numbered-line)
7974fc5 @thierryvolpiatto Create autoload system in helm-config.
thierryvolpiatto authored
357 (action ("Go to Line" . helm-c-action-line-goto)))
358 "LINENO:CONTENT string, eg. \" 16:foo\".
359
360 Optional `target-file' attribute is a name of target file.
361
362 Optional `before-jump-hook' attribute is a function with no
363 arguments which is called before jumping to position.
364
365 Optional `after-jump-hook' attribute is a function with no
366 arguments which is called after jumping to position.
367
368 If `adjust' attribute is specified, searches the line whose
369 content is CONTENT near the LINENO.
370
371 If `recenter' attribute is specified, the line is displayed at
372 the center of window, otherwise at the top of window.")
373
374 (define-helm-type-attribute 'file-line
375 `((filtered-candidate-transformer helm-c-filtered-candidate-transformer-file-line)
376 (multiline)
377 (action ("Go to" . helm-c-action-file-line-goto)))
378 "FILENAME:LINENO:CONTENT string, eg. \"~/.emacs:16:;; comment\".
379
380 Optional `default-directory' attribute is a default-directory
381 FILENAME is interpreted.
382
383 Optional `before-jump-hook' attribute is a function with no
384 arguments which is called before jumping to position.
385
386 Optional `after-jump-hook' attribute is a function with no
387 arguments which is called after jumping to position.
388
389 If `adjust' attribute is specified, searches the line whose
390 content is CONTENT near the LINENO.
391
392 If `recenter' attribute is specified, the line is displayed at
393 the center of window, otherwise at the top of window.")
394
f97a20c @thierryvolpiatto * helm-config.el: Move *find-files and related to helm-files.el
thierryvolpiatto authored
395 ;;;###autoload
396 (defun helm-regexp ()
397 "Preconfigured helm to build regexps.
398 `query-replace-regexp' can be run from there against found regexp."
399 (interactive)
400 (save-restriction
401 (let ((helm-compile-source-functions
402 ;; rule out helm-match-plugin because the input is one regexp.
403 (delq 'helm-compile-source--match-plugin
404 (copy-sequence helm-compile-source-functions))))
405 (when (and (helm-region-active-p)
406 ;; Don't narrow to region if buffer is already narrowed.
407 (not (helm-current-buffer-narrowed-p)))
408 (narrow-to-region (region-beginning) (region-end)))
409 (helm :sources helm-c-source-regexp
410 :buffer "*helm regexp*"
411 :prompt "Regexp: "
412 :history 'helm-build-regexp-history))))
413
e21f4c8 @thierryvolpiatto * helm-config.el: Move lisp completion code to helm-elisp.el
thierryvolpiatto authored
414 ;;;###autoload
415 (defun helm-occur ()
416 "Preconfigured Helm for Occur source.
417 If region is active, search only in region,
418 otherwise search in whole buffer."
419 (interactive)
420 (let ((helm-compile-source-functions
421 ;; rule out helm-match-plugin because the input is one regexp.
422 (delq 'helm-compile-source--match-plugin
423 (copy-sequence helm-compile-source-functions))))
424 (helm :sources 'helm-c-source-occur
425 :buffer "*Helm Occur*"
426 :history 'helm-c-grep-history)))
427
f5d0706 @thierryvolpiatto * helm-config.el: Move browse-code to helm-regexp.el
thierryvolpiatto authored
428 ;;;###autoload
eddcd47 helm-multi-occur process interactive args in interactive form
Le Wang authored
429 (defun helm-multi-occur (buffers)
430 "Preconfigured helm for multi occur.
431
432 BUFFERS is a list of buffers to search through."
433 (interactive (list (helm-comp-read
434 "Buffers: " (helm-c-buffer-list)
435 :marked-candidates t)))
9f15d07 @thierryvolpiatto Add transformer function to multi occur.
thierryvolpiatto authored
436 (let ((helm-compile-source-functions
437 ;; rule out helm-match-plugin because the input is one regexp.
438 (delq 'helm-compile-source--match-plugin
eddcd47 helm-multi-occur process interactive args in interactive form
Le Wang authored
439 (copy-sequence helm-compile-source-functions))))
7288a9a @thierryvolpiatto Introduce multi occur.
thierryvolpiatto authored
440 (helm-multi-occur-1 buffers)))
441
442 ;;;###autoload
f5d0706 @thierryvolpiatto * helm-config.el: Move browse-code to helm-regexp.el
thierryvolpiatto authored
443 (defun helm-browse-code ()
444 "Preconfigured helm to browse code."
445 (interactive)
446 (helm :sources 'helm-c-source-browse-code
447 :buffer "*helm browse code*"
448 :default (thing-at-point 'symbol)))
449
450
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
451 (provide 'helm-regexp)
452
37b4201 @thierryvolpiatto Fix dependencies and autoloads. Reorder.
thierryvolpiatto authored
453 ;; Local Variables:
a7ee65b @thierryvolpiatto Disable compile warnings and add new keyword to helm.
thierryvolpiatto authored
454 ;; byte-compile-warnings: (not cl-functions obsolete)
37b4201 @thierryvolpiatto Fix dependencies and autoloads. Reorder.
thierryvolpiatto authored
455 ;; coding: utf-8
456 ;; indent-tabs-mode: nil
457 ;; byte-compile-dynamic: t
458 ;; End:
459
3d768cc @thierryvolpiatto * helm-config.el: Move regexp and occur code to helm-regexp.el.
thierryvolpiatto authored
460 ;;; helm-regexp.el ends here
Something went wrong with that request. Please try again.