From: Paxxus <paxxus@hotmail.com>
To: <now@bitwi.se>
Cc: help-gnu-emacs@gnu.org
Subject: RE: Perl "plugin" for Emacs
Date: Sat, 24 Sep 2011 01:08:13 +0200 [thread overview]
Message-ID: <DUB101-W52D2B4E0A56690FC8226D7D80F0@phx.gbl> (raw)
In-Reply-To: <CADdV=MtDu+LCQtgghph-em1fPt7mE3RRyc+Ea2TXzfd7KitiNw@mail.gmail.com>
> 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!
prev parent reply other threads:[~2011-09-23 23:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-23 21:22 Perl "plugin" for Emacs paxxus
2011-09-23 22:01 ` Nikolai Weibull
2011-09-23 22:31 ` Paxxus
2011-09-23 23:08 ` Paxxus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DUB101-W52D2B4E0A56690FC8226D7D80F0@phx.gbl \
--to=paxxus@hotmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=now@bitwi.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).