From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "spamfilteraccount@gmail.com" Newsgroups: gmane.emacs.help Subject: Modifying default grep prompt (cursor movement, etc) Date: 8 May 2007 02:15:42 -0700 Organization: http://groups.google.com Message-ID: <1178615742.464306.187340@l77g2000hsb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1178616834 18332 80.91.229.12 (8 May 2007 09:33:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 8 May 2007 09:33:54 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 08 11:33:51 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HlM4t-0008Cd-6I for geh-help-gnu-emacs@m.gmane.org; Tue, 08 May 2007 11:33:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HlMBx-0001Rw-45 for geh-help-gnu-emacs@m.gmane.org; Tue, 08 May 2007 05:41:09 -0400 Original-Path: shelby.stanford.edu!newshub.stanford.edu!postnews.google.com!l77g2000hsb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 24 Original-NNTP-Posting-Host: 194.88.55.211 Original-X-Trace: posting.google.com 1178615742 12031 127.0.0.1 (8 May 2007 09:15:42 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 8 May 2007 09:15:42 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.20 (X11; Linux i686; U; en),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: l77g2000hsb.googlegroups.com; posting-host=194.88.55.211; posting-account=b98TkQ0AAAD7PsllN8gfWGRoPOPWdnv4 Original-Xref: shelby.stanford.edu gnu.emacs.help:148210 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:43804 Archived-At: 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))))))