Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 39c674b6fd1b9e1ac62f9b6048d05a9daeae0c32 1 parent ce88e38
@thierryvolpiatto thierryvolpiatto authored
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
View
10 helm-buffers.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)))
;;;###autoload
(defun helm-buffers-run-multi-occur ()
+ "Run `helm-multi-occur-as-action' by key."
(interactive)
(helm-c-quit-and-execute-action 'helm-multi-occur-as-action))
View
16 helm-help.el
@@ -144,6 +144,22 @@ INSERT-CONTENT-FN is the text to be displayed in BUFNAME."
\nTips:
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.
+
+e.g
+
+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'.
View
5 helm-regexp.el
@@ -309,7 +309,7 @@ arg METHOD can be one of buffer, buffer-other-window, buffer-other-frame."
(helm-c-grep-highlight-match str))
i)))
-(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.
Please sign in to comment.
Something went wrong with that request. Please try again.