[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [h-e-w] problem with save-excursion
From: |
Eli Daniel |
Subject: |
RE: [h-e-w] problem with save-excursion |
Date: |
Mon, 29 Jul 2002 10:32:57 -0400 |
Are you using transient-mark-mode to highlight the region when the mark is
active? The docs for save-excursion say:
...
This construct does not save `deactivate-mark', and therefore
functions that change the buffer will still cause deactivation
of the mark at the end of the command. To prevent that, bind
`deactivate-mark' with `let'.
-Eli
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of Mike Krell
> Sent: Sunday, July 28, 2002 4:21 PM
> To: address@hidden
> Subject: [h-e-w] problem with save-excursion
>
>
> 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
>