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: help in writing function to pop indirect buffer Date: Wed, 25 Jan 2023 12:13:15 +0100 Message-ID: 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="13052"; 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 Wed Jan 25 12:14:34 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 1pKdjd-0003FK-QG for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 25 Jan 2023 12:14:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKdj4-0007Hn-T2; Wed, 25 Jan 2023 06:13:58 -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 1pKdj1-0007HM-M2 for help-gnu-emacs@gnu.org; Wed, 25 Jan 2023 06:13:55 -0500 Original-Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKdiz-0005DX-Mr for help-gnu-emacs@gnu.org; Wed, 25 Jan 2023 06:13:54 -0500 Original-Received: by mail-pg1-x52f.google.com with SMTP id v3so13171953pgh.4 for ; Wed, 25 Jan 2023 03:13:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=LA/qZjJ2RKmL7ZwMbRphEu8et5SHJG1IDNmhPBdW6aw=; b=QyIrURan2xi7DCHPSdmeIPwAwIIIul78aqYV2v5WnN0E5tGpOxflcroabwxZGdnoYr 9wZbaiYQdy4OQIQt+GLXTpf32O55L+TrTjVKfanuWhjYqTo6uY+bZE35z0r4f+R6U7zy PF2aQA//g2od0G7bOAckMGkgKfGOV3u+6QLe2GP6xcsnjUcGOuyfw8jD3B5lhOsRlr97 BdCY5FkqcRO29wfofgwQNkaQmcJwhSQAr/JSc/DPwKSVJSl664/gaArgBN21n2P1GEIj UUsEgwBWRdzyPY5ZPOs7XZg+qi9Jp5ksvFE8kbqLvLeXG7A9prLf19/buQaWsVVJPbcQ BDog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LA/qZjJ2RKmL7ZwMbRphEu8et5SHJG1IDNmhPBdW6aw=; b=etmRnfImmsNJ/JPOAd1YqZkkkbSc6Eow9kdpBrMLBXEz0BuMdvbTa2GHk2dTvWC0a5 8NH8jck/LBJhQ03iCVM3/0xt+QnpkZhfjdPdYJmWShksvzVTgZt7EXccdu0YjJUSo4NR tJlacjQyqZw+yUH7mVs9yB9TVJLk387efav0hJmfxA7x2Rs5WKy7CF+5TBVH8qqout/0 0QPSM7aDV+3sJN4DnMaORszpc8AsL4WIXb1gsEuln+DZSeIEQJSEqlZOymNg/zoMud0L 5aFx4zFHm5hDcfz5YkxCpx515Y/J5Z6zhV4MKRF0Xn7RiVXhmNpVbiowEG//3ZOTGhT3 LtMg== X-Gm-Message-State: AFqh2kqjWKtRx1XL31tg4PqmnrpFG2bmfPksOZywf82HNVLOWI6Zas4O OtWCPuZTDUGRfMXge74DHh1I0+pDrzOtldCvWHIcYQgA4ck= X-Google-Smtp-Source: AMrXdXtd1y1BKsxxHTt4MPTCMd6K9BFd9JacYTFQCsXYfz+er56HmtpmS3NafTN2DyaoIphg/mOP2xWMPmsXlKcvPz4= X-Received: by 2002:a65:6446:0:b0:4d1:50ee:bbe3 with SMTP id s6-20020a656446000000b004d150eebbe3mr2286647pgv.118.1674645231775; Wed, 25 Jan 2023 03:13:51 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=fluca1978@gmail.com; helo=mail-pg1-x52f.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:142527 Archived-At: Hi all, I'm still working on my need to edit Perl code within a region of an SQL file, with all my configurations that apply to normal Perl buffers. One solution I came up is to launch an indirect buffer to edit the region I need. I've written the following: (defun plperl-indirect-buffer-editing () (interactive) (let ((plperl-buffer-name (generate-new-buffer-name "*plperl-indirect*")) (plperl-buffer-mode 'cperl-mode) (start (if mark-active (min (point) (mark)) (point))) (end (if mark-active (max (point) (mark)) (point)))) (pop-to-buffer (make-indirect-buffer (current-buffer) plperl-buffer-name)) (funcall plperl-buffer-mode) (font-lock-mode) (narrow-to-region start end) (goto-char (point-min)) (shrink-window-if-larger-than-buffer))) This almost works, but when the indirect buffer is popped, I do not have syntax highlight while I have indentation and apparently all the other Perl things. How can I turn on syntax highlight? Another question: how can I let start and end to be bound to the region between a defined tag like '$code$'? I thought about word-search-forward and backward, but it seems ugly and not really stable. Thanks, Luca