0

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)
  (interactive)
  (funcall `(lambda ()
              (interactive)
              (minibuffer-with-setup-hook
                  (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 ?

2
  • 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
    Commented Dec 2, 2015 at 18:32
  • @xuchunyang Yes, I know, this is where I got stuck, but there must be a way using noflet or similar
    – csantosb
    Commented Dec 2, 2015 at 19:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.