From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@newcastle.ac.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: Indirect buffers Date: Mon, 09 Jun 2014 11:49:05 +0100 Message-ID: <877g4q1hpa.fsf@newcastle.ac.uk> References: <61933bd2-7a72-4666-bf23-deb677e1d62f@default> <83egyz2w4q.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1402310985 16817 80.91.229.3 (9 Jun 2014 10:49:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Jun 2014 10:49:45 +0000 (UTC) Cc: Vitalie Spinu , Stefan Monnier , Drew Adams , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 09 12:49:39 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wtx8z-0005Gz-CL for ged-emacs-devel@m.gmane.org; Mon, 09 Jun 2014 12:49:37 +0200 Original-Received: from localhost ([::1]:60106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtx8z-0000nV-2e for ged-emacs-devel@m.gmane.org; Mon, 09 Jun 2014 06:49:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtx8r-0000mn-Mt for emacs-devel@gnu.org; Mon, 09 Jun 2014 06:49:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wtx8n-0008CJ-81 for emacs-devel@gnu.org; Mon, 09 Jun 2014 06:49:29 -0400 Original-Received: from cheviot12.ncl.ac.uk ([128.240.234.12]:45717) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wtx8i-0008A2-AG; Mon, 09 Jun 2014 06:49:20 -0400 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot12.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1Wtx8d-0000ew-CB; Mon, 09 Jun 2014 11:49:15 +0100 Original-Received: from jangai.ncl.ac.uk ([10.66.67.223] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1Wtx8d-0007Tc-Ij; Mon, 09 Jun 2014 11:49:15 +0100 In-Reply-To: <83egyz2w4q.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 8 Jun 2014 19:39:49 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:172416 Archived-At: Eli Zaretskii writes: > So I suggest to step back a notch, and try looking for ideas to > implement these features in a way that doesn't require different > buffers to share text. E.g., even manually keeping several separate > buffers in sync by updating their text when it changes in one of them, > sounds like an easier way. Emacs is very good at inserting and > deleting chunks of text into/from a buffer, and from what I've read, > all the major problems Vitalie complained about will be miraculously > solved. It should be easy to implement a prototype in Lisp, and if it > turns out it is too slow (which I sincerely doubt), we could add some > simple infrastructure in C to speed that up. Forgive the plug, but this is exactly how my own linked-buffer works. https://github.com/phillord/linked-buffer/ It works fine and is performant enough for smallish files; I haven't tried it for much larger ones yet. This is with a very dumb implementation (the whole buffer is copied on the after change hook). The big advantage over indirect buffers is that I control the way in which text in the two buffers is related; if this is `buffer-string' you'd get the same as indirect-buffers (although less efficiently). If you use the no-properties version, then you get something like indirect-buffers but multi-modes work. If you use an function which changes the text, then you can support two modes with incompatible syntaxes. No support at all is needed from the modes. Phil