From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lee Doolan Newsgroups: gmane.emacs.help Subject: Re: command output into buffer Date: Sat, 13 Apr 2002 12:42:51 -0700 Sender: help-gnu-emacs-admin@gnu.org Message-ID: <7obscntmf8.fsf@stkitts.pacbell.net> References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: main.gmane.org 1018727142 25389 127.0.0.1 (13 Apr 2002 19:45:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 13 Apr 2002 19:45:42 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16wTSv-0006bO-00 for ; Sat, 13 Apr 2002 21:45:41 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16wTSN-0008Mc-00; Sat, 13 Apr 2002 15:45:07 -0400 Original-Received: from mta5.snfc21.pbi.net ([206.13.28.241]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16wTQ2-0008BM-00 for ; Sat, 13 Apr 2002 15:42:42 -0400 Original-Received: from stkitts.pacbell.net.pacbell.net ([63.206.68.90]) by mta5.snfc21.pbi.net (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GUI007V0UR459@mta5.snfc21.pbi.net> for help-gnu-emacs@gnu.org; Sat, 13 Apr 2002 12:42:41 -0700 (PDT) In-Reply-To: Original-To: help-gnu-emacs@gnu.org User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386--freebsd) Original-Lines: 38 Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:83 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:83 i have this in my .emacs file. ------------------------------------------------------------------------ ;; ;;I found this relly useful snippet on USENET (comp.emacs) posted by: ;; ;; From: Tim Christian ;; (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