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

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

Re: Why can't I use xargs emacs?


From: Ivan Shmakov
Subject: Re: Why can't I use xargs emacs?
Date: Wed, 03 Feb 2010 09:40:06 +0600
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "PJB" == Pascal J Bourguignon <pjb@informatimago.com> writes:
>>>>> "AF" == Adam Funk <a24061@ducksburg.com> writes:

 AF> The emacs command can take a list of filename arguments, so why
 AF> can't I get xargs to work with it?

 > $ find -name '*.txt' |xargs emacs -nw
 > emacs: standard input is not a tty

[...]

 PJB> emacs is an interactive program.  It expects its stdin and stdout
 PJB> to be hooked to the terminal, where it can display a character
 PJB> matrix, and from which it can read user input.

[...]

 PJB> To open several files in emacs, you could either use emacsclient,
 PJB> or an emacs lisp script.

 PJB> Launch emacs in a separate terminal: xterm -e emacs -nw &

 PJB> In emacs, start the server: M-x server-start RET

 PJB> In a shell, you can then type: find -name '*.txt' | xargs
 PJB> emacsclient -n

        Note that a separate terminal is not necessary, as one can call
        Shell commands from Emacs, like:

$ emacs -nw 
...
M-x server-start RET
...
M-! find -name '*.txt' | xargs emacsclient -n & RET

        But one has to use an “asynchronous” (i. e., “background”)
        command, as indicated by an ampersand after the command line.

 PJB> Simplier would be to just open the file in emacs:

 PJB> Launch emacs: emacs -nw Then type: C-x C-f *.txt RET

        Though that will not recurse into the directories, as the plain
        find will.

[...]

- -- 
FSF associate member #7257
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkto8B8ACgkQMBO2oCMOM0oHhACgrkJftA4oYTWHscebcCtUvVj2
YroAn2Yg0f8GXeGQoeYzKQcm90waYytw
=hJo3
-----END PGP SIGNATURE-----


reply via email to

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