Skip to content

Commit

Permalink
Add multi match support in GID and update grep help.
Browse files Browse the repository at this point in the history
* helm-help.el (helm-grep-help-message): Do it.
* helm-id-utils.el (helm-gid-candidates-process):
Provide multi match support, with highlighting not fully working.
  • Loading branch information
Thierry Volpiatto committed Apr 2, 2016
1 parent 0f92a68 commit 2d52cc4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
9 changes: 9 additions & 0 deletions helm-help.el
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,9 @@ Helm Gid use the symbol at point as default-input.
You have access to this command also from `helm-find-files' which allow you to
navigate to another directory to consult its database.
NOTE: Helm gid support multi matches but only the last pattern entered will be
highlighted due to the lack of ~--color~ support in GID itself.
* Helm AG
** Tips
Expand All @@ -636,6 +639,12 @@ This file supports same entries as what you will find in `helm-grep-ignored-file
`helm-grep-ignored-directories'.
As always you can access helm AG from `helm-find-files'.
Starting at version 0.30 AG allow providing one or more TYPE argument on its command line.
Helm provide completion on these TYPES arguments when available with your AG version,
Use a prefix argument when starting helm ag session to get this completion.
NOTE: You can mark several types to match in your ag query, however on the first versions of
AG providing this, only one type was allowed, so in this case the last marked will take effect.
** Commands
\\<helm-grep-map>
\\[helm-goto-next-file]\t\tNext File.
Expand Down
17 changes: 12 additions & 5 deletions helm-id-utils.el
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,18 @@ MacPorts to install id-utils, it should be `gid32'."
:type 'string)

(defun helm-gid-candidates-process ()
(let ((proc (start-process
"gid" nil helm-gid-program
"-r" helm-pattern)))
(set (make-local-variable 'helm-grep-last-cmd-line)
(format "%s -r %s" helm-gid-program helm-pattern))
(let* ((patterns (split-string helm-pattern))
(default-com (format "%s -r %s" helm-gid-program
(shell-quote-argument (car patterns))))
(cmd (helm-aif (cdr patterns)
(concat default-com
(cl-loop for p in it
concat (format " | grep --color=always %s"
(shell-quote-argument p))))
default-com))
(proc (start-process-shell-command
"gid" helm-buffer cmd)))
(set (make-local-variable 'helm-grep-last-cmd-line) cmd)
(prog1 proc
(set-process-sentinel
proc (lambda (_process event)
Expand Down

0 comments on commit 2d52cc4

Please sign in to comment.