From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: indirect-buffers and text-properties Date: Thu, 30 Jan 2014 11:17:39 -0500 Message-ID: References: <87fvo5r6uk.fsf@newcastle.ac.uk> <8761p1r214.fsf@newcastle.ac.uk> <87txclpj72.fsf@newcastle.ac.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1391098699 31223 80.91.229.3 (30 Jan 2014 16:18:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Jan 2014 16:18:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 30 17:18:25 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1W8uJq-0006Cf-4f for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Jan 2014 17:18:22 +0100 Original-Received: from localhost ([::1]:51064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8uJp-0004ze-L7 for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Jan 2014 11:18:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8uJY-0004zS-7r for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 11:18:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8uJQ-0001ig-Ti for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 11:18:04 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:52716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8uJQ-0001ia-MI for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 11:17:56 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W8uJP-0005vB-B8 for help-gnu-emacs@gnu.org; Thu, 30 Jan 2014 17:17:55 +0100 Original-Received: from 206-248-158-187.dsl.teksavvy.com ([206.248.158.187]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 30 Jan 2014 17:17:55 +0100 Original-Received: from monnier by 206-248-158-187.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 30 Jan 2014 17:17:55 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 206-248-158-187.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:pPkKsEq5dLNLTMBdytprA/9FPNA= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:95811 Archived-At: >>> Really? I've started using them because they enable me to have the point >>> in two places at once; for example, in the pre-amble and the body of a >> [...] >>> visible window). Indirect buffers seem to be a nice solution for this. >> That would be using a definition of "nice" very different from the one >> I'm familiar with ;-) >> BTW, you might like to M-x report-emacs-bug and request exactly this >> feature for "preserving window-specific point". It can probably be >> implemented in a *much* lighter way than by using indirect-buffers. > I would, but I am not sure what the correct behavour is. > Consider: > Window 1 (point at beg) > ---- > Window 2 (point at end) > C-x 1 > Window 1 (point at beg) > C-x 2 > Window 1 (point at beg) > ---- > Window 2 (point at beg) > If one of the two windows is indirect, at least point is preserved > somewhere, so I can get back to it. We could stash the window-point to some buffer-local variable buffer-other-points when the window is removed, and when the buffer is displayed in a new window, we could check if buffer-other-points holds other locations and reuse them. And/or provide a new command to cycle through those buffer-other-points. And/or use the mark-ring instead of buffer-other-points and just let the user use mark-ring navigation to return to the previous position. > Okay, I have to accept your word on this, but I can't see another > solution in my head. The best I have come up with is to hook into the > change-functions, and link two (otherwise independent buffers) together > so that the text in both is identical. AFAICT this is tractable, at > least if I only edit one of them. I tend to this the "multiple major-mode in a single buffer" option would work better. But in any case, there is no simple solution like "indirect-buffer". Each of the major modes that participate in a mixed-mode buffer needs to be written in a way that is aware of the fact that there can be other modes on other parts of the buffer. Stefan