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

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

Re: Calling external programs in emacs


From: Joost Kremers
Subject: Re: Calling external programs in emacs
Date: Fri, 13 Jan 2017 22:51:21 +0100
User-agent: mu4e 0.9.19; emacs 25.1.50.3


On Fri, Jan 13 2017, James K. Lowden wrote:
On Fri, 13 Jan 2017 18:53:42 +0000 (UTC)
Sam Nirvana <samnirvana@linux.org> wrote:

I'm new to emacs, so forgive my inexperience.

As you know, with Vim I can compile, say, a TeX file from within the editor with the following command:

        :!pdftex %

Is there a way to do the same thing with emacs?

The emacs function you want is called shell-function. It's usually mapped to M-! (meta-bang). You can verify that with either
        C-h f shell-function
or
        C-h k M-!

To run asynchronously, see async-shell-function, usually M-&.

It should perhaps be pointed out that while M-! works to call `shell-command', Emacs usually provides some interface to the most commond commands you may want to call for a specific file type. So running pdftex on a file doesn't require calling M-! and typing out the command. Personally, I use AUCTeX (which you should really check out if you use TeX or LaTeX), which makes it possible to call TeX & friends with C-c C-c. It even tries to guess what command you're most likely to execute next.


--
Joost Kremers
Life has its moments



reply via email to

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