From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: Shortcut to compile "highlighted Text/Tag" Date: Fri, 19 Apr 2013 19:49:52 -0400 Organization: A noiseless patient Spider Message-ID: References: <77c0a5fe-681f-450f-8a43-086d664fcd83@googlegroups.com> <4b900f10-5c84-44c0-8ad0-4330995710b3@googlegroups.com> <85d98745-77be-4173-850c-d22f004f61af@googlegroups.com> <706a2e8f-a107-410d-b305-8204445ced2e@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1366430826 10203 80.91.229.3 (20 Apr 2013 04:07:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Apr 2013 04:07:06 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 20 06:07:08 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UTP4t-0005du-VU for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Apr 2013 06:07:08 +0200 Original-Received: from localhost ([::1]:48911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTP4t-00060e-Gx for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Apr 2013 00:07:07 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Injection-Info: mx05.eternal-september.org; posting-host="b8816fa7300cd668c1c8ea38fc847e8a"; logging-data="8164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19MO8yXoS34/lihc6NLE1GQ4a4YnwuMUZo=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) Cancel-Lock: sha1:sDNsWudJV5XHG0uj3A4g8GLRvFE= sha1:YcN+MCp1GqqPxfGmz5iKhNCG+TQ= Original-Xref: usenet.stanford.edu gnu.emacs.help:198007 X-Mailman-Approved-At: Sat, 20 Apr 2013 00:06:14 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90278 Archived-At: Rami A writes: > Dan, > I was actually able to copy/paste the whole gid.el code into my dotemacs file. > It did actually work :) > It figures out the pattern the cursor is at and applies the compile gid command on it. > > The only this I am still trying to solve is skipping the confirmation question so I don't have to press RET every time I search for a symbol. > > So now when I press F4 I get: > Run gid (with args): PATERN > > I need to confirm. > > Do you know of a way I could skip the confirmation? > > This is the code I copied: > > ;;;; gid.el -- run gid using compilation mode. > > (require 'compile) > ;;(require 'elisp-utils) > (provide 'gid) > > (defvar gid-command "gid" "The command run by the gid function.") > > (defun gid (args) > "Run gid, with user-specified ARGS, and collect output in a buffer. > While gid runs asynchronously, you can use the \\[next-error] command to > find the text that gid hits refer to. The command actually run is > defined by the gid-command variable." > (interactive (list (read-input > (concat "Run " gid-command " (with args): ") (word-around-point)))) > ;; Preserve the present compile-command > (let (compile-command > (compilation-buffer-name-function > (lambda (mode) (concat "*gid " args "*")))) > ;; For portability between v18 & v19, use compile rather than compile-internal > (compile (concat gid-command " " args)))) ^^^^^^^ I think the prompt you are getting that you don't like is here. If you set compilation-read-command to nil it should compile without a prompt. As far as using M-x grep, you need to execute a command that outputs a message with filename and line number in a specific format. In the case of grep, you need to either give it multiple files or use the -nH flags or just -n with multiple files. gid might have similar options. -- Dan Espen