[OS X Emacs] yank or insert command output

Marinos K marinos at agxivatein.com
Mon Feb 14 21:47:04 EST 2011


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

I knew those commands - I even use them regurarly,

I just do not know how to implement it myself in an external command,
I' ll try to study the source code of M-! so I can get an idea

thx

On 15/02/2011 4:24 π.μ., Jack Repenning wrote:
> 
> 
> On 08/02/2011 4:37 ?.?., Marinos K wrote:
>> There are several commands that output some text-string in the minibuffer
>>
>> how can I insert this text at the point the cursor is instead of the
>> stdout ???
> 
> 
> Some of them already know how to do this themselves. For example, shell-command (which you may know as M-!) has documentation that says:
> 
>> shell-command is an interactive compiled Lisp function in `simple.el'.
>>
>> It is bound to ⌘!, <menu-bar> <tools> <shell>.
>>
>> (shell-command COMMAND &optional OUTPUT-BUFFER ERROR-BUFFER)
>>
>> Execute string COMMAND in inferior shell; display output, if any.
>> With prefix argument, insert the COMMAND's output at point.
>>
>> ...
>>
>> The optional second argument OUTPUT-BUFFER, if non-nil,
>> says to put the output in some other buffer.
> 
> (You should read the rest of that before trying it; I've left out such important details as "... it first erases OUTPUT-BUFFER ..." Just "C-h f shell-command".)
> 
> Its friend shell-command-on-region (M-|) is even nicer:
> 
>> Execute string COMMAND in inferior shell with region as input.
>> Normally display output (if any) in temp buffer `*Shell Command Output*';
>> Prefix arg means replace the region with it.  Return the exit code of
>> COMMAND.
> 
> So, for example, you can select part of your file and do
> 
>> M-| sort
> 
> and a buffer will pop up with a sorted copy of those lines. If, on the other hand, you select and the
> 
>> ^U M-| sort
> 
> then the sorted list replaces the formerly unsorted list.
> 
> (All this assumes your system has a program named "sort," accessible in the default way, that reads its input, sorts it, and sprays it to its output -- i.e., that you're on some Unix variant, rather than Windows.)
> 
> 
> 
> 
> 
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> http://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx

- -- 
Marinos Koutsomichalis
PhD Researcher, Music Research Center, University of York
Contemporary Music Research Centre (CMRC)
Faculty of Music Technology & Acoustics - TEI of Crete
www.marinoskoutsomichalis.com



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNWeknAAoJEHtg0hV818BQF1MH/RPbg4V9rH/mIFE1pnjf1yit
Cn/5Wv0DbSikDMphFnP0brFdhxGo4jFjh+6oC1Aj6Cvhlf6WtUSRbl/qvFTcMrrd
4lBtfpA07NvnN/F6b95GjR/Coy/lJm73kWdhhj8GqjTZLQi3WK/AdJYhrApxpY73
87aJMkEy8ifIAeJSleuywm5Jl3z7kVCpCvP0RMuEAokFHiRNTHHRsrark1fnfIEp
2Ni5dInS+rBf8sut1qaZJpprcIcFKYPlLYxRrhyYg16jVRl2PCwmBjvNDGIWrYw+
fN+RRgiKuKDwEb6kohYd4v4+IZgRVAsyecW1VvcGEoRD+PQBC8sFO+jjNOjYZeQ=
=2qux
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x7CD7C050.asc
Type: application/pgp-keys
Size: 4258 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20110215/788ed8ea/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x7CD7C050.asc.sig
Type: application/octet-stream
Size: 287 bytes
Desc: not available
URL: <http://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20110215/788ed8ea/attachment.obj>


More information about the MacOSX-Emacs mailing list