Based on this answer, and its with-initial-minibuffer function, I am trying to call helm-projectile-grep, customizing minibuffer pre-filling.

I try to avoid the default behaviour, which is to pre-fill the minibuffer with the contents of the region (if active) or the thing at point.

If I use

(defun with-initial-minibuffer-projectile-grep (str)
  (funcall `(lambda ()
                  (lambda () (insert (format ": %s " ,str)))
                (call-interactively 'helm-projectile-grep)))))

and then I call it with

(with-initial-minibuffer-projectile-grep "mytext")

things go wrong. Any idea of where to start from ?

  • Helm tweaks Emacs minibuffer heavily and it is not easy change the behaviour without modifying the source code. The pre-fill input of helm is controlled by :input slot of the helm func, helm-projectile-grep makes use of it in github.com/bbatsov/projectile/blob/1159110/…, you can try to change code in there. – xuchunyang Dec 2 '15 at 18:32
  • @xuchunyang Yes, I know, this is where I got stuck, but there must be a way using noflet or similar – csantosb Dec 2 '15 at 19:32

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.