helm-ag
helm-ag copied to clipboard
Error in helm-ag--do-ag-candidate-process
- Emacs version
27.0.50
- Operating system
Ubuntu
- Search command(ag, pt, ack etc) and version
ag version 0.31.0
Features:
+jit +lzma +zlib
- Last value of
helm-ag--last-command
("ag" "--nocolor" "--nogroup" "--ignore-case" "--ignore" "TAGS" "--ignore" ".#*" "--ignore" "*.hi" "--ignore" "*.o" "--ignore" "*~" "--ignore" "*.bin" "--ignore" "*.lbin" "--ignore" "*.so" "--ignore" "*.a" "--ignore" "*.ln" "--ignore" "*.blg" "--ignore" "*.bbl" "--ignore" "*.elc" "--ignore" "*.lof" "--ignore" "*.glo" "--ignore" "*.idx" "--ignore" "*.lot" "--ignore" "*.fmt" "--ignore" "*.tfm" "--ignore" "*.class" "--ignore" "*.fas" "--ignore" "*.lib" "--ignore" "*.mem" "--ignore" "*.x86f" "--ignore" "*.sparcf" "--ignore" "*.dfsl" "--ignore" "*.pfsl" "--ignore" "*.d64fsl" "--ignore" "*.p64fsl" "--ignore" "*.lx64fsl" "--ignore" "*.lx32fsl" "--ignore" "*.dx64fsl" "--ignore" "*.dx32fsl" "--ignore" "*.fx64fsl" "--ignore" "*.fx32fsl" "--ignore" "*.sx64fsl" "--ignore" "*.sx32fsl" "--ignore" "*.wx64fsl" "--ignore" "*.wx32fsl" "--ignore" "*.fasl" "--ignore" "*.ufsl" "--ignore" "*.fsl" "--ignore" "*.dxl" "--ignore" "*.lo" "--ignore" "*.la" "--ignore" "*.gmo" "--ignore" "*.mo" "--ignore" "*.toc" "--ignore" "*.aux" "--ignore" "*.cp" "--ignore" "*.fn" "--ignore" "*.ky" "--ignore" "*.pg" "--ignore" "*.tp" "--ignore" "*.vr" "--ignore" "*.cps" "--ignore" "*.fns" "--ignore" "*.kys" "--ignore" "*.pgs" "--ignore" "*.tps" "--ignore" "*.vrs" "--ignore" "*.pyc" "--ignore" "*.pyo" "--ignore" "{arch}" "--ignore" "_darcs" "--ignore" "_MTN" "--ignore" ".bzr" "--ignore" ".hg" "--ignore" ".git" "--ignore" ".svn" "--ignore" ".src" "--ignore" "MCVS" "--ignore" "CVS" "--ignore" "RCS" "--ignore" "SCCS" "--ignore" "node_modules/" "--ignore" ".idea/" "--ignore" ".ensime_cache/" "--ignore" ".eunit/" "--ignore" ".git/" "--ignore" ".hg/" "--ignore" ".fslckout/" "--ignore" "_FOSSIL_/" "--ignore" ".bzr/" "--ignore" "_darcs/" "--ignore" ".tox/" "--ignore" ".svn/" "--ignore" ".stack-work/" "--all-text" "provider")
Actual behavior
Expected behavior
to return zero candidates?
Steps to reproduce
It seems that whenever I start helm-projectile
with -s
, as soon as I press the space key I get the above error.
Similar thing happens for me ( emacs 26.1, Linux Mint 18.1 ).
Using helm-do-ag-project-root
.
When I type -G<SPACE>
I get a very similar error as above.
Any news/hint on this?
You can work around it for now by searching for "-s"
using the search string "-- -s"
, which will force ag
to treat -s
as the search parameter and not a commandline flag.
I deleted the package and reinstalled from melpa per a comment on reddit. fixed my issue (even though versions were the same)
I have same issue here. Reinstallation does not help.
GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511)) of 2018-05-31
Helm-ag version: 20170209.1545 (Commit: 2fc02c4ead29bf0db06fd70740cc7c364cb650ac) Helm version: 20190404.947 Helm core version: 20190326.921
I have the same problem if I start a search pattern with an option, like -Gtxt$
, in order to restrict a search to specific files.
Below is a functional workaround (or rather a hack).
I first tried to implement the workaround as advice, but I was surprised that it does not work (maybe somebody can figure out why):
(defun my-helm-ag-process (orig-fun &rest args)
(or (apply orig-fun args)
(start-file-process "echo" nil "echo")))
(advice-add 'helm-ag--do-ag-candidate-process :before #'my-helm-ag-process)
So I redefined the function completely:
(defun helm-ag--do-ag-candidate-process ()
(let* ((non-essential nil)
(default-directory (or helm-ag--default-directory
helm-ag--last-default-directory
default-directory))
(cmd-args (helm-ag--construct-do-ag-command helm-pattern)))
(if cmd-args
(let ((proc (apply #'start-file-process "helm-do-ag" nil cmd-args)))
(setq helm-ag--last-query helm-pattern
helm-ag--last-command cmd-args
helm-ag--ignore-case (helm-ag--ignore-case-p cmd-args helm-pattern)
helm-ag--last-default-directory default-directory)
(prog1 proc
(set-process-sentinel
proc
(lambda (process event)
(helm-process-deferred-sentinel-hook
process event (helm-default-directory))
(when (string= event "finished\n")
(helm-ag--do-ag-propertize helm-input))))))
;; Workaround: simply provide an empty echo process
(start-file-process "echo" nil "echo"))))
What it does is simple. It checks whether a process was returned. If not it creates one which echoes an empty line.