2

I want to wrap the helm-do-ag in another function to search in a specific dir. The following is the description of helm-do-ag.

helm-do-ag is an interactive Lisp closure in `helm-ag.el'.
(helm-do-ag &optional BASEDIR TARGETS)

I have the following function (minimal working example):

(defun helm-do-ag-project ()
  "ag the string in the given project"
(interactive)
(let ((helm-ag-command-option (concat helm-ag-command-option " -G v$ -f --verilog ")))
 (helm-do-ag (concat "d:/Projects/ProjectName/workarea/module_name/hdl/rtl")))
)

But, the results it returns are:

rtl/filename.v: ...text....
rtl/mod1/filename1.v ....text....

The problem is the result also has the "rtl"(rtl is the dir provided as part of the BASEDIR. Hence I am not able to open the file using persistent action. Helm tries to look for

d:/Projects/ProjectName/workarea/module_name/hdl/rtl/rtl/filename.v

and helm is unable to open the file, since path is not correct.

  • (defun helm-do-ag-project () "Grep the string in the given project" (interactive) (let ((rootdir (concat "d:/Projects/ProjectName/workarea/module_name/hdl/rtl/"))) (let ((helm-ag-command-option (concat helm-ag-command-option " -G v$ -f --verilog "))) (helm-do-ag rootdir)))) – Shankar Ramakrishnan Aug 16 '18 at 6:13
  • The above code worked. The main difference was - the dir name should have a "/" at the end. The following will not work. "d:/Projects/ProjectName/workarea/module_name/hdl/rtl" But this will work: "d:/Projects/ProjectName/workarea/module_name/hdl/rtl/" - note the "/" at after "rtl" – Shankar Ramakrishnan Aug 16 '18 at 6:16
  • This question can be closed. – Shankar Ramakrishnan Aug 16 '18 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.