Permalink
Browse files

* helm-config.el: Move browse-code to helm-regexp.el

* helm-regexp.el: added browse-code
  • Loading branch information...
1 parent 5f4a518 commit f5d0706e96ddf810dfa78da678a21b01efb92232 @thierryvolpiatto thierryvolpiatto committed Mar 22, 2012
Showing with 33 additions and 34 deletions.
  1. +0 −34 helm-config.el
  2. +33 −0 helm-regexp.el
View
@@ -1014,32 +1014,6 @@ http://cedet.sourceforge.net/"))
(setq helm-input-idle-delay 0)
(helm-set-sources '(helm-c-source-call-source)))
-
-
-;;; Helm browse code.
-(defun helm-c-browse-code-get-line (beg end)
- "Select line if it match the regexp corresponding to current `major-mode'.
-Line is parsed for BEG position to END position."
- (let ((str-line (buffer-substring beg end))
- (regexp (assoc-default major-mode
- helm-c-browse-code-regexp-alist))
- (num-line (if (string= helm-pattern "") beg (1- beg))))
- (when (and regexp (string-match regexp str-line))
- (format "%4d:%s" (line-number-at-pos num-line) str-line))))
-
-
-(defvar helm-c-source-browse-code
- '((name . "Browse code")
- (init . (lambda ()
- (helm-candidate-buffer helm-current-buffer)
- (with-helm-current-buffer
- (jit-lock-fontify-now))))
- (candidate-number-limit . 9999)
- (candidates-in-buffer)
- (get-line . helm-c-browse-code-get-line)
- (type . line)
- (recenter)))
-
;; Do many actions for input
(defvar helm-c-source-create
@@ -1473,14 +1447,6 @@ http://cvs.savannah.gnu.org/viewvc/*checkout*/bm/bm/bm.el"
(helm-other-buffer 'helm-c-source-bm "*helm bm list*")))
;;;###autoload
-(defun helm-browse-code ()
- "Preconfigured helm to browse code."
- (interactive)
- (helm :sources 'helm-c-source-browse-code
- :buffer "*helm browse code*"
- :default (thing-at-point 'symbol)))
-
-;;;###autoload
(defun helm-call-source ()
"Preconfigured `helm' to call helm source."
(interactive)
View
@@ -157,6 +157,30 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
(requires-pattern . 1)
(delayed)))
+
+;;; Helm browse code.
+(defun helm-c-browse-code-get-line (beg end)
+ "Select line if it match the regexp corresponding to current `major-mode'.
+Line is parsed for BEG position to END position."
+ (let ((str-line (buffer-substring beg end))
+ (regexp (assoc-default major-mode
+ helm-c-browse-code-regexp-alist))
+ (num-line (if (string= helm-pattern "") beg (1- beg))))
+ (when (and regexp (string-match regexp str-line))
+ (format "%4d:%s" (line-number-at-pos num-line) str-line))))
+
+(defvar helm-c-source-browse-code
+ '((name . "Browse code")
+ (init . (lambda ()
+ (helm-candidate-buffer helm-current-buffer)
+ (with-helm-current-buffer
+ (jit-lock-fontify-now))))
+ (candidate-number-limit . 9999)
+ (candidates-in-buffer)
+ (get-line . helm-c-browse-code-get-line)
+ (type . line)
+ (recenter)))
+
;;;###autoload
(defun helm-regexp ()
"Preconfigured helm to build regexps.
@@ -190,6 +214,15 @@ otherwise search in whole buffer."
:buffer "*Helm Occur*"
:history 'helm-c-grep-history)))
+;;;###autoload
+(defun helm-browse-code ()
+ "Preconfigured helm to browse code."
+ (interactive)
+ (helm :sources 'helm-c-source-browse-code
+ :buffer "*helm browse code*"
+ :default (thing-at-point 'symbol)))
+
+
(provide 'helm-regexp)
;;; helm-regexp.el ends here

0 comments on commit f5d0706

Please sign in to comment.