help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shortcut to compile "highlighted Text/Tag"


From: Dan Espen
Subject: Re: Shortcut to compile "highlighted Text/Tag"
Date: Fri, 19 Apr 2013 19:49:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

Rami A <rami.ammari@gmail.com> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]