Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* helm-grep.el (helm-c-goto-next-or-prec-file): always use helm-c-gre…

…p-split-line.

* helm-regexp.el (helm-moccur-always-search-in-current): New user var.
Don't use split-string.
  • Loading branch information...
commit c3fb0f01b636ffe26a38285ac7bae71c48230c2b 1 parent 6d5cca2
@thierryvolpiatto thierryvolpiatto authored
Showing with 19 additions and 7 deletions.
  1. +6 −4 helm-grep.el
  2. +13 −3 helm-regexp.el
View
10 helm-grep.el
@@ -675,6 +675,8 @@ in recurse, search beeing made on `helm-zgrep-file-extension-regexp'."
"Split a grep output line."
;; Don't print until grep line is valid.
(when (string-match "^\\(.*\\):\\([0-9]+\\):\\(.*\\)" line)
+ ;; Don't use split-string because buffer/file name or string
+ ;; may contain a ":".
(loop for n from 1 to 3 collect (match-string n line))))
(defun helm-c-grep-cand-transformer (candidates sources)
@@ -714,8 +716,8 @@ in recurse, search beeing made on `helm-zgrep-file-extension-regexp'."
(defun helm-c-goto-next-or-prec-file (n)
"Go to next or precedent candidate file in helm grep/etags buffers.
If N is positive go forward otherwise go backward."
- (let* ((current-line-list (split-string
- (helm-get-selection nil t) ":"))
+ (let* ((current-line-list (helm-c-grep-split-line
+ (helm-get-selection nil t)))
(current-fname (nth 0 current-line-list))
(bob-or-eof (if (eq n 1) 'eobp 'bobp))
(mark-maybe #'(lambda ()
@@ -728,9 +730,9 @@ If N is positive go forward otherwise go backward."
;; Exit when current-fname is not matched or in `helm-grep-mode'
;; the line is not a grep line i.e 'fname:num:tag'.
(unless (or (string= current-fname
- (car (split-string
+ (car (helm-c-grep-split-line
(buffer-substring (point-at-bol)
- (point-at-eol)) ":")))
+ (point-at-eol)))))
(and (eq major-mode 'helm-grep-mode)
(not (get-text-property (point-at-bol) 'help-echo))))
(funcall mark-maybe)
View
16 helm-regexp.el
@@ -48,6 +48,12 @@ type\\|theme\\|var\\|group\\|custom\\|const\\|method\\|class\\)"
to a specific `major-mode'."
:type '(alist :key-type symbol :value-type regexp)
:group 'helm-regexp)
+
+(defcustom helm-moccur-always-search-in-current t
+ "Helm multi occur always search in current buffer when non--nil."
+ :group 'helm-regexp
+ :type 'boolean)
+
(defface helm-moccur-buffer
'((t (:foreground "DarkTurquoise" :underline t)))
@@ -206,7 +212,10 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
;;
;;
(defun helm-m-occur-init (buffers)
- "Create the initial helm multi occur buffer."
+ "Create the initial helm multi occur buffer with BUFFERS list."
+ (when helm-moccur-always-search-in-current
+ (setq buffers (cons helm-current-buffer
+ (remove helm-current-buffer buffers))))
(helm-init-candidates-in-buffer
'global
(loop for buf in buffers
@@ -233,7 +242,8 @@ i.e Don't replace inside a word, regexp is surrounded with \\bregexp\\b."
&optional (method (quote buffer)))
"Jump to CANDIDATE with METHOD.
arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
- (let* ((split (split-string candidate ":" t))
+ (require 'helm-grep)
+ (let* ((split (helm-c-grep-split-line candidate))
(buf (car split))
(lineno (string-to-number (nth 1 split))))
(case method
@@ -267,7 +277,7 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
"Transformer function for `helm-c-source-moccur'."
(require 'helm-grep)
(loop for i in candidates
- for split = (split-string i ":" t)
+ for split = (helm-c-grep-split-line i)
for buf = (car split)
for lineno = (nth 1 split)
for str = (nth 2 split)
Please sign in to comment.
Something went wrong with that request. Please try again.