Browse files

* helm-buffers.el (helm-multi-occur-as-action): Issue #103 Use @ inpu…

…t as default input when present.

* helm-regexp.el (helm-multi-occur-1): Take one more arg INPUT.
* helm-help.el: Document new behavior of helm-buffers-list.
  • Loading branch information...
thierryvolpiatto committed Aug 26, 2012
1 parent ce88e38 commit 39c674b6fd1b9e1ac62f9b6048d05a9daeae0c32
Showing with 27 additions and 4 deletions.
  1. +8 −2 helm-buffers.el
  2. +16 −0 helm-help.el
  3. +3 −2 helm-regexp.el
@@ -480,11 +480,17 @@ See `helm-ediff-marked-buffers'."
(helm-ediff-marked-buffers candidate t))
(defun helm-multi-occur-as-action (_candidate)
- (let ((buffers (helm-marked-candidates)))
- (helm-multi-occur-1 buffers)))
+ "Multi occur action for `helm-c-source-buffers-list'.
+Can be used by any source that list buffers."
+ (let ((buffers (helm-marked-candidates))
+ (input (loop for i in (split-string helm-pattern " " t)
+ thereis (and (string-match "\\`@\\(.*\\)" i)
+ (match-string 1 i)))))
+ (helm-multi-occur-1 buffers input)))
(defun helm-buffers-run-multi-occur ()
+ "Run `helm-multi-occur-as-action' by key."
(helm-c-quit-and-execute-action 'helm-multi-occur-as-action))
@@ -144,6 +144,22 @@ INSERT-CONTENT-FN is the text to be displayed in BUFNAME."
You can enter a partial name of major-mode (e.g lisp, sh) to narrow down buffers.
Enter then a space and a pattern to narrow down to buffers matching this pattern.
+If you enter a space and a pattern prefixed by \"@\" helm will search for text matching
+this pattern INSIDE the buffer (i.e not in the name of buffer).
+NOTE that if you enter your pattern prefixed with \"@\" but escaped, helm will search a buffer
+matching \"@pattern\" but will not search inside.
+if I enter in pattern prompt:
+\"lisp ^helm @moc\"
+helm will narrow down the list by selecting only buffers that are in lisp mode, start by helm
+and match \"moc\" in their contents.
+if I enter in pattern prompt:
+\"lisp ^helm moc\"
+Notice there is no \"@\" this time
+helm will look for lisp mode buffers starting by \"helm\" and have \"moc\" in their name.
When creating a new buffer use \\[universal-argument] to choose a mode for your buffer in a list.
This list is customizable, see `helm-buffers-favorite-modes'.
@@ -309,7 +309,7 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
(helm-c-grep-highlight-match str))
-(defun helm-multi-occur-1 (buffers)
+(defun helm-multi-occur-1 (buffers &optional input)
"Main function to call `helm-c-source-moccur' with BUFFERS list."
(declare (special buffers))
(let ((helm-compile-source-functions
@@ -318,7 +318,8 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
(copy-sequence helm-compile-source-functions))))
(helm :sources 'helm-c-source-moccur
:buffer "*helm multi occur*"
- :history 'helm-c-grep-history)))
+ :history 'helm-c-grep-history
+ :input input)))
;;; Helm browse code.

0 comments on commit 39c674b

Please sign in to comment.