From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Luca Ferrari <fluca1978@gmail.com>
Newsgroups: gmane.emacs.help
Subject: Re: help in writing function to pop indirect buffer
Date: Mon, 30 Jan 2023 14:30:10 +0100
Message-ID: <CAKoxK+55wu8bnBk_kVLFnrOd_CYD5JWNYYg5u3xSWS-M-hH=Bw@mail.gmail.com>
References: <CAKoxK+6t6KBwevLqeCDyL5VQ6_N3XB7L1xC6rDXbX964LeJnLA@mail.gmail.com>
 <Y9FtHZX6a9veJvI/@protected.localdomain>
 <63d50c2c.5d0a0220.cad7c.0cb0@mx.google.com>
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="25257"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>, Jean Louis <bugs@gnu.support>
To: Bruno Barbier <brubar.cs@gmail.com>
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 30 14:32:15 2023
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1pMUGd-0006Tf-IL
	for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 30 Jan 2023 14:32:15 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <help-gnu-emacs-bounces@gnu.org>)
	id 1pMUFW-0001Lv-E5; Mon, 30 Jan 2023 08:31:07 -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 <fluca1978@gmail.com>)
 id 1pMUFG-000128-DT
 for help-gnu-emacs@gnu.org; Mon, 30 Jan 2023 08:30:51 -0500
Original-Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <fluca1978@gmail.com>)
 id 1pMUFE-0007fi-Ol
 for help-gnu-emacs@gnu.org; Mon, 30 Jan 2023 08:30:50 -0500
Original-Received: by mail-pf1-x42e.google.com with SMTP id a184so7666126pfa.9
 for <help-gnu-emacs@gnu.org>; Mon, 30 Jan 2023 05:30:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=USzc8fnYGKvtayw0OO+XPK9lUSjOiKPD1OvXNjWRm9o=;
 b=byx8A/ZHdRFLpbEDfRxenIlqKVIN+rww/itqjpIzJlmDGwHMlI51iuD3nRZxjaKiPl
 epsgwcm0q0JWgFyhnI9iNMSHjpODOGQlOY/o5UQgwR6l2vxx6UMDhehKOLuHwPa3muif
 wBB6LYBAvCFln1btp2hpJPr6yhVE80c8HQQtOccHhqwlIc9MqRtcACfTKdELV0HbWIwk
 2IXsRWwSLHWs95GgiqEhR6b9kJYNrFAjkbYYJB+mI23l1y3AGaHBedd1GNJB+FAiPRPO
 A0phqnv84hTlj+ojYOszjcLmam/AalCyIdzbYt/g6DTJSQF5qzhoJy4XV3K27sQv3oCi
 AHcw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc: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=USzc8fnYGKvtayw0OO+XPK9lUSjOiKPD1OvXNjWRm9o=;
 b=IMhiyQguZR9aGNP0xb+pVnzAHJePP3UDlNAI84ptSOvLP2jv1BjEovdfRPQK8Xifkf
 4Eeaha2nh0+o6VNEQV0eKXePm1byaZkCzDHxFYr6Celk3pi0NcKM75UvdfMV5+6jxfeT
 dNRjMVqdNKF/YgcKxqrOAFzJIWvUXZc4swzwM7rQhemwNz2GNJ5OxlmRMR0ZbQaLvQL5
 F4k+3GL7J41iRdfTQ0Vj2gV1u8MejphpylEO7tDBKMO87g/HDeA/Rc65YTWmLB2zuXRm
 eqSZV/9c3IMs0nCsTmFJzm8TwNGQ42LwT91s4SVCIcwCRZCLofoO+ieQAEx6wPCE2z0C
 TTHg==
X-Gm-Message-State: AFqh2kokYQ1O3v8AhJi7c801xev/jNPRS9Jv024EhR32l9OOvz1Cu7dF
 wgzitfLBOvdoGAl1DWLLsCw9gaMpnx4HE8O1Hq+/cky4
X-Google-Smtp-Source: AMrXdXvaxE9V4zt6Uhg+E/YwdvMIc4K9D7TDbN8XtE9NNE/roM6cOCpLWXF1pzzFC2NUX5My9Kpj2p3ghggyqGpote4=
X-Received: by 2002:a63:e23:0:b0:4cf:122f:2102 with SMTP id
 d35-20020a630e23000000b004cf122f2102mr4818654pgl.98.1675085446673; Mon, 30
 Jan 2023 05:30:46 -0800 (PST)
In-Reply-To: <63d50c2c.5d0a0220.cad7c.0cb0@mx.google.com>
Received-SPF: pass client-ip=2607:f8b0:4864:20::42e;
 envelope-from=fluca1978@gmail.com; helo=mail-pf1-x42e.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 <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/help-gnu-emacs>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
 <mailto:help-gnu-emacs-request@gnu.org?subject=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:142557
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/142557>

On Sat, Jan 28, 2023 at 12:51 PM Bruno Barbier <brubar.cs@gmail.com> wrote:
> In your use case, it might not be possible to use indirect buffers: the
> base buffer and the indirect buffer share the same text and its
> properties, and, syntax highlighting is mostly done using text
> properties.
>

Gosh!
I've tested that if I enable cperl-mode in the original buffer, then
the indirect buffer inherits the syntax highligthing also for new
code.

> Org mode allows to edit pieces of text in any mode (using standard buffers).
> The lisp function doing most of the work is `org-edit-src-code'. Maybe
> you could call/reuse something from there.

It is a little too complex for me to understand it.
Another idea could be to use a normal buffer, narrowed to the region I
would like to have. The problem is that clone-buffer cannot be used
for a file visiting buffer.
Any idea?

Thanks,
Luca