From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Luca Ferrari Newsgroups: gmane.emacs.help Subject: Re: Perl and SQL within the same buffer Date: Fri, 20 Jan 2023 10:08:19 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="880"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 20 10:09:43 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pInP3-000AYZ-J5 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 20 Jan 2023 10:09:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pInOQ-0001ij-J6; Fri, 20 Jan 2023 04:09:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pInOO-0001i8-L4 for help-gnu-emacs@gnu.org; Fri, 20 Jan 2023 04:09:00 -0500 Original-Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pInOM-0005BP-Ux for help-gnu-emacs@gnu.org; Fri, 20 Jan 2023 04:09:00 -0500 Original-Received: by mail-pg1-x52e.google.com with SMTP id b6so3620449pgi.7 for ; Fri, 20 Jan 2023 01:08:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=s+3/Ip+AYWTqw3/BXpSeew3Tp4yfDB9yb42qR3XymmI=; b=L30LzPT0hq6PUbgP936eMjvwVLSr9RwXzCLTy/MzrFM95BrexyphbQIUqWQsp1r2/W jhKnsf0Uc9dP5oM6f9+ZT/vZTOatyOo5NC+CpY9ITCGBCYRthvvnSufvwqPx1TMuCFyT uUMHrq1fcDJNv5p7d85Il3QIWBq57pTSnLg9Oc12qTn+/zg4iV/AOrL+ZEk7waL1G63j 333pfZiLIFLRDxAqiNcbJ/TNo0l8iyYKAR8KP+CXY190fHfsN0hKFH2RGLM0DxiTlQYo xPa3uqs/1xQqKaxwZ0rzVrgTPNDc19uCLTHFYgRufUbCloY+hwuQoISLMb2zW0b6iSsa oc8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=s+3/Ip+AYWTqw3/BXpSeew3Tp4yfDB9yb42qR3XymmI=; b=53IwZIkII8ayKuekmbjdZK65vkrKUWVvsZAGGaPo60cfK/y79iaQR3nfB7tRy8Ia+z j+LQktACpJS4hT2oSpGfjp5OVx0V+aAoF8ClSI4/xZXgxbYwgex47AwM+82JfJGrQT3c KfNuMswZBZvjSOU35DUtAr7JHN63VN01sohGwkSjRfUGvjXaTFBjFV2+AzutE3Yyz4M8 BSGFiAVP3vpci5utZG5ebDgI+qhudkWCcN/xibWy5b5d3nVGlnS0FHmqZxfhCNfrOngQ eM+GEDBsq2Dv4owv1kSdcQqNAeY9SsAMiFaSw+CijKVLHyta7+VR3sMhl726yBUHKhpD 04ng== X-Gm-Message-State: AFqh2kr0uSfSy3e4+rdSTR0+IOnmnEF+a5dqbSlM3ho0i3BbW5XDXxv7 rsAu4QvzhcEkzumbjcCbJ2+Al8kwsDfyCrsepqq9tKYN2I4= X-Google-Smtp-Source: AMrXdXuptA8KOnCJq4929XqLbUeac1mAcnusmKsHiAgTcRch29aHWpj3tkWNP0IWQmBtna9GgH4aG1m9/Z/zPH19Ur0= X-Received: by 2002:aa7:82ca:0:b0:58d:c184:6a21 with SMTP id f10-20020aa782ca000000b0058dc1846a21mr1418767pfn.29.1674205736638; Fri, 20 Jan 2023 01:08:56 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=fluca1978@gmail.com; helo=mail-pg1-x52e.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142448 Archived-At: On Mon, Oct 3, 2022 at 4:18 PM Luca Ferrari 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