From: "spamfilteraccount@gmail.com" <spamfilteraccount@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Modifying default grep prompt (cursor movement, etc)
Date: 8 May 2007 02:15:42 -0700 [thread overview]
Message-ID: <1178615742.464306.187340@l77g2000hsb.googlegroups.com> (raw)
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))))))
next reply other threads:[~2007-05-08 9:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-08 9:15 spamfilteraccount [this message]
2007-05-09 15:05 ` Modifying default grep prompt (cursor movement, etc) Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1178615742.464306.187340@l77g2000hsb.googlegroups.com \
--to=spamfilteraccount@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.