2011-09-04 10 views
5

Emacs nasıl bir program çalıştırıyor ve çıktı/yanıt beklemiyorsunuz? Ben harici bir programda bir pdf açmaya çalıştı:Emacs'ten bir program çalıştırın ve çıktı için beklemeyin

(shell-command (concat "start sumatrapdf " (shell-quote-argument path) " -page " search)))) 

Ancak mevcut SumatraPDF süreç kapatılana kadar başka dosyalar açılmaz. async-shell-command'dan yoruldum, ancak ihtiyacım olmayan Async çıkışı olan yeni bir arabellek açar.

Harici programlarda dosyaların doğru yolu nedir?

cevap

9

start-process işlevi olduğunu işleyebilir: Açtığınız süreci ile Bufer ilişkilendirmek istemiyorsanız

(start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) 

Start a program in a subprocess. Return the process object for it. 
NAME is name for process. It is modified if necessary to make it unique. 
BUFFER is the buffer (or buffer name) to associate with the process. 

Process output (both standard output and standard error streams) goes 
at end of BUFFER, unless you specify an output stream or filter 
function to handle the output. BUFFER may also be nil, meaning that 
this process is not associated with any buffer. 

PROGRAM is the program file name. It is searched for in `exec-path' 
(which see). If nil, just associate a pty with the buffer. Remaining 
arguments are strings to give program as arguments. 

If you want to separate standard output from standard error, invoke 
the command through a shell and redirect one of them using the shell 
syntax. 

- TAMPON argüman olarak nil geçmesi

+0

Teşekkür ederim Victor. İpucunuzla biraz farklı bir fonksiyon buldum ('start-process-shell-command') çünkü' start-process' argümanları düzgün bir şekilde almamıştı. –

+0

Peki, BUFFER'ın sonuna nasıl geçilir ve gösterilir? – zobi8225

2

C-h k M-!

bakın ... COMMAND, ve işareti ile biterse, zaman uyumsuz olarak yürütür. çıkışı, Async Kabuk Komutu 'arabelleğinde görüntülenir. Bu arabellek, kipindedir. ...

IOW, M-! my_command --opt=foo arg1 arg2 &my_command başlatmak ve içinde çalışan my_command ile *Async Shell Command* tampon oluşturmak ama emacs hemen size geri kontrol verecektir olacaktır.

+0

Benim durumumda Emacs herhangi bir cevap beklememelidir. Sadece bir dosya açın ve unutun (aslında, belirli bir sayfada pdf açacak org modu ve özel köprü türü içindir). Neyse, dikkatin için teşekkürler Ross. –

İlgili konular