* command output into buffer
@ 2002-04-12 17:49 G Anna
2002-04-13 19:42 ` Lee Doolan
2002-04-14 14:12 ` Fernando Dobladez
0 siblings, 2 replies; 3+ messages in thread
From: G Anna @ 2002-04-12 17:49 UTC (permalink / raw)
Dear All,
How to insert the output of a shell command at point? For example,
currently if I want to insert the output of the ls command then I
normally run the command in the xterm and cut-paste the output into
the emacs buffer.
But I think there is a way to insert the output into the buffer
automatically. Can anybody help?
Thank you for your time.
Cheers,
anna
--
Get your free e-mail account at http://www.linuxmail.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: command output into buffer
2002-04-12 17:49 command output into buffer G Anna
@ 2002-04-13 19:42 ` Lee Doolan
2002-04-14 14:12 ` Fernando Dobladez
1 sibling, 0 replies; 3+ messages in thread
From: Lee Doolan @ 2002-04-13 19:42 UTC (permalink / raw)
i have this in my .emacs file.
------------------------------------------------------------------------
;;
;;I found this relly useful snippet on USENET (comp.emacs) posted by:
;;
;; From: Tim Christian <tim@unt.edu>
;;
(defun my-shell-command-on-region nil
"Replace region with ``shell-command-on-region''.
By default, this will make mark active if it is not and then prompt
you for a shell command to run and replaces region with the results.
This is handy for doing things like getting external program locations
in scripts and running grep and whatnot on a region."
(interactive)
(save-excursion
(if (equal mark-active nil)
(push-mark nil nil -1))
(setq string
(read-from-minibuffer "Shell command on region: " nil nil nil
'shell-command-history))
(shell-command-on-region (region-beginning) (region-end) string -1)
; Get rid of final newline cause I normally did by hand anyway.
(delete-char -1)))
;;------------------------------------------------------------------------
(defun insert-output-from-shell-command (commandstr)
"Insert output from a shell command at point"
(interactive "*sInsert From Command:")
(shell-command commandstr 1))
(global-set-key "\M-oi" 'insert-output-from-shell-command)
(global-set-key "\M-or" 'my-shell-command-on-region)
--
no toll on the internet; there are paths of many kinds;
whoever passes this portal will travel freely in the world
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: command output into buffer
2002-04-12 17:49 command output into buffer G Anna
2002-04-13 19:42 ` Lee Doolan
@ 2002-04-14 14:12 ` Fernando Dobladez
1 sibling, 0 replies; 3+ messages in thread
From: Fernando Dobladez @ 2002-04-14 14:12 UTC (permalink / raw)
M-! Execute a command
C-u M-! Execute command and insert output in current buffer
M-| Execute command passing the current region as stdin to the command.
C-u M-| Execute command passing the current region as stdin to the
command, and replace the region with the stdout of the command (filter)
>Dear All,
>
>How to insert the output of a shell command at point? For example,
>currently if I want to insert the output of the ls command then I
>normally run the command in the xterm and cut-paste the output into
>the emacs buffer.
>
>But I think there is a way to insert the output into the buffer
>automatically. Can anybody help?
>
>Thank you for your time.
>
>Cheers,
>anna
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-14 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-12 17:49 command output into buffer G Anna
2002-04-13 19:42 ` Lee Doolan
2002-04-14 14:12 ` Fernando Dobladez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).