unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Modifying default grep prompt (cursor movement, etc)
@ 2007-05-08  9:15 spamfilteraccount
  2007-05-09 15:05 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: spamfilteraccount @ 2007-05-08  9:15 UTC (permalink / raw)
  To: help-gnu-emacs

I usually grep with *, so I'd like to insert a * at the end of the
grep prompt and move the cursor to the end of te default search string
provided from the current context by grep.

I came up with the solution below, but it's not very nice checking the
current minibuffer contents to see if we're in the grep command.

Advising the grep command didn't work, because the prompt is handled
by interactive which seemingly runs before advise kicks in.

Is there a better way way to do this?



(add-hook 'minibuffer-setup-hook 'my-grep-hook)

(defun my-grep-hook ()
  (when (eq (string-match "^grep" (minibuffer-contents)) 0)
    (insert "*")
    (setq unread-command-events (cons 'left
                                      (cons 'left
                                            (cons 'left unread-command-
events))))))

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-09 15:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08  9:15 Modifying default grep prompt (cursor movement, etc) spamfilteraccount
2007-05-09 15:05 ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).