Skip to content

Commit

Permalink
* helm-regexp.el (helm-c-display-to-real-numbered-line): Renamed from…
Browse files Browse the repository at this point in the history
… helm-c-display-to-real-line.

Moved from helm-utils.el.
  • Loading branch information
thierryvolpiatto committed Aug 18, 2012
1 parent bec9d22 commit 0ea6be6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 11 additions & 2 deletions helm-regexp.el
Expand Up @@ -192,7 +192,7 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
(candidates-in-buffer)
(migemo)
(get-line . helm-c-occur-get-line)
(display-to-real . helm-c-display-to-real-line)
(display-to-real . helm-c-display-to-real-numbered-line)
(action . (("Go to Line" . helm-c-action-line-goto)
("Query replace regexp (C-u Not inside word.)"
. helm-c-occur-query-replace-regexp)))
Expand Down Expand Up @@ -310,11 +310,20 @@ Line is parsed for BEG position to END position."
(type . line)
(recenter)))

(defun helm-c-display-to-real-numbered-line (candidate)
"This is used to display a line in occur style in helm sources.
e.g \" 12:some_text\".
It is used with type attribute 'line'."
(if (string-match "^ *\\([0-9]+\\):\\(.*\\)$" candidate)
(list (string-to-number (match-string 1 candidate))
(match-string 2 candidate))
(error "Line number not found")))

;;; Type attributes
;;
;;
(define-helm-type-attribute 'line
'((display-to-real . helm-c-display-to-real-line)
'((display-to-real . helm-c-display-to-real-numbered-line)
(action ("Go to Line" . helm-c-action-line-goto)))
"LINENO:CONTENT string, eg. \" 16:foo\".
Expand Down
6 changes: 0 additions & 6 deletions helm-utils.el
Expand Up @@ -633,12 +633,6 @@ directory, open this directory."
(dired (file-name-directory file))
(dired-goto-file file)))

(defun helm-c-display-to-real-line (candidate)
(if (string-match "^ *\\([0-9]+\\):\\(.*\\)$" candidate)
(list (string-to-number (match-string 1 candidate))
(match-string 2 candidate))
(error "Line number not found")))

(defun helm-c-action-line-goto (lineno-and-content)
(apply #'helm-goto-file-line
(helm-interpret-value (helm-attr 'target-file))
Expand Down

0 comments on commit 0ea6be6

Please sign in to comment.