[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Perl "plugin" for Emacs
From: |
Paxxus |
Subject: |
RE: Perl "plugin" for Emacs |
Date: |
Sat, 24 Sep 2011 01:08:13 +0200 |
> Date: Sat, 24 Sep 2011 00:01:57 +0200
> Subject: Re: Perl "plugin" for Emacs
> From: now@bitwi.se
> To: paxxus@hotmail.com
> CC: Help-gnu-emacs@gnu.org
>
> On Fri, Sep 23, 2011 at 23:22, paxxus <paxxus@hotmail.com> wrote:
>
> > I'd like to be able to perform some text formatting in Perl as that will be
> > way faster for me than having to learn Lisp. Here's what I'm after:
> >
> > 1. Select a region in Emacs.
> > 2. Press a key.
> > 3. The selected text is passed to a Perl script.
> > 4. Output from Perl script replaces the selected region.
> >
> > Is this possible and what exactly would I have to put in my .emacs if, let's
> > say, the key I want to bind is F5 and the Perl script is located at
> > ~/Emacs/format.pl
>
> Look up the function shell-command-on-region.
I figured out how to do it. I put this command into my .emacs:
(global-set-key
(kbd "<f5>")
( lambda () (interactive)
( shell-command-on-region
(region-beginning) (region-end) "perl ~/Emacs/format.pl" nil t
)
)
)
Thanks for the help!