all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* Re: Modifying default grep prompt (cursor movement, etc)
  2007-05-08  9:15 Modifying default grep prompt (cursor movement, etc) spamfilteraccount
@ 2007-05-09 15:05 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2007-05-09 15:05 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.

Have you tried C-u M-x grep ?
The C-u is the important bit.


        Stefan

^ 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.