all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Luca Ferrari <fluca1978@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: Perl and SQL within the same buffer
Date: Fri, 20 Jan 2023 10:08:19 +0100	[thread overview]
Message-ID: <CAKoxK+7i=vN9t-kJo=nNSq2NHSK2OeUTxkE0Lx03_BxVQZgCVw@mail.gmail.com> (raw)
In-Reply-To: <CAKoxK+6QPWH1B2e7sznY8vP=RnEE5uz6kfKVpoSL_Tp9kxO-dg@mail.gmail.com>

On Mon, Oct 3, 2022 at 4:18 PM Luca Ferrari <fluca1978@gmail.com> wrote:
>
> Hi all,
> when I edit PostgreSQL PL/Perl functions, I have a source code that
> has a basic SQL mode in the outer part of a function, and Perl in the
> inner part.
> Is there a way to instrument Perl to recognize and use both modes and
> syntax highlight? Something like what it happens when editing HTML and
> PHP inside it.
> An example of source code I edit:
>
> CREATE OR REPLACE FUNCTION
> pwc185.task2_plperl( text )
> RETURNS text
> AS $CODE$
> my ( $input ) = @_;
> my @output;
> my $counter = 4;
>
> for ( split( //, $input ) ) {
>     push @output, 'x'
>         and $counter--
>         and next if ( /[a-z0-9]/i ) and $counter > 0;
>     push @output, $_;
> }
>
> return join( '', @output );
> $CODE$
> LANGUAGE plperl;
>
>
>
> Everything outside the $CODE$ lines is SQL, everything insde is Perl.


Another idea that came into my mind is to trigger an alternative
editor buffer within the $CODE$ region, so that I can write Perl code
into a separated buffer that will be placed entirely into the main
buffer once I've done. This is somehow similar to what org-mode does.
Any suggestion on how to activate an embedded Perl editing buffer?

Thanks,
Luca



      parent reply	other threads:[~2023-01-20  9:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03 14:18 Perl and SQL within the same buffer Luca Ferrari
2022-10-03 22:38 ` Emanuel Berg
2023-01-20  9:08 ` Luca Ferrari [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKoxK+7i=vN9t-kJo=nNSq2NHSK2OeUTxkE0Lx03_BxVQZgCVw@mail.gmail.com' \
    --to=fluca1978@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.