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

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

Re: integrating output from external program to emacs, ala gcc, grep


From: Pascal J. Bourguignon
Subject: Re: integrating output from external program to emacs, ala gcc, grep
Date: Wed, 10 Sep 2014 12:35:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

glen stark <address@hidden> writes:

> Hi everyone.
>
> I'm writing a little tool that parses some code, and identifies likely 
> candidates for refactoring.  Now what I'd like to do is be able to call 
> that from emacs, and use the 'next error' function like I do when using 
> gcc (via compile), or when I grep in the eshell.
>
> So what do I have to do so that emacs can use my tools output?  I suppose 
> there's some standard output format defined to allow tools to jump to 
> errors.  Could someone point me to the documentation?
>
> I guess the easiest thing to do is call the tool from the compile 
> command.  

This is indeed the best for this kind of tools.

> What are the other possibilities?  How do I get it to run like 
> grep does in eshell for example?

You could use shell-command or shell-command-to-string,
or at a lower level, comint or processes (call-process or
start-process).

But you would just end up reproducing the features of compile.

Just customize:

compilation-error-regexp-alist
compilation-error-regexp-alist-alist

to teach compile the format of your messages.


> If anyone has tips that might save me a little time here, or result in a 
> better implementation,  I'll be very grateful.

Now, if your tool was interactive, then you would use comint to create
an interactive mode (like inferior-lisp, ruby-mode, maxima-mode, etc).
But this isn't the case, so just do M-x compile  (or of course, you can
provide a specific command that calls compile with the right shell
command to invoke your tool).

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk


reply via email to

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