From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mike Krell Newsgroups: gmane.emacs.help Subject: problem with save-excursion Date: Mon, 29 Jul 2002 08:56:59 -0700 (PDT) Sender: help-gnu-emacs-admin@gnu.org Message-ID: <20020729155659.59139.qmail@web20209.mail.yahoo.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1027958269 7420 127.0.0.1 (29 Jul 2002 15:57:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 29 Jul 2002 15:57:49 +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 17ZCu3-0001vQ-00 for ; Mon, 29 Jul 2002 17:57:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17ZCuR-0003v9-00; Mon, 29 Jul 2002 11:58:11 -0400 Original-Received: from web20209.mail.yahoo.com ([216.136.226.64]) by fencepost.gnu.org with smtp (Exim 3.35 #1 (Debian)) id 17ZCtI-0003qs-00 for ; Mon, 29 Jul 2002 11:57:00 -0400 Original-Received: from [12.9.3.180] by web20209.mail.yahoo.com via HTTP; Mon, 29 Jul 2002 08:56:59 PDT Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 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:733 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:733 Hello, I've written a little elisp function to run the current buffer through perl (or any other command). However, the current region is lost as a result of running the code, even though I'm using save- excursion. Can anyone help with this? Thanks, Mike defun perl-replace-buffer () "Apply perl command to buffer" (interactive) (save-excursion (mark-whole-buffer) (let ((start (region-beginning)) (end (region-end))) (shell-command-on-region start end (read-from-minibuffer "Command: " '("perl -pe \"\"" . 11 )) t t ) ) ) ) __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com